Neue Level.
[hackover2013-badge-firmware.git] / badge / jumpnrun / stats.c
index cbcb24b..25cd04d 100644 (file)
@@ -13,8 +13,8 @@ void jumpnrun_show_lives_screen(jumpnrun_game_state const *state) {
 
   int8_t y_upper = BADGE_DISPLAY_HEIGHT / 2 - BADGE_FONT_HEIGHT;
   int8_t y_lower = (BADGE_DISPLAY_HEIGHT + BADGE_FONT_HEIGHT) / 2;
-  int8_t x_left  = BADGE_DISPLAY_WIDTH / 2 - fixed_point_cast_int(jumpnrun_player_extents().y) - BADGE_FONT_WIDTH - 5;
-  int8_t x_mid   = (BADGE_DISPLAY_WIDTH - BADGE_FONT_WIDTH) / 2;
+  int8_t x_mid   = (BADGE_DISPLAY_WIDTH  - BADGE_FONT_WIDTH ) / 2;
+  int8_t x_left  = x_mid - BADGE_FONT_WIDTH - 5;
   int8_t x_right = x_mid + BADGE_FONT_WIDTH + 5;
 
   char buf[] = "x";
@@ -47,3 +47,31 @@ void jumpnrun_show_lives_screen(jumpnrun_game_state const *state) {
     }
   }
 }
+
+static void jumpnrun_show_message(char const *msg) {
+  badge_framebuffer fb = { { { 0 } } };
+
+  size_t len = strlen(msg);
+  size_t wid = len * BADGE_FONT_WIDTH;
+  size_t off = (BADGE_DISPLAY_WIDTH - wid + 1) / 2;
+
+  badge_framebuffer_render_text(&fb, off, BADGE_DISPLAY_HEIGHT / 2 - BADGE_FONT_WIDTH, msg);
+  badge_framebuffer_flush(&fb);
+
+  for(uint8_t i = 0; i < 75; ) {
+    badge_event_t ev = badge_event_wait();
+    if(badge_event_type(ev) == BADGE_EVENT_GAME_TICK) {
+      ++i;
+    }
+  }
+}
+
+void jumpnrun_show_game_over(void) {
+  char msg[] = "GAME OVER";
+  jumpnrun_show_message(msg);
+}
+
+void jumpnrun_show_you_rock (void) {
+  char msg[] = "YOU ROCK!!1!";
+  jumpnrun_show_message(msg);
+}
This page took 0.02772 seconds and 4 git commands to generate.