pub trait Application: Sized + 'static {
// Required method
fn new(context: EngineContext<'_>) -> Self;
// Provided methods
fn setup(&mut self, _world: &mut GameWorld) { ... }
fn update(&mut self, _world: &mut GameWorld, _inputs: &[InputEvent]) { ... }
fn render(&mut self) -> Vec<RenderObject> { ... }
}Expand description
Application trait for user-defined game logic.
The engine manages the internal state. Users interact through
&mut GameWorld - no direct access to internal engine types.
Required Methods§
Sourcefn new(context: EngineContext<'_>) -> Self
fn new(context: EngineContext<'_>) -> Self
Called once at initialization with the graphics context.
Provided Methods§
Sourcefn update(&mut self, _world: &mut GameWorld, _inputs: &[InputEvent])
fn update(&mut self, _world: &mut GameWorld, _inputs: &[InputEvent])
Called every frame for game logic.
Sourcefn render(&mut self) -> Vec<RenderObject>
fn render(&mut self) -> Vec<RenderObject>
Called every frame to produce render objects.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.