Struct GameLoop

Source
pub struct GameLoop<G, T: TimeTrait, W> {
    pub game: G,
    pub updates_per_second: u32,
    pub max_frame_time: f64,
    pub exit_next_iteration: bool,
    pub window: W,
    pub window_occluded: bool,
    /* private fields */
}

Fields§

§game: G§updates_per_second: u32§max_frame_time: f64§exit_next_iteration: bool§window: W§window_occluded: bool

Implementations§

Source§

impl<G, T: TimeTrait, W> GameLoop<G, T, W>

Source

pub fn new( game: G, updates_per_second: u32, max_frame_time: f64, window: W, ) -> Self

Source

pub fn next_frame<U, R>(&mut self, update: U, render: R) -> bool
where U: FnMut(&mut GameLoop<G, T, W>), R: FnMut(&mut GameLoop<G, T, W>),

Source

pub fn re_accumulate(&mut self)

Source

pub fn exit(&mut self)

Source

pub fn set_updates_per_second(&mut self, new_updates_per_second: u32)

Source

pub fn fixed_time_step(&self) -> f64

Source

pub fn number_of_updates(&self) -> u64

Source

pub fn number_of_renders(&self) -> u64

Source

pub fn last_frame_time(&self) -> f64

Source

pub fn running_time(&self) -> f64

Source

pub fn accumulated_time(&self) -> f64

Source

pub fn blending_factor(&self) -> f64

Source

pub fn previous_instant(&self) -> T

Source

pub fn current_instant(&self) -> T

Auto Trait Implementations§

§

impl<G, T, W> Freeze for GameLoop<G, T, W>
where G: Freeze, W: Freeze, T: Freeze,

§

impl<G, T, W> RefUnwindSafe for GameLoop<G, T, W>

§

impl<G, T, W> Send for GameLoop<G, T, W>
where G: Send, W: Send, T: Send,

§

impl<G, T, W> Sync for GameLoop<G, T, W>
where G: Sync, W: Sync, T: Sync,

§

impl<G, T, W> Unpin for GameLoop<G, T, W>
where G: Unpin, W: Unpin, T: Unpin,

§

impl<G, T, W> UnwindSafe for GameLoop<G, T, W>
where G: UnwindSafe, W: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.