[][src]Struct amethyst_core::frame_limiter::FrameLimiter

pub struct FrameLimiter { /* fields omitted */ }

Frame limiter resource.

FrameLimiter is used internally by amethyst to limit the frame rate to the rate specified by the user. It is added as a resource to the world so that user code may change the frame rate limit at runtime if necessary.


impl FrameLimiter[src]

pub fn new(strategy: FrameRateLimitStrategy, fps: u32) -> Self[src]

Creates a new frame limiter.

pub fn set_rate(&mut self, strategy: FrameRateLimitStrategy, fps: u32)[src]

Sets the maximum fps and frame rate limiting strategy.

pub fn from_config(config: FrameRateLimitConfig) -> Self[src]

Creates a new frame limiter with the given config.

pub fn start(&mut self)[src]

Resets the frame start time to the current instant.

This resets the frame limiter's internal tracking of when the last frame started to the current instant. Be careful when calling start, as doing so will cause the current frame to be longer than normal if not called at the very beginning of the frame.

pub fn wait(&mut self)[src]

Blocks the current thread until the allotted frame time has passed.

wait is used internally by Application to limit the frame rate of the game to the configured rate. This should likely never be called directly by game logic.

Trait Implementations

impl Default for FrameLimiter[src]

impl Debug for FrameLimiter[src]

Auto Trait Implementations

impl Send for FrameLimiter

impl Sync for FrameLimiter

Blanket Implementations

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

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Resource for T where
    T: Any + Send + Sync

impl<T> TryDefault for T where
    T: Default

fn unwrap_default() -> Self

Calls try_default and panics on an error case.

impl<T> Any for T where
    T: Any

impl<T> Event for T where
    T: Send + Sync + 'static,