void event() { int a = 0; while(1) { a = get_event(); if (a == 3) { p->dir = p->dir-90; if(p->dir<0) { p->dir += 360; } } if (a == 4) { p->dir += 90; if(p->dir>=360) { p->dir -= 360; } } if (a == -1) { end = 1; WaitForSingleObject(play, INFINITE); quit_sdl(); break; } } }
/************************************************************************** Do any necessary UI-specific cleanup **************************************************************************/ void ui_exit() { #if defined UNDER_CE && defined SMALL_SCREEN /* change back to window mode to restore the title bar */ set_video_mode(320, 240, SDL_SWSURFACE | SDL_ANYFORMAT); #endif free_mapcanvas_and_overview(); free_auxiliary_tech_icons(); free_intro_radar_sprites(); diplomacy_dialog_done(); intel_dialog_done(); callback_list_destroy(callbacks); unload_cursors(); FC_FREE(button_behavior.event); meswin_dialog_popdown(); del_main_list(); free_font_system(); theme_free(theme); quit_sdl(); }
int main(int argc, char *argv[]) { bool running = false; // Two verbosity levels myPrintf[QUIET] = quietprint; myPrintf[VERBOSE] = printf; // Before continuing, read the arguments running = readArguments( argc, argv ); // If the arguments are correct, start a simulation while ( running ) { myPrintf[ verbosemode ] ( "main : running is true\n" ); // Init graphics SDL_Surface * screen = NULL; screen = init_sdl(); // Simulates simulation ( screen ); // End of graphics SDL_FreeSurface(screen); quit_sdl(); // Quit running mode running = false; }; return 0; }
int main( int argc, char** argv) { Game15min game; SDL_Surface* screen; SDL_Event event; int done = 0; game.mode = 0; game.x = 0; game.status = MINUTE_STAT_MAIN; init_sdl( &screen); game.screen = screen; game.ctrl[0] = samplectrl; game.draw[0] = sampledraw; while( !done){ clear_screen( screen); game.ctrl[game.status](&game); game.draw[game.status](&game); while( SDL_PollEvent(&event)){ switch( event.type){ case SDL_KEYDOWN: if( event.key.keysym.sym == SDLK_ESCAPE){ done = 1; } break; case SDL_QUIT: done = 1; break; } } } quit_sdl(); return 0; }
void framework_exit(int ret) { quit_sdl(); exit(ret); }