Module pix_engine::engine
source · [−]Expand description
PixEngine functions.
This is the core module of the pix-engine crate and is responsible for building and running
any application using it.
Builder allows you to customize various engine features and, once built, can
run your application which must implement AppState::on_update.
Example
use pix_engine::prelude::*;
struct MyApp;
impl AppState for MyApp {
fn on_update(&mut self, s: &mut PixState) -> PixResult<()> {
// Update every frame
Ok(())
}
}
fn main() -> PixResult<()> {
let mut engine = PixEngine::builder()
.with_dimensions(800, 600)
.with_title("MyApp")
.build()?;
let mut app = MyApp;
engine.run(&mut app)
}