Trait let_engine::Game
source · pub trait Game {
// Required method
fn exit(&self) -> bool;
// Provided methods
fn start(&mut self) { ... }
fn update(&mut self) { ... }
fn frame_update(&mut self) { ... }
fn tick(&mut self) { ... }
fn event(&mut self, event: Event) { ... }
}
Expand description
Represents the game application with essential methods for a game’s lifetime.
§Usage
use let_engine::prelude::*;
struct Game {
exit: bool,
}
impl let_engine::Game for Game {
fn exit(&self) -> bool {
// exits the program in case self.exit is true
self.exit
}
fn update(&mut self) {
// runs every frame or every engine loop update.
//...
}
}
Required Methods§
Provided Methods§
sourcefn start(&mut self)
fn start(&mut self)
Runs right before the first frame is drawn and the window gets displayed, initializing the instance.
sourcefn frame_update(&mut self)
fn frame_update(&mut self)
Runs after the frame is drawn.