Example #1
0
void game_over() {
    pulse_vibe_on();
    pulse_mdelay(60);
    pulse_vibe_off();
    //int vib_timer = pulse_register_timer(75, &pulse_vibe_off, 0);

    current_screen = SCREEN_GAME_OVER;
    pulse_blank_canvas();
    if (score > highscore)
        highscore = score;
    printf ("GAME OVER\n\nScore: %d\n\nHighscore: %d\n\nClick to restart",score,highscore);
    reset_game();
    prepare_to_sleep();
}
// Special loop that runs even if the watch is not on
// We can't rely on pulse_register_timer etc since they aren't running if
// the screen isn't on.
// pulse_get_millis doesn't update, and the clock runs so slow that per min is
// about as good as it gets.
// Screen cannot be used.
void mode_btlostphone_apploop(void) {
  multi_debug("mode_btlostphone_apploop\n");
  // multi_debug("%i > %i\n", pulse_get_millis(), mode_btlostphone_millis);
  // ALARM if we have passed our timeout
  if (multiTimeNow.tm_min != mode_btlostphone_min) {
    multi_debug("vibe!\n");

    // schedule next "alarm"
    mode_btlostphone_min = multiTimeNow.tm_min;

    // Buzz
    pulse_vibe_on();
    pulse_mdelay(1000); // should notice this...
    pulse_vibe_off();
  }
}