Przeglądaj źródła

Squashed '4inrow/' changes from 403c9320c..695acb26f

695acb26f not fixed
12ba36609 fixing some big bugs
22103368d categories part 1
2e670048f more manifestos, xbox controller and videopoker ufbt fixes
b9425b998 Add Screenshots
4d75f4d79 API 31 / unzip sources
REVERT: 403c9320c init
REVERT: a14efc71a init
REVERT: 610bd0c5a init
REVERT: da2b49ecb init
REVERT: d5aea2e8b init
REVERT: 764b4f9eb init
REVERT: 616737a15 init
REVERT: 224e1149f init
REVERT: 30e174e9a Update ReadMe.md
REVERT: df4ebe908 init
REVERT: 7c00d8a15 init
REVERT: 7d6178b65 init
REVERT: ee03e0527 Initial commit

git-subtree-dir: 4inrow
git-subtree-split: 695acb26f00ed7affd26ce44bd71f9043cc8ec65
Willy-JL 2 lat temu
rodzic
commit
76e9723253
5 zmienionych plików z 53 dodań i 46 usunięć
  1. 48 44
      4inrow.c
  2. 5 2
      application.fam
  3. BIN
      img/1.png
  4. BIN
      img/2.png
  5. BIN
      img/3.png

+ 48 - 44
4inrow.c

@@ -235,7 +235,7 @@ int32_t four_in_row_app(void* p) {
         return 255;
         return 255;
     }
     }
 
 
-    DOLPHIN_DEED(DolphinDeedPluginGameStart);
+    dolphin_deed(DolphinDeedPluginGameStart);
 
 
     // Создаем новый view port
     // Создаем новый view port
     ViewPort* view_port = view_port_alloc();
     ViewPort* view_port = view_port_alloc();
@@ -256,65 +256,69 @@ int32_t four_in_row_app(void* p) {
     while(1) {
     while(1) {
         // Выбираем событие из очереди в переменную event (ждем бесконечно долго, если очередь пуста)
         // Выбираем событие из очереди в переменную event (ждем бесконечно долго, если очередь пуста)
         // и проверяем, что у нас получилось это сделать
         // и проверяем, что у нас получилось это сделать
-        furi_check(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk);
-        furi_mutex_acquire(fourinrow_state->mutex, FuriWaitForever);
-        // Если нажата кнопка "назад", то выходим из цикла, а следовательно и из приложения
-        if(wincheck() != -1) {
-            notification_message(notification, &end);
-            furi_delay_ms(1000);
-            if(wincheck() == 1) {
-                scoreX++;
-            }
-            if(wincheck() == 2) {
-                scoreO++;
+        if(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) {
+            if((event.type == InputTypePress) && (event.key == InputKeyBack)) {
+                break;
             }
             }
-            init();
-        }
 
 
-        if(event.type == InputTypePress) {
-            if(event.key == InputKeyOk) {
-                int nh = next_height(cursorx);
-                if(nh != -1) {
-                    matrix[nh][cursorx] = player;
-                    player = 3 - player;
+            furi_mutex_acquire(fourinrow_state->mutex, FuriWaitForever);
+            if(wincheck() != -1) {
+                notification_message(notification, &end);
+                furi_delay_ms(1000);
+                if(wincheck() == 1) {
+                    scoreX++;
                 }
                 }
-            }
-            if(event.key == InputKeyUp) {
-                //cursory--;
-            }
-            if(event.key == InputKeyDown) {
-                //cursory++;
-            }
-            if(event.key == InputKeyLeft) {
-                if(cursorx > 0) {
-                    cursorx--;
+                if(wincheck() == 2) {
+                    scoreO++;
                 }
                 }
+                init();
+                furi_mutex_release(fourinrow_state->mutex);
+                continue;
             }
             }
-            if(event.key == InputKeyRight) {
-                if(cursorx < 6) {
-                    cursorx++;
+
+            if(event.type == InputTypePress) {
+                if(event.key == InputKeyOk) {
+                    int nh = next_height(cursorx);
+                    if(nh != -1) {
+                        matrix[nh][cursorx] = player;
+                        player = 3 - player;
+                    }
+                }
+                if(event.key == InputKeyUp) {
+                    //cursory--;
+                }
+                if(event.key == InputKeyDown) {
+                    //cursory++;
+                }
+                if(event.key == InputKeyLeft) {
+                    if(cursorx > 0) {
+                        cursorx--;
+                    }
+                }
+                if(event.key == InputKeyRight) {
+                    if(cursorx < 6) {
+                        cursorx++;
+                    }
                 }
                 }
             }
             }
-            if(event.key == InputKeyBack) {
-                break;
-            }
+
+            furi_mutex_release(fourinrow_state->mutex);
         }
         }
         view_port_update(view_port);
         view_port_update(view_port);
-        furi_mutex_release(fourinrow_state->mutex);
     }
     }
 
 
+    // Чистим созданные объекты, связанные с интерфейсом
+    view_port_enabled_set(view_port, false);
+    gui_remove_view_port(gui, view_port);
+    view_port_free(view_port);
+    furi_message_queue_free(event_queue);
+    furi_record_close(RECORD_GUI);
     // Clear notification
     // Clear notification
     notification_message_block(notification, &sequence_display_backlight_enforce_auto);
     notification_message_block(notification, &sequence_display_backlight_enforce_auto);
     furi_record_close(RECORD_NOTIFICATION);
     furi_record_close(RECORD_NOTIFICATION);
 
 
-    // Специальная очистка памяти, занимаемой очередью
-    furi_message_queue_free(event_queue);
-
-    // Чистим созданные объекты, связанные с интерфейсом
-    gui_remove_view_port(gui, view_port);
-    view_port_free(view_port);
     furi_mutex_free(fourinrow_state->mutex);
     furi_mutex_free(fourinrow_state->mutex);
-    furi_record_close(RECORD_GUI);
+
     free(fourinrow_state);
     free(fourinrow_state);
 
 
     return 0;
     return 0;

+ 5 - 2
application.fam

@@ -3,12 +3,15 @@ App(
     name="4 in row",
     name="4 in row",
     apptype=FlipperAppType.EXTERNAL,
     apptype=FlipperAppType.EXTERNAL,
     entry_point="four_in_row_app",
     entry_point="four_in_row_app",
-    cdefines=["4INROW_WORLD"],
     requires=[
     requires=[
         "gui",
         "gui",
     ],
     ],
     stack_size=1 * 1024,
     stack_size=1 * 1024,
     order=90,
     order=90,
-	fap_icon="4inrow_10px.png",
+    fap_icon="4inrow_10px.png",
     fap_category="Games",
     fap_category="Games",
+    fap_author="leo-need-more-coffee",
+    fap_weburl="https://github.com/leo-need-more-coffee/flipperzero-4inrow",
+    fap_version="1.1",
+    fap_description="4 in row Game",
 )
 )

BIN
img/1.png


BIN
img/2.png


BIN
img/3.png