]> git.seodisparate.com - LudumDare47_StuckInALoop/commitdiff
More skeleton code
authorStephen Seo <seo.disparate@gmail.com>
Sat, 3 Oct 2020 02:04:11 +0000 (11:04 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Sat, 3 Oct 2020 02:04:11 +0000 (11:04 +0900)
src/game.rs [new file with mode: 0644]
src/main.rs

diff --git a/src/game.rs b/src/game.rs
new file mode 100644 (file)
index 0000000..55266d4
--- /dev/null
@@ -0,0 +1,24 @@
+use ggez::{Context, GameResult};
+use ggez::event::EventHandler;
+use ggez::graphics;
+
+pub struct Game {
+}
+
+impl Game {
+    pub fn new(_ctx: &mut Context) -> Game {
+        Game { }
+    }
+}
+
+impl EventHandler for Game {
+    fn update(&mut self, _ctx: &mut Context) -> GameResult<()> {
+        Ok(())
+    }
+
+    fn draw(&mut self, ctx: &mut Context) -> GameResult<()> {
+        graphics::clear(ctx, graphics::WHITE);
+
+        graphics::present(ctx)
+    }
+}
index e7a11a969c037e00a796aafeff6258501ec15e9a..ca3c2ef892bc303b4b1ec73364ec57bad55bd0f9 100644 (file)
@@ -1,3 +1,18 @@
+mod game;
+
+use ggez::ContextBuilder;
+use ggez::event;
+
 fn main() {
-    println!("Hello, world!");
+    let (mut ctx, mut event_loop) =
+        ContextBuilder::new("ld47_stuckinaloop", "Stephen Seo")
+            .build()
+            .unwrap();
+
+    let mut game = game::Game::new(&mut ctx);
+
+    match event::run(&mut ctx, &mut event_loop, &mut game) {
+        Ok(_) => println!("Exited cleanly"),
+        Err(e) => println!("ERROR: {}", e)
+    }
 }