diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-10-23 13:08:40 -0400 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-10-23 13:10:19 -0400 |
| commit | 0c3e9c8dc49ff11d7612bd7e0bc25030ae566ab1 (patch) | |
| tree | e286028ebb74c5ffd08433dd8ff25d6149b68afc /dungeon/src/lib.rs | |
| parent | Started implementing wfc crate into map (diff) | |
| download | DungeonCrawl-0c3e9c8dc49ff11d7612bd7e0bc25030ae566ab1.tar.gz DungeonCrawl-0c3e9c8dc49ff11d7612bd7e0bc25030ae566ab1.tar.bz2 DungeonCrawl-0c3e9c8dc49ff11d7612bd7e0bc25030ae566ab1.zip | |
dungeon: add FPos for decimial positions
Diffstat (limited to 'dungeon/src/lib.rs')
| -rw-r--r-- | dungeon/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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 { |