diff --git a/src/game_clock.rs b/src/game_clock.rs index c01c5b3..2f7f1c6 100644 --- a/src/game_clock.rs +++ b/src/game_clock.rs @@ -1,5 +1,7 @@ use super::*; use bevy::prelude::*; +use std::fmt; +use std::ops::Deref; #[derive(Resource, Default)] pub struct GameClock { @@ -25,3 +27,22 @@ impl GameClock { self.frame = frame; } } + +impl Deref for GameClock { + type Target = FrameNumber; + fn deref(&self) -> &Self::Target { + &self.frame + } +} + +impl fmt::Debug for GameClock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "[[f={}]]", self.frame) + } +} + +impl fmt::Display for GameClock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "[f={}]", self.frame) + } +}