BACK at "play again" should broadcast quit.

This commit is contained in:
Derek Jamison 2023-07-11 16:52:35 -05:00
parent a9915dc092
commit b84221eb3c

View File

@ -1910,7 +1910,9 @@ int32_t rock_paper_scissors_app(void* p) {
if((event.input.type == InputTypeLong) && (event.input.key == InputKeyBack)) {
// Long press back to exit.
processing = false;
} else if((event.input.type == InputTypeShort) && (event.input.key == InputKeyBack)) {
} else if(
(event.input.type == InputTypeShort) && (event.input.key == InputKeyBack) &&
game_context->data->screen_state != ScreenFinishedGame) {
if(game_context->data->local_player == StateHostingLookingForPlayer) {
rps_broadcast_not_beacon(game_context);
}
@ -2316,6 +2318,13 @@ int32_t rock_paper_scissors_app(void* p) {
case InputKeyRight:
game_context->data->keyboard_col = 1; // NO - Back to main menu
break;
case InputKeyBack:
game_context->data->keyboard_col = 1; // NO - Back to main menu
rps_broadcast_quit(game_context);
game_context->data->local_player = StateMainMenuHost;
game_context->data->remote_player = StateUnknown;
game_context->data->screen_state = ScreenMainMenu;
break;
case InputKeyOk:
if(game_context->data->keyboard_col == 1) {
rps_broadcast_quit(game_context);