pub trait Application<Canvas = WindowCanvas> {
// Provided methods
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>> { ... }
}Expand description
An application using this framework.
Provided Methods§
Sourcefn on_create(
&mut self,
_canvas: &mut Canvas,
_input: &InputState,
) -> ApplicationResult
fn on_create( &mut self, _canvas: &mut Canvas, _input: &InputState, ) -> ApplicationResult
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.
Sourcefn on_update(
&mut self,
_canvas: &mut Canvas,
_input: &InputState,
_elapsed_time: f64,
) -> ApplicationResult
fn on_update( &mut self, _canvas: &mut Canvas, _input: &InputState, _elapsed_time: f64, ) -> ApplicationResult
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.