Skip to main content

ProofGame

Trait ProofGame 

Source
pub trait ProofGame {
    // Required methods
    fn title(&self) -> &str;
    fn update(&mut self, engine: &mut ProofEngine, dt: f32);

    // Provided methods
    fn on_start(&mut self, _engine: &mut ProofEngine) { ... }
    fn on_resize(
        &mut self,
        _engine: &mut ProofEngine,
        _width: u32,
        _height: u32,
    ) { ... }
    fn on_stop(&mut self, _engine: &mut ProofEngine) { ... }
    fn config(&self) -> EngineConfig { ... }
}
Expand description

The integration contract between a game and the Proof Engine.

Implement this trait on your game state struct. Pass it to ProofEngine::run_game() to start the game loop.

Required Methods§

Source

fn title(&self) -> &str

The window title shown for this game.

Source

fn update(&mut self, engine: &mut ProofEngine, dt: f32)

Called every frame. dt is the time in seconds since the last frame. Apply game logic, spawn entities, react to input here.

Provided Methods§

Source

fn on_start(&mut self, _engine: &mut ProofEngine)

Called once before the game loop starts. Use this to spawn initial entities, set up the scene, and configure the camera.

Source

fn on_resize(&mut self, _engine: &mut ProofEngine, _width: u32, _height: u32)

Called when the window is resized. Override to reposition UI elements.

Source

fn on_stop(&mut self, _engine: &mut ProofEngine)

Called once when the game loop exits cleanly (window closed or engine.request_quit() called). Use for save/cleanup.

Source

fn config(&self) -> EngineConfig

Engine configuration. Override to customize window size, title, etc. Called before on_start().

Implementors§