From 10f11bb551897abc5f6978b3a6ee1b373b9341d2 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 29 Jun 2023 22:10:43 +0100 Subject: Add "Ready?" text to the start of stage --- TODO.md | 1 - src/game.c | 24 ++++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 922ac2a..cbe486c 100644 --- a/TODO.md +++ b/TODO.md @@ -10,7 +10,6 @@ - sound - libmikmod - screens - - ready? - pause - intro, new game - input diff --git a/src/game.c b/src/game.c index 64a7b23..4441cf0 100644 --- a/src/game.c +++ b/src/game.c @@ -41,6 +41,13 @@ static uint8_t time; static uint8_t pickaxe; static uint8_t gameover; +static void wait_time(uint16_t frames) +{ + /* wait some time */ + for (uint16_t i = 0; i < frames; i++) + wait_vsync(); +} + static void hud_render() { char b[32]; @@ -109,8 +116,7 @@ static void run_gameover() blit_update(); /* wait some time */ - for (uint8_t i = 0; i < 255; i++) - wait_vsync(); + wait_time(255); } void run_game() @@ -126,8 +132,22 @@ void run_game() blit_erase(0); map_init(binary_stage_start); + + /* render the scene with the READY? text */ map_render(); + entities_draw(); + player_draw(); + hud_render(); + put_text(136, 100, "READY?", 1); + + wait_vsync(); + blit_update(); + + /* wait some time */ + wait_time(96); + /* erase the READY? text */ + map_render(); entities_draw(); player_draw(); -- cgit v1.2.3