void EnPlayerSound::handleNotification( const yaf3d::EntityNotification& notification ) { // handle attribute changing switch( notification.getId() ) { case YAF3D_NOTIFY_MENU_LEAVE: { // respond to sound setting changes in menu for fx sound bool sndenable = false; yaf3d::Configuration::get()->getSettingValue( VRC_GS_FX_ENABLE, sndenable ); // did we just enabled the fx sound in menu? if ( sndenable && ( _mapSounds.size() == 0 ) ) { setupSounds(); } // did we just disabled fx sound in menu? else if ( !sndenable && ( _mapSounds.size() > 0 ) ) { releaseSounds(); } } break; case YAF3D_NOTIFY_ENTITY_ATTRIBUTE_CHANGED: { _volume = std::max( std::min( _volume, 1.0f ), 0.0f ); } break; default: ; } }
void key_press(unsigned char key, int x, int y) { switch(key) { case 's': case 'S': shot = capturePoints(); if(gameState != STATE_CALIBRATE) calculateCoor(); shot[0] = 0; shot[1] = 0; isShotFired = true; if(gameState == STATE_PLAY) checkAllHits(); else if(gameState == STATE_HIGHSCORES) checkKeyboardTargets(); break; case 'r': case 'R': playSound1(); gameState = STATE_START; break; case 'q': case 'Q': stopCamera(); releaseSounds(); exit(0); } }
EnPlayerSound::~EnPlayerSound() { // release sounds releaseSounds(); }