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§
Sourcefn update(&mut self, engine: &mut ProofEngine, dt: f32)
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§
Sourcefn on_start(&mut self, _engine: &mut ProofEngine)
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.
Sourcefn on_resize(&mut self, _engine: &mut ProofEngine, _width: u32, _height: u32)
fn on_resize(&mut self, _engine: &mut ProofEngine, _width: u32, _height: u32)
Called when the window is resized. Override to reposition UI elements.
Sourcefn on_stop(&mut self, _engine: &mut ProofEngine)
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.
Sourcefn config(&self) -> EngineConfig
fn config(&self) -> EngineConfig
Engine configuration. Override to customize window size, title, etc.
Called before on_start().