summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-10-18 00:04:25 -0400
committerFreya Murphy <freya@freyacat.org>2025-10-18 00:04:48 -0400
commit1be47bcbcbcfa3aa0e06342c6d1e9bb1540cbbd3 (patch)
tree64e9b116d2b37139fd8e7dd4d598f2f254fba645 /graphics
parentgraphicsL add input functionality to (diff)
downloadDungeonCrawl-1be47bcbcbcfa3aa0e06342c6d1e9bb1540cbbd3.tar.gz
DungeonCrawl-1be47bcbcbcfa3aa0e06342c6d1e9bb1540cbbd3.tar.bz2
DungeonCrawl-1be47bcbcbcfa3aa0e06342c6d1e9bb1540cbbd3.zip
dungeon: refactor into entity module, and add struct (better match proposal)
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/render.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/graphics/src/render.rs b/graphics/src/render.rs
index 1bb32ee..8bde77d 100644
--- a/graphics/src/render.rs
+++ b/graphics/src/render.rs
@@ -2,7 +2,7 @@
//! the game, with each frame represented by a `Renderer` and
//! frame specific information in `FrameInfo`.
-use dungeon::{Dungeon, Entity};
+use dungeon::{Dungeon, Entity, Player};
use raylib::{
color::Color,
prelude::{RaylibDraw, RaylibDrawHandle, RaylibHandle},
@@ -81,8 +81,14 @@ impl<'a> Renderer<'a> {
// Draw the dungeon
self.draw_tiles(dungeon);
- self.draw_player(dungeon);
+ self.draw_player(&dungeon.player);
+ // Draw the ui
+ self.draw_ui(dungeon);
+ }
+
+ /// Draws player HP, inventory, and floor number
+ pub fn draw_ui(&mut self, _dungeon: &Dungeon) {
#[cfg(feature = "debug")]
// Draw fps (debug only)
self.draw_fps();
@@ -94,8 +100,8 @@ impl<'a> Renderer<'a> {
}
/// Draw the player sprite
- pub fn draw_player(&mut self, dungeon: &Dungeon) {
- self.draw_entity(dungeon.player());
+ pub fn draw_player(&mut self, player: &Player) {
+ self.draw_entity(&player.entity);
}
/// Draws an entity