[][src]Trait quicksilver::lifecycle::State

pub trait State: 'static {
    fn new() -> Result<Self>
    where
        Self: Sized
; fn update(&mut self, _window: &mut Window) -> Result<()> { ... }
fn event(&mut self, _event: &Event, _window: &mut Window) -> Result<()> { ... }
fn draw(&mut self, window: &mut Window) -> Result<()> { ... }
fn handle_error(error: Error) { ... } }

The structure responsible for managing the game loop state

Required methods

Create the state given the window and canvas

Loading content...

Provided methods

Tick the State forward one frame

Will happen at a fixed rate of 60 ticks per second under ideal conditions. Under non-ideal conditions, the game loop will do its best to still call the update at about 60 TPS.

By default it does nothing

Process an incoming event

By default it does nothing

Draw the state to the screen

Will happen as often as possible, only limited by vysnc and the configured draw rate.

By default it draws a black screen

Log and report an error in some way

There's no way to recover from the error at this stage, because error handling should take place at the error site. However, on the web especially, logging errors can be difficult, so this provides a way to log other than a panic.

Loading content...

Implementors

Loading content...