[−][src]Struct game_time::runner::FrameRunner
A helper type for running frame simulations with a frame counter.
FrameRunner combines a GameClock
and a FrameCount object,
tracking each frame as well as a framerate. FrameRunner provides
a tick method like GameClock, and updates both the GameClock and
FrameCount objects contained.
Methods
impl<C> FrameRunner<C> where
C: FrameCount, [src]
impl<C> FrameRunner<C> where
C: FrameCount, pub fn new(clock: GameClock, counter: C) -> FrameRunner<C>[src]
pub fn new(clock: GameClock, counter: C) -> FrameRunner<C>Construct a new FrameRunner from a GameClock and a FrameCount.
pub fn clock(&self) -> &GameClock[src]
pub fn clock(&self) -> &GameClockGet a reference to the contained GameClock.
pub fn clock_mut(&mut self) -> &mut GameClock[src]
pub fn clock_mut(&mut self) -> &mut GameClockGet a mutable reference to the contained GameClock.
pub fn counter(&self) -> &C[src]
pub fn counter(&self) -> &CGet a reference to the contained FrameCount.
pub fn counter_mut(&mut self) -> &mut C[src]
pub fn counter_mut(&mut self) -> &mut CGet a mutable reference to the contained FrameCount.
pub fn tick<T: TimeStep>(&mut self, time_step: &T) -> GameTime[src]
pub fn tick<T: TimeStep>(&mut self, time_step: &T) -> GameTimeMark the start of a new frame, updating time and frame rate statistics.
The GameTime for the new frame is returned, with the same properties as that
returned from GameClock::tick.
pub fn tick_with_wall_time<T: TimeStep>(
&mut self,
time_step: &T,
frame_start: DateTime<Local>
) -> GameTime[src]
pub fn tick_with_wall_time<T: TimeStep>(
&mut self,
time_step: &T,
frame_start: DateTime<Local>
) -> GameTimeMark the start of a new frame with a specified wall time, updating time statistics.
This function is like tick but allows for the start time for the
frame to be specified.
pub fn do_frame<T, F>(&mut self, time_step: &T, frame_fn: F) where
T: TimeStep,
F: FnOnce(GameTime), [src]
pub fn do_frame<T, F>(&mut self, time_step: &T, frame_fn: F) where
T: TimeStep,
F: FnOnce(GameTime), Perform one frame of the simulation using frame_fn.
The closure is passed the GameTime for the frame by calling tick
and will call
GameClock::sleep_remaining
after the closure has ended.
Trait Implementations
impl<C: Debug + FrameCount> Debug for FrameRunner<C>[src]
impl<C: Debug + FrameCount> Debug for FrameRunner<C>Auto Trait Implementations
impl<C> Send for FrameRunner<C> where
C: Send,
impl<C> Send for FrameRunner<C> where
C: Send, impl<C> Sync for FrameRunner<C> where
C: Sync,
impl<C> Sync for FrameRunner<C> where
C: Sync, Blanket Implementations
impl<T, U> Into for T where
U: From<T>, [src]
impl<T, U> Into for T where
U: From<T>, impl<T> From for T[src]
impl<T> From for Timpl<T, U> TryFrom for T where
T: From<U>, [src]
impl<T, U> TryFrom for T where
T: From<U>, type Error = !
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>impl<T> Borrow for T where
T: ?Sized, [src]
impl<T> Borrow for T where
T: ?Sized, impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Any for T where
T: 'static + ?Sized, fn get_type_id(&self) -> TypeId[src]
fn get_type_id(&self) -> TypeIdimpl<T, U> TryInto for T where
U: TryFrom<T>, [src]
impl<T, U> TryInto for T where
U: TryFrom<T>, type Error = <U as TryFrom<T>>::Error
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>impl<T> BorrowMut for T where
T: ?Sized, [src]
impl<T> BorrowMut for T where
T: ?Sized, fn borrow_mut(&mut self) -> &mut T[src]
fn borrow_mut(&mut self) -> &mut Timpl<T, U> IntoDuration for T where
U: FromDuration<T>, [src]
impl<T, U> IntoDuration for T where
U: FromDuration<T>, type Error = <U as FromDuration<T>>::Error
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>[src]
fn into_duration(self) -> Result<U, <U as FromDuration<T>>::Error>