From 0c3e9c8dc49ff11d7612bd7e0bc25030ae566ab1 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Thu, 23 Oct 2025 13:08:40 -0400 Subject: dungeon: add FPos for decimial positions --- dungeon/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'dungeon/src/lib.rs') diff --git a/dungeon/src/lib.rs b/dungeon/src/lib.rs index 75400e9..0e1a501 100644 --- a/dungeon/src/lib.rs +++ b/dungeon/src/lib.rs @@ -12,7 +12,7 @@ pub use pos::*; /// The `Dungeon` type represents the game state of the /// dungeon crawler. -#[derive(Clone, Debug, PartialEq, Eq, Hash)] +#[derive(Clone, Debug, PartialEq)] pub struct Dungeon { pub floor: Floor, pub player: Player, @@ -46,6 +46,12 @@ impl Dungeon { pub fn new_seeded(seed: u64) -> Self { Self::from(Floor::generate_seeded(seed)) } + + /// Returns the current position of the camera (viewer) + #[must_use] + pub fn camera(&self) -> FPos { + self.player.entity.fpos + } } impl Default for Dungeon { fn default() -> Self { -- cgit v1.2.3-freya