use ds2d::{graphics::Color, GameResult}; use log::error; pub struct HelloGame; impl ds2d::Game for HelloGame { fn draw(&mut self, ctx: &mut ds2d::Context) -> GameResult<()> { ds2d::graphics::clear(ctx, Color::CORNFLOWER_BLUE); Ok(()) } fn update(&mut self, _ctx: &mut ds2d::Context) -> GameResult<()> { Ok(()) } fn exit(&mut self, _ctx: &mut ds2d::Context) -> GameResult<()> { Ok(()) } } fn main() { stderrlog::new().quiet(false).verbosity(5).init().unwrap(); let (event_loop, context) = match ds2d::ContextBuilder::new() .debug(true) .title("Hello World!") .build() { Ok(ok) => ok, Err(err) => { error!("Could not create context: {:?}", err); std::process::exit(1); } }; let game = HelloGame; ds2d::run(event_loop, context, game) }