diff --git a/src/timer.rs b/src/timer.rs index 064544f..44d086f 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -243,6 +243,33 @@ impl Timer{ }; Ok(()) } + pub fn is_paused(&self)->bool{ + match self{ + Self::Paused(_)=>true, + Self::Unpaused(_)=>false, + } + } + pub fn set_paused(&mut self,time:Time,paused:bool)->Result<(),Error>{ + match paused{ + true=>self.pause(time), + false=>self.unpause(time), + } + } +} +//scaled timer methods are generic across PauseState +impl Timer{ + pub const fn get_scale(&self)->Ratio64{ + match self{ + Self::Paused(timer)=>timer.get_scale(), + Self::Unpaused(timer)=>timer.get_scale(), + } + } + pub fn set_scale(&mut self,time:Time,new_scale:Ratio64){ + match self{ + Self::Paused(timer)=>timer.set_scale(time,new_scale), + Self::Unpaused(timer)=>timer.set_scale(time,new_scale), + } + } } #[cfg(test)]