summaryrefslogtreecommitdiff
path: root/dungeon/src
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-08 14:28:29 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-08 14:28:29 -0500
commita4e46e4e564882b40605517ae8053e027befbea3 (patch)
tree0cb7c4319beec2ece95af11673bc0e5e8e0fa0ac /dungeon/src
parentassets: extend font (diff)
downloadDungeonCrawl-a4e46e4e564882b40605517ae8053e027befbea3.tar.gz
DungeonCrawl-a4e46e4e564882b40605517ae8053e027befbea3.tar.bz2
DungeonCrawl-a4e46e4e564882b40605517ae8053e027befbea3.zip
graphics: refactor debug ui
Diffstat (limited to 'dungeon/src')
-rw-r--r--dungeon/src/pos.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/dungeon/src/pos.rs b/dungeon/src/pos.rs
index a7b6080..d31ba95 100644
--- a/dungeon/src/pos.rs
+++ b/dungeon/src/pos.rs
@@ -10,7 +10,10 @@ use rand::{
distr::{Distribution, StandardUniform},
};
-use std::ops::{AddAssign, SubAssign};
+use std::{
+ fmt::Display,
+ ops::{AddAssign, SubAssign},
+};
use crate::{MAP_SIZE_USIZE, map::MAP_SIZE};
@@ -54,6 +57,16 @@ impl Direction {
rand::random()
}
}
+impl Display for Direction {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Self::North => write!(f, "NORTH"),
+ Self::South => write!(f, "SOUTH"),
+ Self::East => write!(f, "EAST"),
+ Self::West => write!(f, "WEST"),
+ }
+ }
+}
impl Distribution<Direction> for StandardUniform {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Direction {