summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-07 09:01:24 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-07 09:01:24 -0500
commita57d8ef9aaa66d6970f50a860f4a644ba7c9785d (patch)
tree4aeff0be60e7825d86f0d7a9c311c3406aecbc0a /graphics
parentfix clippy and tests (why am i the one doing this) (diff)
downloadDungeonCrawl-a57d8ef9aaa66d6970f50a860f4a644ba7c9785d.tar.gz
DungeonCrawl-a57d8ef9aaa66d6970f50a860f4a644ba7c9785d.tar.bz2
DungeonCrawl-a57d8ef9aaa66d6970f50a860f4a644ba7c9785d.zip
graphics: update some doc strings
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/render.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/graphics/src/render.rs b/graphics/src/render.rs
index 2467bb1..86ed6e6 100644
--- a/graphics/src/render.rs
+++ b/graphics/src/render.rs
@@ -136,6 +136,9 @@ impl Renderer {
self.draw_ui(&mut r, dungeon);
}
+ /// Update frame metadata while we still have access to the
+ /// `RaylibHandle`. These fields are inaccessable once it's
+ /// turned into a `RaylibDrawHandle`.
fn update_per_frame_data(&mut self, handle: &RaylibHandle) {
// Get last known fps
self.fps = handle.get_fps();
@@ -150,6 +153,7 @@ impl Renderer {
};
}
+ /// Returns the Raylib Camera setup with needed 2D position/transforms
fn render_camera(&self, dungeon: &Dungeon) -> Camera2D {
let cpos = dungeon.camera();
let width = self.width;
@@ -168,6 +172,7 @@ impl Renderer {
}
}
+ /// Draws the game dungeon
fn draw_dungeon<R>(&mut self, r: &mut R, t: &RaylibThread, dungeon: &Dungeon)
where
R: RaylibDraw + RaylibMode2DExt + RaylibTextureModeExt,
@@ -175,9 +180,9 @@ impl Renderer {
self.update_tilemaps(r, t, &dungeon.floor);
let camera = self.render_camera(dungeon);
let mut rc = r.begin_mode2D(camera);
- self.draw_tiles_bg(&mut rc);
+ self.draw_bg_tilemap(&mut rc);
self.draw_entities(&mut rc, dungeon);
- self.draw_tiles_fg(&mut rc);
+ self.draw_fg_tilemap(&mut rc);
}
/// Updates all tilemaps
@@ -267,7 +272,7 @@ impl Renderer {
}
/// Draw dungeon tiles (foreground layer)
- fn draw_tiles_fg<R>(&mut self, r: &mut R)
+ fn draw_fg_tilemap<R>(&mut self, r: &mut R)
where
R: RaylibDraw,
{
@@ -277,7 +282,7 @@ impl Renderer {
}
/// Draw dungeon tiles (background layer)
- fn draw_tiles_bg<R>(&mut self, r: &mut R)
+ fn draw_bg_tilemap<R>(&mut self, r: &mut R)
where
R: RaylibDraw,
{
@@ -326,6 +331,7 @@ impl Renderer {
self.draw_debug_ui(r);
}
+ /// Draw health meter in the top left of the screen
fn draw_health<R>(&self, r: &mut R, player: &Player)
where
R: RaylibDraw,
@@ -371,6 +377,8 @@ impl Renderer {
}
}
+ /// Draws the player's inventory
+ /// NOTE: Nothing is drawn if the inventory is empty
fn draw_inventory<R>(&self, r: &mut R, player: &Player)
where
R: RaylibDraw,