Trait simple_game_engine::Application[][src]

pub trait Application<Canvas = WindowCanvas> {
    fn on_create(
        &mut self,
        _canvas: &mut Canvas,
        _input: &InputState
    ) -> ApplicationResult { ... }
fn on_update(
        &mut self,
        _canvas: &mut Canvas,
        _input: &InputState,
        _elapsed_time: f64
    ) -> ApplicationResult { ... }
fn on_quit(&mut self) -> Result<(), Box<dyn Error>> { ... } }

An application using this framework.

Provided methods

fn on_create(
    &mut self,
    _canvas: &mut Canvas,
    _input: &InputState
) -> ApplicationResult
[src]

Called once at the start of the program.

Parameters

  • canvas: A draw target representing the visible window.
  • input: a struct containing info about the state of input devices, such as the keyboard and mouse.

fn on_update(
    &mut self,
    _canvas: &mut Canvas,
    _input: &InputState,
    _elapsed_time: f64
) -> ApplicationResult
[src]

Called once per frame.

Parameters

  • canvas: A draw target representing the visible window.
  • input: a struct containing info about the state of input devices, such as the keyboard and mouse.
  • elapsed_time: Duration (in seconds) since the last frame. This can be used to keep time-sensative routines, such as animation, running at a constant speed.

fn on_quit(&mut self) -> Result<(), Box<dyn Error>>[src]

Called when the window’s close button is clicked. Be aware that this isn’t called on std::process::exit, so do any essential cleanup in a Drop implementation instead. Does nothing by default.

Loading content...

Implementors

Loading content...