Skip to content

Commit

Permalink
Added center buttom to confirmation screen to cancel settings selecti…
Browse files Browse the repository at this point in the history
…on and return to game
  • Loading branch information
squee72564 committed Jan 2, 2024
1 parent 07bd848 commit db1caef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scenes/confirmation_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ void minesweeper_scene_confirmation_screen_on_enter(void* context) {

dialog_ex_set_left_button_text(app->confirmation_screen, "Back");

dialog_ex_set_right_button_text(app->confirmation_screen, "Save and Reset");
dialog_ex_set_center_button_text(app->confirmation_screen, "Cancel");

dialog_ex_set_right_button_text(app->confirmation_screen, "Save");

dialog_ex_set_result_callback(app->confirmation_screen, confirmation_scene_dialog_callback);

Expand Down Expand Up @@ -55,6 +57,9 @@ bool minesweeper_scene_confirmation_screen_on_event(void* context, SceneManagerE
app->settings_info.board_width = app->t_settings_info.board_width;
app->settings_info.board_height = app->t_settings_info.board_height;
app->settings_info.difficulty = app->t_settings_info.difficulty;

// This is used to let the settings view know it can save the main settings_info
// to the temp one on the next on enter
app->is_settings_changed = false;

// Reset the game board
Expand All @@ -69,6 +74,13 @@ bool minesweeper_scene_confirmation_screen_on_event(void* context, SceneManagerE
break;

case DialogExResultCenter :
// Do not commit changes to actual buffer on cancel

app->is_settings_changed = false;

// we want to just switch back to the game screen without resetting
scene_manager_search_and_switch_to_another_scene(app->scene_manager, MineSweeperSceneGameScreen);

break;

default :
Expand Down

0 comments on commit db1caef

Please sign in to comment.