[][src]Trait nuuro::App

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>) { ... } }

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

Required methods

fn advance(&mut self, seconds: f64, ctx: &mut AppContext<A>)

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

fn key_down(&mut self, key: KeyCode, ctx: &mut AppContext<A>)

Invoked when a key or mouse button is pressed down.

fn render(&mut self, renderer: &mut Renderer<A>, ctx: &AppContext<A>)

Render the app in its current state.

Loading content...

Provided methods

fn start(&mut self, _ctx: &mut AppContext<A>)

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

fn key_up(&mut self, _key: KeyCode, _ctx: &mut AppContext<A>)

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

Loading content...

Implementors

Loading content...