Skip to content

Commit

Permalink
consistent tetris
Browse files Browse the repository at this point in the history
  • Loading branch information
Alx-Lai authored and john0312 committed Aug 18, 2024
1 parent c36b039 commit 773645f
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions fw/Core/Hitcon/App/TetrisApp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,25 @@ void TetrisApp::OnXboardRecv(void *arg) {
void TetrisApp::OnButton(button_t button) {
switch (game.game_get_state()) {
case hitcon::tetris::GAME_STATE_WAITING: {
if (multiplayer) {
uint8_t code = PACKET_GAME_START;
g_xboard_logic.QueueDataForTx(&code, 1, TETRIS_RECV_ID);
switch (button) {
case BUTTON_OK:
if (multiplayer) {
uint8_t code = PACKET_GAME_START;
g_xboard_logic.QueueDataForTx(&code, 1, TETRIS_RECV_ID);
}
game.game_start_playing();
break;
case BUTTON_BACK:
case BUTTON_LONG_BACK:
if (multiplayer) {
uint8_t code = PACKET_ABORT_GAME;
g_xboard_logic.QueueDataForTx(&code, 1, TETRIS_RECV_ID);
}
badge_controller.BackToMenu(this);
break;
default:
break;
}
game.game_start_playing();
break;
}

Expand Down

0 comments on commit 773645f

Please sign in to comment.