Added documentation on tap controls and retained the tap indicator
This commit is contained in:
parent
20bb59f02f
commit
eb1b551e7b
@ -242,8 +242,11 @@ static void display_title(void) {
|
|||||||
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, " JACK ", "BLaKJK");
|
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, " JACK ", "BLaKJK");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void begin_playing(void) {
|
static void begin_playing(bool tap_control_on) {
|
||||||
watch_clear_display();
|
watch_clear_display();
|
||||||
|
if (tap_control_on) {
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
|
||||||
|
}
|
||||||
game_state = BJ_PLAYING;
|
game_state = BJ_PLAYING;
|
||||||
reset_hands();
|
reset_hands();
|
||||||
// Give player their first 2 cards
|
// Give player their first 2 cards
|
||||||
@ -301,11 +304,11 @@ static void see_if_dealer_hits(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_button_presses(bool hit) {
|
static void handle_button_presses(bool tap_control_on, bool hit) {
|
||||||
switch (game_state)
|
switch (game_state)
|
||||||
{
|
{
|
||||||
case BJ_TITLE_SCREEN:
|
case BJ_TITLE_SCREEN:
|
||||||
begin_playing();
|
begin_playing(tap_control_on);
|
||||||
break;
|
break;
|
||||||
case BJ_PLAYING:
|
case BJ_PLAYING:
|
||||||
if (hit) {
|
if (hit) {
|
||||||
@ -362,7 +365,12 @@ bool blackjack_face_loop(movement_event_t event, void *context) {
|
|||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
case EVENT_ACTIVATE:
|
case EVENT_ACTIVATE:
|
||||||
if (state->tap_control_on) {
|
if (state->tap_control_on) {
|
||||||
movement_enable_tap_detection_if_available();
|
bool tap_could_enable = movement_enable_tap_detection_if_available();
|
||||||
|
if (tap_could_enable) {
|
||||||
|
watch_set_indicator(WATCH_INDICATOR_SIGNAL);
|
||||||
|
} else {
|
||||||
|
state->tap_control_on = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_TICK:
|
case EVENT_TICK:
|
||||||
@ -375,12 +383,12 @@ bool blackjack_face_loop(movement_event_t event, void *context) {
|
|||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_BUTTON_UP:
|
case EVENT_LIGHT_BUTTON_UP:
|
||||||
case EVENT_DOUBLE_TAP:
|
case EVENT_DOUBLE_TAP:
|
||||||
handle_button_presses(false);
|
handle_button_presses(state->tap_control_on, false);
|
||||||
case EVENT_LIGHT_BUTTON_DOWN:
|
case EVENT_LIGHT_BUTTON_DOWN:
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_UP:
|
case EVENT_ALARM_BUTTON_UP:
|
||||||
case EVENT_SINGLE_TAP:
|
case EVENT_SINGLE_TAP:
|
||||||
handle_button_presses(true);
|
handle_button_presses(state->tap_control_on, true);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_LONG_PRESS:
|
case EVENT_ALARM_LONG_PRESS:
|
||||||
if (game_state == BJ_TITLE_SCREEN) {
|
if (game_state == BJ_TITLE_SCREEN) {
|
||||||
|
|||||||
@ -55,6 +55,11 @@
|
|||||||
* BUST: Your score is above 21.
|
* BUST: Your score is above 21.
|
||||||
* TIE: Your score matches the dealer's final score
|
* TIE: Your score matches the dealer's final score
|
||||||
*
|
*
|
||||||
|
* On a watch that has the accelerometer, long-pressing the ALARM button will turn on the ability to play by tapping.
|
||||||
|
* The SIGNAL indicator will display when tapping is enabled.
|
||||||
|
* Tapping once will behave like the ALARM button and hit.
|
||||||
|
* Tapping twice behave like the LIGHT button and stand.
|
||||||
|
*
|
||||||
* | Cards | |
|
* | Cards | |
|
||||||
* |---------|--------------------------|
|
* |---------|--------------------------|
|
||||||
* | Value |2|3|4|5|6|7|8|9|10|J|Q|K|A|
|
* | Value |2|3|4|5|6|7|8|9|10|J|Q|K|A|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user