MCPcopy Create free account
hub / github.com/17cupsofcoffee/rl / draw

Method draw

src/main.rs:64–86  ·  view source on GitHub ↗
(&mut self, ctx: &mut Context)

Source from the content-addressed store, hash-verified

62 }
63
64 fn draw(&mut self, ctx: &mut Context) -> tetra::Result {
65 graphics::clear(ctx, Color::BLACK);
66
67 self.console.clear();
68
69 for (x, y, tile) in self.resources.map.tile_positions() {
70 self.console.set_bg(x, y, tile.color);
71 }
72
73 let mut sprite_query = self
74 .world
75 .query::<(&components::Position, &components::Sprite)>();
76
77 for (_, (position, sprite)) in sprite_query.iter() {
78 self.console
79 .set_char(position.x, position.y, sprite.character);
80 self.console.set_fg(position.x, position.y, sprite.color);
81 }
82
83 self.console.draw(ctx);
84
85 Ok(())
86 }
87}
88
89fn main() -> tetra::Result {

Callers

nothing calls this directly

Calls 5

clearMethod · 0.80
tile_positionsMethod · 0.80
set_bgMethod · 0.80
set_charMethod · 0.80
set_fgMethod · 0.80

Tested by

no test coverage detected