Application

Trait Application 

Source
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§

Source

fn new(context: EngineContext<'_>) -> Self

Called once at initialization with the graphics context.

Provided Methods§

Source

fn setup(&mut self, _world: &mut GameWorld)

Called once after construction for scene setup.

Source

fn update(&mut self, _world: &mut GameWorld, _inputs: &[InputEvent])

Called every frame for game logic.

Source

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.

Implementors§