[][src]Struct sprocket_engine::Time

pub struct Time { /* fields omitted */ }

Contains time information of a certain part of the program Tracks elapsed time, delta time, frame count

Implementations

impl Time[src]

pub fn new() -> Self[src]

Creates and initializes a new time struct Few time instances should be need for a program, usually one per thread

pub fn update(&mut self)[src]

Updates and advances the time to the next frame and caluclates deltatime This function will not panic even if current time is less than previous time If current time is less than previous time, deltatime will be 0 for that frame

pub fn delta_f32(&self) -> f32[src]

Returns the duration between the last frame and start of current frame in seconds

pub fn delta_raw(&self) -> Duration[src]

Returns the raw duration between the last frame and start of current frame

pub fn delta_ms(&self) -> usize[src]

Returns the duration between the last frame and start of current frame in whole milliseconds Can be used for precise timing and benchmarking A whole smaller time unit does not lose precision to rounding errors like floats

pub fn delta_us(&self) -> usize[src]

Returns the duration between the last frame and start of current frame in whole microseconds Can be used for precise timing and benchmarking A whole smaller time unit does not lose precision to rounding errors like floats

pub fn elapsed_f32(&self) -> f32[src]

Returns the elapsed time since creation of self and the start of the current frame in seconds

pub fn elapsed_raw(&self) -> Duration[src]

Returns the elapsed time since creation of self and the start of the current frame

pub fn framecount(&self) -> usize[src]

Returns the number of frames advanced with update Note, when running on different threads, if reflect the thread local frame, not graphical frame For graphical frame, use the time object of the renderer TODO

pub fn framerate(&self) -> f32[src]

Returns the framerate between this and the previous frame

Auto Trait Implementations

impl RefUnwindSafe for Time

impl Send for Time

impl Sync for Time

impl Unpin for Time

impl UnwindSafe for Time

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.