void HUD_pauseSet(u8 joy, u8 pauseState){ clearPlayerSide(joy); if (! pauseState){ createHUD(joy); } else { createPauseMenu(joy); } }
void PongApp::notifyEvent( GF::NOTIFY_EVENT_TYPE type, int flags ) { switch (type) { case GF::NE_PAUSED: if (currentGame && currentGame->getGameState() == PGS_RUNNING && !currentMenu) currentMenu = createPauseMenu(); break; case GF::NE_VOLUME_CHANGED: amixer->setGeneralVolume( (float)flags/100.0f*0.7f ); if (flags<1) volumeIndicator = 4; else volumeIndicator = (flags-1) * 4 / 100; break; }; }
void PongApp::mouseEvent( GF::MOUSE_EVENT_TYPE type, int x, int y, int button ) { if (button>1 || button<0) { return; // ignore.. cannot fit } float worldx = (float)x / (float)currentWidth*2.0f - 1.0f; float worldy = (float)y / (float)currentHeight*2.0f - 1.0f; worldy *= -((float)currentHeight/(float)currentWidth); #ifdef EPONG_DEBUG if (type==GF::MOUSE_DOWN && y < 24) { playSoundEffect( sampleLatencyTest, 1.0f ); } #endif if (currentMenu) currentMenu->keyControlEnd(); if (highScores) { if (type==GF::MOUSE_DOWN) { highScores->die(); } return; }; if (credits) { if (type==GF::MOUSE_DOWN) { credits->die(); } return; }; if (currentMenu) { if (currentMenu->alreadyClicked() == false && type==GF::MOUSE_DOWN) { int itemCount = currentMenu->getItemCount(); // similar as in menuItemRender float scale = MENU_ITEM_HEIGHT/2.0f; float ystart = scale*0.65f*itemCount + scale; float ystep = MENU_ITEM_HEIGHT; if (worldy<ystart) { int clickIndex = -(worldy-ystart) / ystep; if (currentMenu->click( clickIndex )) playSoundEffect( sampleMenuTick, 1.0f ); } }; return; } switch (type) { case GF::MOUSE_DOWN: if (worldy>getTop()-0.1f) { if (worldx > 0.7f) { if (worldx > 0.8f) { if (currentGame && currentGame->getGameState()==PGS_RUNNING && !currentMenu) { // create pause menu currentMenu = createPauseMenu(); } } else { }; }; return; }; buttonDown[button] = true; break; case GF::MOUSE_UP: buttonDown[button] = false; }; pointerX[button] = worldx; pointerY[button] = worldy; }