void JMFrame::changeSiteSwap(wxCommandEvent& WXUNUSED(event)) { JML_CHAR *newpattern; wxTextEntryDialog dialog(this, _T("Change SiteSwap"), _T("Please Enter SiteSwap Here"), wxString(jmlib->getSite(),wxConvUTF8), wxOK | wxCANCEL | wxCENTRE); if (dialog.ShowModal() == wxID_OK) { newpattern = (JML_CHAR *)(const char *)dialog.GetValue().mb_str(wxConvUTF8); jmlib->stopJuggle(); jmlib->setPattern(newpattern,newpattern,HR_DEF, DR_DEF); jmlib->setStyleDefault(); jmlib->startJuggle(); unPause(); } else { unPause(); } }
void JMFrame::togglePause() { if (optionsMenu->IsChecked(OPTION_PAUSE)) unPause(); else setPause(); }
void Game::handleStateChanges(DWORD currentTime) { if (itsNewStateRequest.isActiveRequest == TRUE) { switch (itsNewStateRequest.itsNewState) { case GAMESTATE_INPROGRESS : if (itsNewStateRequest.itsNewWorld != NULL) { // changing worlds. theEventDispatcher.release(); theEventDispatcher.init(); if (isInGameSelectWorld) theEventDispatcher.registerForEvent(EventDispatcher::EVENT_TYPE_ENTER,this,NULL); if (itsWorld != NULL) { itsWorld->release(); delete itsWorld; } delete itsSoundPlayer; itsSoundPlayer = new SoundPlayer(itsSoundManager); itsWorld = itsNewStateRequest.itsNewWorld; itsWorld->init(itsLastTickTime,theDirectDrawObject); itsPlayer = itsWorld->getPlayer(); } else { switch (itsCurrentState) { case GAMESTATE_PAUSED : // bring back up the lights and tell everyone to unpause unPause(currentTime); break; case GAMESTATE_LOST : case GAMESTATE_INPROGRESS : itsWorld->softReset(); break; } } break; case GAMESTATE_LOST : theEventDispatcher.fireEvent(EventDispatcher::EVENT_TYPE_GAMELOST,NULL,NULL); // stop everyone from moving (but not animating) and start ignoring movement input break; case GAMESTATE_WON : // play the winning theme and then stop everyone from moving (but not animating) theEventDispatcher.fireEvent(EventDispatcher::EVENT_TYPE_GAMEWON,NULL,NULL); itsWinTime = currentTime; break; case GAMESTATE_PAUSED : // dim the lights and send a pause message to everyone pause(currentTime); break; case GAMESTATE_PREGAME : // destroy the current world and go back to game select screen if (itsWorld != NULL) { itsWorld->release(); delete itsWorld; itsWorld = NULL; itsPlayer = NULL; } itsInstructionMessageTimerID = theEventDispatcher.setTimer(this,3500); break; default : assert("Illegal State Transition" == NULL); break; } itsCurrentState = itsNewStateRequest.itsNewState; itsNewStateRequest.isActiveRequest = FALSE; itsNewStateRequest.itsNewWorld = NULL; } }