Trait gate::App
[−]
[src]
pub trait App<A: AppAssetId> { fn advance(&mut self, seconds: f64, audio: &mut Audio<A>) -> bool; fn input(
&mut self,
event: KeyEvent,
key: KeyCode,
audio: &mut Audio<A>
) -> bool; fn render(&mut self, renderer: &mut Renderer<A>); fn start(&mut self, _audio: &mut Audio<A>) { ... } }
Trait that a user can implement to specify application behavior, passed into gate::run(...)
.
Required Methods
fn advance(&mut self, seconds: f64, audio: &mut Audio<A>) -> bool
Advances the app state by a given amount of seconds
(usually a fraction of a second).
fn input(&mut self, event: KeyEvent, key: KeyCode, audio: &mut Audio<A>) -> bool
Invoked when user input is received (currently only keyboard presses/releases).
fn render(&mut self, renderer: &mut Renderer<A>)
Render the app in its current state.
Provided Methods
fn start(&mut self, _audio: &mut Audio<A>)
Invoked when the application is first started, default behavior is a no-op.