Trait gate::App

source ·
pub trait App<A: AppAssetId> {
    fn advance(&mut self, seconds: f64, ctx: &mut AppContext<A>);
    fn key_down(&mut self, key: KeyCode, ctx: &mut AppContext<A>);
    fn render(&mut self, renderer: &mut Renderer<A>, ctx: &AppContext<A>);

    fn start(&mut self, _ctx: &mut AppContext<A>) { ... }
    fn key_up(&mut self, _key: KeyCode, _ctx: &mut AppContext<A>) { ... }
}
Expand description

Trait that a user can implement to specify application behavior, passed into gate::run(...).

Required Methods

Advances the app state by a given amount of seconds (usually a fraction of a second).

Invoked when a key or mouse button is pressed down.

Render the app in its current state.

Provided Methods

Invoked when the application is first started, default behavior is a no-op.

Invoked when a key or mouse button is released, default behavior is a no-op.

Implementors