aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-21 22:47:49 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-21 22:47:49 +0100
commitba2a2dbe3434a1ffc10542ca38e6116c0bde7b65 (patch)
treec97712775a6111b5ffc81bf222a6c03a14f6fc61
parent03d0053c9531c3f545025654d14541f8a89ce2f7 (diff)
downloadgold-mine-run-ba2a2dbe3434a1ffc10542ca38e6116c0bde7b65.tar.gz
gold-mine-run-ba2a2dbe3434a1ffc10542ca38e6116c0bde7b65.zip
Add hiscore to the menu screen
-rw-r--r--src/game.c5
-rw-r--r--src/game.h1
-rw-r--r--src/menu.c7
3 files changed, 12 insertions, 1 deletions
diff --git a/src/game.c b/src/game.c
index ae7b01e..9878871 100644
--- a/src/game.c
+++ b/src/game.c
@@ -118,3 +118,8 @@ void add_score(uint8_t v)
score += v;
hud |= HUD_SCORE;
}
+
+uint32_t get_hiscore()
+{
+ return hiscore;
+}
diff --git a/src/game.h b/src/game.h
index b47004c..9a6c0d7 100644
--- a/src/game.h
+++ b/src/game.h
@@ -14,5 +14,6 @@
void run_game();
void add_score(uint8_t v);
+uint32_t get_hiscore();
#endif /* _GAME_H */
diff --git a/src/menu.c b/src/menu.c
index a74568e..24c24c7 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,15 +1,20 @@
#include <stdint.h>
+#include <stdio.h>
#include "keyb.h"
#include "vga.h"
#include "text.h"
#include "data.h"
+#include "game.h"
uint8_t run_menu()
{
+ char b[10];
+
blit_erase(0);
- put_text(124, 10, "HI 000000", 5);
+ sprintf(b, "HI %06li", get_hiscore());
+ put_text(124, 10, b, 5);
Rect dst = { 80, 45, 160, 38 };
blit(binary_title_start, &dst);