Explorar o código

utilize numberOfMillisecondsBeforeShapeDisappears

SimplyMinimal %!s(int64=3) %!d(string=hai) anos
pai
achega
b2d7ae5005
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      simon_says.c

+ 7 - 4
simon_says.c

@@ -379,7 +379,7 @@ void play_sound_wrong_move() {
 // @todo restartGame
 // @todo restartGame
 void resetGame(SimonData* app) {
 void resetGame(SimonData* app) {
     app->moveIndex = 0;
     app->moveIndex = 0;
-    app->numberOfMillisecondsBeforeShapeDisappears = 1000;
+    app->numberOfMillisecondsBeforeShapeDisappears = 500;
     app->activePlayer = simon;
     app->activePlayer = simon;
     app->is_wrong_direction = false;
     app->is_wrong_direction = false;
     app->last_button_press_tick = 0;
     app->last_button_press_tick = 0;
@@ -532,7 +532,12 @@ int32_t simon_says_app_entry(void* p) {
     simon_state->gameState = mainMenu;
     simon_state->gameState = mainMenu;
 
 
     while(true) {
     while(true) {
-        if(furi_message_queue_get(event_queue, &input, 500) == FuriStatusOk) {
+        game_tick(simon_state);
+
+        FuriStatus q_status = furi_message_queue_get(
+            event_queue, &input, simon_state->numberOfMillisecondsBeforeShapeDisappears);
+
+        if(q_status == FuriStatusOk) {
             FURI_LOG_D(TAG, "Got input event: %d", input.key);
             FURI_LOG_D(TAG, "Got input event: %d", input.key);
             //break out of the loop if the back key is pressed
             //break out of the loop if the back key is pressed
             if(input.key == InputKeyBack && input.type == InputTypeLong) {
             if(input.key == InputKeyBack && input.type == InputTypeLong) {
@@ -597,8 +602,6 @@ int32_t simon_says_app_entry(void* p) {
         //     simon_state->set_board_neutral = !simon_state->set_board_neutral;
         //     simon_state->set_board_neutral = !simon_state->set_board_neutral;
         // }
         // }
 
 
-        game_tick(simon_state);
-
         view_port_update(view_port);
         view_port_update(view_port);
     }
     }