void mainEvent(int opt) { switch (opt) { case 0: exit(0); case 1: changeResolution(); default: break; } }
int main (int argc, const char * argv[]) { // Parse arguments if (argc != 6) { printf("Syntax error\n"); exit(EXIT_FAILURE); } char *browser, *url, *filename, *cmd; int xRes, yRes; ProcessSerialNumber browserPSN; pid_t browserPID; browser = argv[1]; url = argv[4]; filename = argv[5]; xRes = atoi(argv[2]); yRes = atoi(argv[3]); changeResolution(xRes, yRes); browserPSN = openUrl(browser, url); int sleepPeriod = SLEEP_PERIOD; while ((sleepPeriod = sleep(sleepPeriod)) != 0); cmd = malloc((40 + strlen(filename)) * sizeof(char)); sprintf(cmd, "/usr/sbin/screencapture -x -tjpg %s", filename); system(cmd); GetProcessPID(&browserPSN, &browserPID); // F**k Apple events, can't get'em right kill(browserPID, SIGTERM); sleep(1); KillProcess(&browserPSN); return 0; }
void MainMenu::optionsMenuButtonClicked( CheckButton* button, int ){ std::string buttonName = button->getName(); if( buttonName == "BackgroundMusic"){ getSound()->playSound("Click"); getSound()->enableMusic( !getConfig()->musicEnabled ); } else if( buttonName == "MusicVolumePlus"){ int newVolume = getConfig()->musicVolume + 5; if( newVolume > 100 ){ newVolume = 100; } if( getConfig()->musicVolume != newVolume ){ getSound()->setMusicVolume( newVolume ); getSound()->playSound("Click"); } } else if( buttonName == "MusicVolumeMinus"){ int newVolume = getConfig()->musicVolume -5; if( newVolume < 0 ){ newVolume = 0; } if( getConfig()->musicVolume != newVolume ){ getSound()->setMusicVolume( newVolume ); getSound()->playSound("Click"); } } else if( buttonName == "SoundFX"){ getConfig()->soundEnabled = !getConfig()->soundEnabled; getSound()->playSound("Click"); } else if( buttonName == "FXVolumePlus"){ int newVolume = getConfig()->soundVolume + 5; if( newVolume > 100 ){ newVolume = 100; } if( getConfig()->soundVolume != newVolume ){ getSound()->setSoundVolume( newVolume ); getSound()->playSound("Click"); } } else if( buttonName == "FXVolumeMinus"){ int newVolume = getConfig()->soundVolume - 5; if( newVolume < 0 ){ newVolume = 0; } if( getConfig()->soundVolume != newVolume ){ getSound()->setSoundVolume( newVolume ); getSound()->playSound("Click"); } } else if( buttonName == "ResolutionPrev"){ changeResolution(false); } else if( buttonName == "ResolutionNext"){ changeResolution(true); } else if( buttonName == "WorldLenPrev"){ changeWorldLen(false); } else if( buttonName == "WorldLenNext"){ changeWorldLen(true); } else if( buttonName == "LanguagePrev"){ changeLanguage(false); } else if( buttonName == "LanguageNext"){ changeLanguage(true); } else if( buttonName == "Fullscreen"){ getSound()->playSound("Click"); getConfig()->useFullScreen = !getConfig()->useFullScreen; getConfig()->save(); if( getConfig()->restartOnChangeScreen ) { quitState = RESTART; running = false; } else { //SDL_IGNORE to avoid forth and back jumping resolution SDL_EventState(SDL_VIDEORESIZE, SDL_IGNORE); initVideo( getConfig()->videoX, getConfig()->videoY); currentMenu->resize(getConfig()->videoX, getConfig()->videoY); SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE); loadOptionsMenu(); //in case resolution was changed while in fullscreen } } else if( buttonName == "TrackPrev"){ changeTrack(false); } else if( buttonName == "TrackNext"){ changeTrack(true); } else if( buttonName == "BinaryMode"){ binary_mode = !binary_mode; } else if( buttonName == "SeedMode"){ seed_compression = !seed_compression; } else { std::cerr << "MainMenu::optionsMenuButtonClicked " << buttonName << " unknown Button!\n"; } }