LE mode in the endless runner now displays the current time.
This commit is contained in:
parent
324942009e
commit
28b14d3665
@ -319,6 +319,37 @@ static void display_title(endless_runner_state_t *state) {
|
|||||||
display_difficulty(difficulty);
|
display_difficulty(difficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void display_time(watch_date_time date_time, bool clock_mode_24h) {
|
||||||
|
static watch_date_time previous_date_time;
|
||||||
|
char buf[6 + 1];
|
||||||
|
|
||||||
|
// If the hour needs updating
|
||||||
|
if (date_time.unit.hour != previous_date_time.unit.hour) {
|
||||||
|
uint8_t hour = date_time.unit.hour;
|
||||||
|
|
||||||
|
if (clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H);
|
||||||
|
else {
|
||||||
|
if (hour >= 12) watch_set_indicator(WATCH_INDICATOR_PM);
|
||||||
|
hour %= 12;
|
||||||
|
if (hour == 0) hour = 12;
|
||||||
|
}
|
||||||
|
watch_set_colon();
|
||||||
|
sprintf( buf, "%2d%02d ", hour, date_time.unit.minute);
|
||||||
|
watch_display_string(buf, 4);
|
||||||
|
}
|
||||||
|
// If both digits of the minute need updating
|
||||||
|
else if ((date_time.unit.minute / 10) != (previous_date_time.unit.minute / 10)) {
|
||||||
|
sprintf( buf, "%02d ", date_time.unit.minute);
|
||||||
|
watch_display_string(buf, 6);
|
||||||
|
}
|
||||||
|
// If only the ones-place of the minute needs updating.
|
||||||
|
else if (date_time.unit.minute != previous_date_time.unit.minute) {
|
||||||
|
sprintf( buf, "%d ", date_time.unit.minute % 10);
|
||||||
|
watch_display_string(buf, 7);
|
||||||
|
}
|
||||||
|
previous_date_time.reg = date_time.reg;
|
||||||
|
}
|
||||||
|
|
||||||
static void begin_playing(endless_runner_state_t *state) {
|
static void begin_playing(endless_runner_state_t *state) {
|
||||||
uint8_t difficulty = state -> difficulty;
|
uint8_t difficulty = state -> difficulty;
|
||||||
game_state.curr_screen = SCREEN_PLAYING;
|
game_state.curr_screen = SCREEN_PLAYING;
|
||||||
@ -569,6 +600,7 @@ bool endless_runner_face_loop(movement_event_t event, movement_settings_t *setti
|
|||||||
display_title(state);
|
display_title(state);
|
||||||
break;
|
break;
|
||||||
case EVENT_LOW_ENERGY_UPDATE:
|
case EVENT_LOW_ENERGY_UPDATE:
|
||||||
|
display_time(watch_rtc_get_date_time(), settings->bit.clock_mode_24h);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return movement_default_loop_handler(event, settings);
|
return movement_default_loop_handler(event, settings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user