[][src]Struct all_is_cubes::universe::FrameClock

pub struct FrameClock { /* fields omitted */ }

Algorithm for deciding how to execute simulation and rendering frames. Platform-independent; only returns decisions given provided information.

Implementations

impl FrameClock[src]

pub fn new() -> Self[src]

pub fn advance_to(&mut self, instant: Instant)[src]

Advance the clock using a source of absolute time.

This cannot be meaningfully used in combination with request_frame().

#[must_use]pub fn request_frame(&mut self, time_since_last_frame: Duration) -> bool[src]

Reacts to a callback from the environment requesting drawing a frame ASAP if we're going to (i.e. requestAnimationFrame on the web). Drives the simulation clock based on this input (it will not advance if no requests are made).

Returns whether a frame should actually be rendered now. The caller should also consult should_step() afterward to schedule game state steps.

This cannot be meaningfully used in combination with advance_to().

pub fn should_draw(&self) -> bool[src]

pub fn did_draw(&mut self)[src]

pub fn should_step(&self) -> bool[src]

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

pub fn did_step(&mut self)[src]

Trait Implementations

impl Default for FrameClock[src]

Auto Trait Implementations

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> Erased for T[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,