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.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/graphics/src/render.rs b/graphics/src/render.rs
index d450f16..bfd9e37 100644
--- a/graphics/src/render.rs
+++ b/graphics/src/render.rs
@@ -148,7 +148,7 @@ impl Textures {
})
}
- fn item_texture(&self, _item: &Item) -> &Texture2D {
+ const fn item_texture(&self, _item: Item) -> &Texture2D {
// TODO: make item textures
&self.error
}
@@ -201,7 +201,7 @@ impl Renderer {
})
}
- pub fn toggle_debug(&mut self) {
+ pub const fn toggle_debug(&mut self) {
self.debug = !self.debug;
}
@@ -254,11 +254,11 @@ impl Renderer {
// Restore the fb
self.framebuffer = Some(fb);
- };
+ }
}
/// Draws the game dungeon
- fn draw_dungeon<R>(&mut self, r: &mut R, dungeon: &Dungeon)
+ fn draw_dungeon<R>(&self, r: &mut R, dungeon: &Dungeon)
where
R: RaylibDraw + RaylibMode2DExt,
{
@@ -280,7 +280,7 @@ impl Renderer {
{
// Textures are up to date
return;
- };
+ }
self.tiles_hash = Some(current_hash);
self.update_fg_tilemap(r, t, floor);
@@ -302,7 +302,7 @@ impl Renderer {
// fg layer only draws a top walls
if floor.get(pos) != Tile::Wall {
continue;
- };
+ }
// draw base wall top texture
rt.draw_atlas(
@@ -476,7 +476,7 @@ impl Renderer {
}
/// Draws player HP, inventory, and floor number
- fn draw_ui<R>(&mut self, r: &mut R, dungeon: &Dungeon)
+ fn draw_ui<R>(&self, r: &mut R, dungeon: &Dungeon)
where
R: RaylibDraw,
{
@@ -586,7 +586,7 @@ impl Renderer {
);
if let Some(item) = player.inventory.get(idx as usize) {
- let tex = self.textures.item_texture(item);
+ let tex = self.textures.item_texture(*item);
const ITEM_PADDDING: u16 = UI_PADDING * 3;
let dest_rec = rect! {
slot_x + ITEM_PADDDING/2,
@@ -607,7 +607,7 @@ impl Renderer {
}
/// Draw player health & equpped weapon damage
- fn draw_stats<R>(&mut self, r: &mut R, player: &Player)
+ fn draw_stats<R>(&self, r: &mut R, player: &Player)
where
R: RaylibDraw,
{
@@ -645,7 +645,7 @@ impl Renderer {
}
/// Draws debug information ontop of other UI elements
- fn draw_debug_ui<R>(&mut self, r: &mut R, dungeon: &Dungeon)
+ fn draw_debug_ui<R>(&self, r: &mut R, dungeon: &Dungeon)
where
R: RaylibDraw,
{