From a4e46e4e564882b40605517ae8053e027befbea3 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 8 Nov 2025 14:28:29 -0500 Subject: graphics: refactor debug ui --- dungeon/src/pos.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'dungeon/src') 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 for StandardUniform { fn sample(&self, rng: &mut R) -> Direction { -- cgit v1.2.3-freya