Skip to content

Commit

Permalink
Merge pull request #23 from ashleyhuxley/menu_rename
Browse files Browse the repository at this point in the history
Update references from menu to player_select
  • Loading branch information
ashleyhuxley authored Aug 25, 2024
2 parents 5ad8fd4 + 40b8c22 commit 1ab9062
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bomber.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ int32_t bomber_main(void* p)
return 1;
}

bomber_app_set_mode(state, BomberAppMode_Menu);
bomber_app_set_mode(state, BomberAppMode_PlayerSelect);

// TODO: This should be moved to after the menu
// TODO: This should be moved to after the Player Select menu
state->level = level1;
uint8_t wall_count = count_walls(state->level);
uint8_t powerup_bomb_count = (uint8_t)round((POWERUP_EXTRABOMB_RATIO * wall_count));
Expand Down
6 changes: 3 additions & 3 deletions bomber_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static bool handle_game_direction(BomberAppState* state, InputEvent input) {
// state: Pointer to the application state
// input: Represents the input event
// returns: true if the viewport should be updated, else false
static bool handle_menu_input(BomberAppState* state, InputEvent input) {
static bool handle_player_select_input(BomberAppState* state, InputEvent input) {
if(input.type == InputTypeShort) {
switch(input.key) {
case InputKeyUp:
Expand Down Expand Up @@ -189,8 +189,8 @@ static bool bomber_app_handle_input(BomberAppState* state, InputEvent input) {
switch(state->mode) {
case BomberAppMode_Playing:
return handle_game_input(state, input);
case BomberAppMode_Menu:
return handle_menu_input(state, input);
case BomberAppMode_PlayerSelect:
return handle_player_select_input(state, input);
default:
break;
}
Expand Down
8 changes: 4 additions & 4 deletions bomber_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ static void render_game(Canvas* canvas, BomberAppState* state) {
}
}

// Renders the menu to the viewport - called while in the menu
static void render_menu(Canvas* canvas, BomberAppState* state) {
// Renders the player select menu to the viewport - called while in the player select menu
static void render_player_select(Canvas* canvas, BomberAppState* state) {
uint8_t ax = state->isPlayerTwo ? 70 : 20;

canvas_set_font(canvas, FontSecondary);
Expand Down Expand Up @@ -108,8 +108,8 @@ void bomber_ui_render_callback(Canvas* canvas, void* context) {
case BomberAppMode_Playing:
render_game(canvas, state);
break;
case BomberAppMode_Menu:
render_menu(canvas, state);
case BomberAppMode_PlayerSelect:
render_player_select(canvas, state);
break;
case BomberAppMode_GameOver:
render_game_over(canvas, state);
Expand Down
2 changes: 1 addition & 1 deletion types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ typedef struct {
// Application mode. Rendering and input handlers rely on this to know what to render, or how to handle input.
typedef enum {
BomberAppMode_Uninitialised,
BomberAppMode_Menu,
BomberAppMode_PlayerSelect,
BomberAppMode_Ready,
BomberAppMode_Playing,
BomberAppMode_Finished,
Expand Down

0 comments on commit 1ab9062

Please sign in to comment.