// todo fancy: // - centralized configuration (wait time, amount of directories to // watch, verbosity, ...) // - configuration options on command line int main(int argc, char ** argv) { if( argc < 2 || strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) { print_error("Usage: %s <file>\n" " Delete <file> and (maybe) restore", argv[0]); return EXIT_FAILURE; } if( !sig_register_interrupt_handler() ) return EXIT_FAILURE; struct ino_hide ih; if( !ih_init(&ih, argv[1]) ) { ih_cleanup(&ih); return EXIT_FAILURE; } ih_hide_file(&ih); if( ih_worker_is_alive(&ih) ) { kill(ih.worker_pid, SIGUSR1); wait(/* int * stat_loc */ NULL); } ih_cleanup(&ih); return EXIT_FAILURE; }
uint32_t Game::run() { //This is a main game //Quit flag bool quit = false; //The frame rate regulator Timer fps; ih_init(); music_init(); world_init(); //SOME SORT OF MENU SHOULD BE HERE //Constructor calls etc Player *player = new Player(); center_camera((player->get_x() + PLAYER_WIDTH/2), (player->get_y() + PLAYER_HEIGTH/2)); show_message(); //BOX FOR TEST world_generate(); //main loop while(quit == false) { //Start the frame timer fps.start(); //While there's events to handle while( SDL_PollEvent( &event ) ) { handle_events(player); //If the user has Xed out the window if( event.type == SDL_QUIT ) { //Quit the program quit = true; } } music_play(); //MOVES player->move(); player->center(); //CLS ih_clear_screen(); //DRAWING //hide cursor SDL_ShowCursor(0); apply_cursor(); player->draw(); start_over(); while(get_curr()) { get_curr()->draw(); traverse(); } ih_update(); //Cap the frame rate if( fps.get_ticks() < 1000 / FRAMES_PER_SECOND ) { SDL_Delay( ( 1000 / FRAMES_PER_SECOND ) - fps.get_ticks() ); } } delete player; world_finit(); music_finit(); ih_cleanup(); return 0; }