2 changed files with 47 additions and 2 deletions
@ -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) |
|||
} |
|||
} |
|||
|
Loading…
Reference in new issue