mod engine;
pub use engine::Engine;
pub mod input;
use std::error::Error;
pub use sdl2::{
pixels::Color,
rect::{Point, Rect},
render::WindowCanvas,
};
pub type ApplicationResult = Result<bool, Box<dyn Error>>;
pub trait Application {
fn on_create(
&mut self,
_canvas: &mut WindowCanvas,
_input: &input::InputState,
) -> ApplicationResult {
Ok(true)
}
fn on_update(
&mut self,
_canvas: &mut WindowCanvas,
_input: &input::InputState,
_elapsed_time: f64,
) -> ApplicationResult {
Ok(true)
}
fn on_quit(&mut self) -> Result<(), Box<dyn Error>> {
Ok(())
}
}
pub mod prelude {
pub use crate::{
input::{InputState, MouseButton, Scancode},
Color, Point, Rect, WindowCanvas,
};
}