int main() { int ret = 0; picframe_init(); arrow_setup(); // clock_setup(); weather_today_setup(); weather_tomorrow_setup(); weather_dayAfterTomorrow_setup(); weather_dayAfterTomorrowPlus1_setup(); curr_window = picframe_get_window(START_WINDOW); picframe_set_backlight(500); while (1) { picframe_clear_screen(); switch (curr_window_idx) { /* case 1: ret = clock_loop(); break; */ case 1: ret = weather_today_loop(); break; case 2: ret = weather_tomorrow_loop(); break; case 3: ret = weather_dayAfterTomorrow_loop(); break; case 4: ret = weather_dayAfterTomorrowPlus1_loop(); break; default: break; } if (ret == 1) goto cleanup; } // Try a friendly shotdown to prevent memory leaks... cleanup: picframe_cleanup(); app_free(); return 0; }
void app_free() { picframe_cleanup(); for (int i = 0; i < NUM_WINDOWS; i++) { window_free(window[i]); } SDL_FreeSurface(leftArrow->surface); SDL_FreeSurface(leftArrow->surface_selected); SDL_FreeSurface(rightArrow->surface); SDL_FreeSurface(rightArrow->surface_selected); }
int main() { int ret=0; picframe_init(); first_window_setup(); second_window_setup(); third_window_setup(); fourth_window_setup(); fifth_window_setup(); curr_window = picframe_get_window(START_WINDOW); picframe_set_backlight(500); while (1) { picframe_clear_screen(); switch(curr_window_idx) { case 1: ret = first_window_loop(); break; case 2: ret = second_window_loop(); break; case 3: ret = third_window_loop(); break; case 4: ret = fourth_window_loop(); break; case 5: ret = fifth_window_loop(); break; default: break; } if (ret == 1) goto cleanup; picframe_update(curr_window); SDL_Delay(1); } cleanup: picframe_cleanup(); return 0; }