Module pix_engine::engine[][src]

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)
}

Structs

Builds a PixEngine instance by providing several configration functions.

The core engine that maintains the render loop, state, drawing functions, event handling, etc.