]> git.earman.xyz Git - sensor-watch.git/commitdiff
Added documentation on tap controls and retained the tap indicator
authorDavid Volovskiy <devolov@gmail.com>
Wed, 3 Sep 2025 12:06:03 +0000 (08:06 -0400)
committerDavid Volovskiy <devolov@gmail.com>
Wed, 3 Sep 2025 12:06:03 +0000 (08:06 -0400)
watch-faces/complication/blackjack_face.c
watch-faces/complication/blackjack_face.h

index 2545fd7a270a0acccd044a42de872e34814773e4..1497b7d6578d502562aa8fafb566c3ecde0a65bd 100755 (executable)
@@ -242,8 +242,11 @@ static void display_title(void) {
     watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, " JACK ", "BLaKJK");\r
 }\r
 \r
-static void begin_playing(void) {\r
+static void begin_playing(bool tap_control_on) {\r
     watch_clear_display();\r
+    if (tap_control_on) {\r
+        watch_set_indicator(WATCH_INDICATOR_SIGNAL);\r
+    }\r
     game_state = BJ_PLAYING;\r
     reset_hands();\r
     // Give player their first 2 cards\r
@@ -301,11 +304,11 @@ static void see_if_dealer_hits(void) {
     }\r
 }\r
 \r
-static void handle_button_presses(bool hit) {\r
+static void handle_button_presses(bool tap_control_on, bool hit) {\r
     switch (game_state)\r
     {\r
     case BJ_TITLE_SCREEN:\r
-        begin_playing();\r
+        begin_playing(tap_control_on);\r
         break;\r
     case BJ_PLAYING:\r
         if (hit) {\r
@@ -362,7 +365,12 @@ bool blackjack_face_loop(movement_event_t event, void *context) {
     switch (event.event_type) {\r
         case EVENT_ACTIVATE:\r
             if (state->tap_control_on) {\r
-                movement_enable_tap_detection_if_available();\r
+                bool tap_could_enable = movement_enable_tap_detection_if_available();\r
+                if (tap_could_enable) {\r
+                    watch_set_indicator(WATCH_INDICATOR_SIGNAL);\r
+                } else {\r
+                    state->tap_control_on = false;\r
+                }\r
             }\r
             break;\r
         case EVENT_TICK:\r
@@ -375,12 +383,12 @@ bool blackjack_face_loop(movement_event_t event, void *context) {
             break;\r
         case EVENT_LIGHT_BUTTON_UP:\r
         case EVENT_DOUBLE_TAP:\r
-            handle_button_presses(false);\r
+            handle_button_presses(state->tap_control_on, false);\r
         case EVENT_LIGHT_BUTTON_DOWN:\r
             break;\r
         case EVENT_ALARM_BUTTON_UP:\r
         case EVENT_SINGLE_TAP:\r
-            handle_button_presses(true);\r
+            handle_button_presses(state->tap_control_on, true);\r
             break;\r
         case EVENT_ALARM_LONG_PRESS:\r
             if (game_state == BJ_TITLE_SCREEN) {\r
index 8771561c1b6b0c8da4340cde16228c4c0de584c2..84041517f61e0afec766dd3c7a3ba5ceed61342f 100755 (executable)
  * BUST: Your score is above 21.\r
  * TIE: Your score matches the dealer's final score\r
  * \r
+ * On a watch that has the accelerometer, long-pressing the ALARM button will turn on the ability to play by tapping.\r
+ * The SIGNAL indicator will display when tapping is enabled.\r
+ * Tapping once will behave like the ALARM button and hit.\r
+ * Tapping twice behave like the LIGHT button and stand.\r
+ * \r
  * | Cards   |                          |\r
  * |---------|--------------------------|\r
  * | Value   |2|3|4|5|6|7|8|9|10|J|Q|K|A|\r