11
11
#include "../lib/data/game/player.h"
12
12
#include "../lib/data/game/item.h"
13
13
#include "../lib/data/data_menu_background.h"
14
+ #include "../lib/data/help_dialog.h"
14
15
15
16
// ===== BACK-END =====
16
17
const char directionKey [] = {'w' , 'a' , 's' , 'd' };
17
18
const int yOffset [] = {-1 , 0 , 1 , 0 };
18
19
const int xOffset [] = {0 , -1 , 0 , 1 };
19
20
uint16_t currentRadius = 40 ;
20
21
21
-
22
+ void render_scene (const Maze * maze , const Asset * asset , const bool isFOVShown );
23
+ void debug_pos (Position pos );
24
+ void update_pos (Position * des , Direction dir );
25
+ void handle_collision (Item * item , Maze * maze , Player * player );
26
+ int cmp_pos (Position pos1 , Position pos2 );
27
+ void debug_item (Item item );
22
28
23
29
void game_enter () {
24
30
// init
@@ -58,7 +64,7 @@ void game_enter() {
58
64
59
65
// menu
60
66
int menuPosX = 220 , menuPosY = 250 , yOffset = 50 ;
61
- char * opts [] = {"Start" , "Continue " , "How To Play?" , "Exit" };
67
+ char * opts [] = {"Start" , "Choose Level " , "How To Play?" , "Exit" };
62
68
int optSz = sizeof (opts ) / sizeof (opts [0 ]);
63
69
drawMenu (menuPosX , menuPosY , yOffset , opts , optSz );
64
70
@@ -78,7 +84,9 @@ void game_enter() {
78
84
break ;
79
85
80
86
case 2 : //help
87
+ removeMenu (menuPosX , menuPosY , yOffset , opts , optSz );
81
88
game_help ();
89
+ drawMenu (menuPosX , menuPosY , yOffset , opts , optSz );
82
90
break ;
83
91
84
92
case 3 : //exit
@@ -228,6 +236,25 @@ void game_continue() {
228
236
229
237
void game_help () {
230
238
uart_puts ("Game Instruction...\n" );
239
+
240
+ Asset dialog = {
241
+ GAME_W / 2 - HELP_DIALOG_WIDTH / 2 ,
242
+ GAME_H / 2 - HELP_DIALOG_HEIGHT / 2 ,
243
+ HELP_DIALOG_WIDTH ,
244
+ HELP_DIALOG_HEIGHT ,
245
+ bitmap_help_dialog
246
+ };
247
+
248
+ drawAsset (& dialog );
249
+
250
+ char c = 0 ;
251
+ while ((c = uart_getc ()) != '\n' ) {}
252
+
253
+ for (int i = GAME_W / 2 - HELP_DIALOG_WIDTH / 2 , posX = 0 ; posX < HELP_DIALOG_WIDTH ; i ++ , posX ++ ) {
254
+ for (int j = GAME_H / 2 - HELP_DIALOG_HEIGHT / 2 , posY = 0 ; posY < HELP_DIALOG_HEIGHT ; j ++ , posY ++ ) {
255
+ framebf_drawPixel (i , j , bitmap_menu_background [i + j * MENU_BACKGROUND_SIZE ]);
256
+ }
257
+ }
231
258
}
232
259
233
260
0 commit comments