/* * screenshot_update() * Checks if the user wants to take a snapshot, and if * he/she does, we must do it. */ void screenshot_update() { /* take the snapshot! (press the '=' key or the 'printscreen' key) */ if(input_button_pressed(in, IB_FIRE1) || input_button_pressed(in, IB_FIRE2)) { char *file = next_available_filename(); image_save(video_get_window_surface(), file); video_showmessage("'screenshots/%s' saved", basename(file)); logfile_message("New screenshot: %s", file); } }
void display_mode(void) { uint8_t mode, last_mode; mode = last_mode = read_mode(); set_mode_lights(mode); input_clear_button_pressed(); while (1) { last_mode = mode; mode = read_mode(); if(mode != last_mode) { set_mode_lights(mode); play_tone(2000,10); game_set_mode(mode); } if (input_button_pressed()) { _delay_ms(100); break; } } set_leds(ALL_LEDS, OFF); }
/* * intro_update() * Updates the introduction scene */ void intro_update() { elapsed_time += timer_get_delta(); if(!fadefx_is_fading() && !must_fadein && (input_button_pressed(in, IB_FIRE3) || input_button_pressed(in, IB_FIRE4))) elapsed_time += INTRO_TIMEOUT; if(must_fadein) { fadefx_in(image_rgb(0,0,0), 1.0f); must_fadein = FALSE; } else if(elapsed_time >= INTRO_TIMEOUT) { if(fadefx_over()) { scenestack_pop(); load_intro_quest(); return; } fadefx_out(image_rgb(0,0,0), 1.0f); } if(music_is_playing()) music_stop(); }
int main(void) { setup(); sei(); // Enable interrupts power_up_melody(); while(1) { display_mode(); if (input_button_pressed()) { _delay_ms(100); input_clear_button_pressed(); game_start(DEFAULT_STARTING_LENGTH); } input_clear_button_pressed(); } }