summaryrefslogtreecommitdiff
path: root/graphics/src/render.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/render.rs')
-rw-r--r--graphics/src/render.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/graphics/src/render.rs b/graphics/src/render.rs
index cc9847e..8202e49 100644
--- a/graphics/src/render.rs
+++ b/graphics/src/render.rs
@@ -278,6 +278,9 @@ impl Renderer {
let camera = dungeon.render_camera();
let mut rc = r.begin_mode2D(camera);
self.draw_bg_tilemap(&mut rc);
+ if self.debug {
+ rc.draw_pathing_deug(dungeon);
+ }
self.draw_entities(&mut rc, dungeon);
self.draw_fg_tilemap(&mut rc);
}
@@ -952,5 +955,27 @@ where
) {
self.draw_rectangle(x.into(), y.into(), width.into(), height.into(), color);
}
+
+ fn draw_pathing_deug(&mut self, dungeon: &Dungeon) {
+ for enemy in &dungeon.enemies {
+ let Some(ai) = enemy.get_ai() else {
+ continue;
+ };
+ let Some(moves) = ai.moves() else {
+ continue;
+ };
+ for pos in moves {
+ let (x, y) = pos.xy();
+ let color = Color::RED.alpha(0.5);
+ self.draw_rectangle_ext(
+ x * TILE_SIZE,
+ y * TILE_SIZE,
+ TILE_SIZE,
+ TILE_SIZE,
+ color,
+ );
+ }
+ }
+ }
}
impl<T> RaylibDrawExt for T where T: RaylibDraw {}