diff --git a/Cargo.toml b/Cargo.toml index 0d0c995..b26e3d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ggez = "0.7" \ No newline at end of file +ggez = "0.7" + +[profile.dev.package."*"] +opt-level = 3 diff --git a/src/main.rs b/src/main.rs index e7a11a9..0f4dc30 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,45 @@ +use ggez::{Context, ContextBuilder, GameResult}; +use ggez::graphics::{self, Color}; +use ggez::event::{self, EventHandler}; + fn main() { - println!("Hello, world!"); + // Make a Context. + let (mut ctx, event_loop) = ContextBuilder::new("apruebo", "s1m7u and e-dt") + .build() + .expect("aieee, could not create ggez context!"); + + // Create an instance of your event handler. + // Usually, you should provide it with the Context object to + // use when setting your game up. + let apr = Apr::new(&mut ctx); + + // Run! + event::run(ctx, event_loop, apr); +} + +struct Apr { + // Your state here... +} + +impl Apr { + pub fn new(_ctx: &mut Context) -> Apr { + // Load/create resources such as images here. + Apr { + // ... + } + } +} + +impl EventHandler for Apr { + fn update(&mut self, _ctx: &mut Context) -> GameResult<()> { + Err(ggez::GameError::CustomError("You done messed up trying to play this game!".to_string())) + // Update code here... + // Ok(()) + } + + fn draw(&mut self, ctx: &mut Context) -> GameResult<()> { + graphics::clear(ctx, Color::WHITE); + // Draw code here... + graphics::present(ctx) + } }