MCPcopy Create free account
hub / github.com/17cupsofcoffee/nova / EventHandler

Interface EventHandler

src/app.rs:12–20  ·  view source on GitHub ↗

The generic event handler for the game. You should implement this yourself ## Call order: 1. `event`: 0 to n times based on what events are received 2. `update`: 0 to n times based on the tick rate 3. `draw`: 1 time per frame

Source from the content-addressed store, hash-verified

10/// 2. `update`: 0 to n times based on the tick rate
11/// 3. `draw`: 1 time per frame
12pub trait EventHandler {
13 /// Handle a raw event for the game. This is useful for one-off events, like key down events.
14 /// For continuous events, like moving a character when you hold a key, use the update method.
15 ///
16 /// note: this will be called after the `app.input` has been updated with the event.
17 fn event(&mut self, _app: &mut App, _event: Event) {}
18 fn update(&mut self, _app: &mut App) {}
19 fn draw(&mut self, _app: &mut App) {}
20}
21
22pub struct App {
23 pub window: Window,

Callers 3

handle_eventsMethod · 0.45
runMethod · 0.45
runMethod · 0.45

Implementers 1

bunnymark.rsexamples/bunnymark.rs

Calls

no outgoing calls

Tested by

no test coverage detected