예제 #1
0
	virtual bool processUnbufferedKeyInput(const FrameEvent& evt) {
		bool retval = ExampleFrameListener::processUnbufferedKeyInput(evt);

		// "C" switch filters
		if (mKeyboard->isKeyDown(OIS::KC_C) && timeoutDelay==0) 
		{
			timeoutDelay = 0.5f;

			DeferredShadingSystem* iSystem = SharedData::getSingleton().iSystem;

			iSystem->setMode(
				(DeferredShadingSystem::DSMode)
				((iSystem->getMode() + 1)%DeferredShadingSystem::DSM_COUNT)
				);

			updateOverlays();
		}

		// "B" activate/deactivate minilight rendering
		if (mKeyboard->isKeyDown(OIS::KC_B) && timeoutDelay==0) 
		{
			timeoutDelay = 0.5f;
			SharedData::getSingleton().iActivate = !SharedData::getSingleton().iActivate;
			// Hide/show all minilights
			std::vector<Node*>::iterator i = SharedData::getSingleton().mLightNodes.begin();
			std::vector<Node*>::iterator iend = SharedData::getSingleton().mLightNodes.end();
			for(; i!=iend; ++i)
			{
				static_cast<SceneNode*>(*i)->setVisible(SharedData::getSingleton().iActivate, true);
			}
			
			updateOverlays();
		}
		// "G" activate/deactivate global light rendering
		if (mKeyboard->isKeyDown(OIS::KC_G) && timeoutDelay==0) 
		{
			timeoutDelay = 0.5f;
			SharedData::getSingleton().iGlobalActivate = !SharedData::getSingleton().iGlobalActivate;
			SharedData::getSingleton().iMainLight->setVisible(SharedData::getSingleton().iGlobalActivate);
			updateOverlays();
		}

		timeoutDelay -= evt.timeSinceLastFrame;
		if (timeoutDelay <= 0) timeoutDelay = 0;

		return retval;
	}
void 
SoXipImageOverlayManager::callback( SoCallbackAction* action)
{
    // First, update the overlays in case the dicom image we're looking at has changed.
    updateOverlays( action );

	SoXipOverlayManager::callback( action );
}
void
SoXipImageOverlayManager::GLRender( SoGLRenderAction* action )
{
    // First, update the overlays in case the dicom image we're looking at has changed.
    updateOverlays( action );
    
    SoXipOverlayManager::GLRender( action );
}
예제 #4
0
void GameVisualScene::update()
{
	VisualScene::update();
	UpdateListenerMgr::getInstance()->update(EV_UPDATE_VISUAL_ENTITIES,0);

	updateCamera();
	updateOverlays();
}
void
SoXipImageOverlayManager::handleEvent( SoHandleEventAction* action )
{
	if( action->isHandled() )
		return ;

    // First, update the overlays in case the dicom image we're looking at has changed.
    // Can only be done if the scene has been traversed entirely (not if the grabber
	// has been set)
    if( !action->getGrabber() )
        updateOverlays( action );

	SoXipOverlayManager::handleEvent( action );
}
예제 #6
0
void PlatformState::update(const sf::Time& deltaTime)
{
	updateOverlays(deltaTime);

	if(mPaused) return;

	mWorld->step(deltaTime.asSeconds());
	for(unsigned int i = 0; i < mEntityVector.size(); i++)
	{
		mEntityVector[i]->update(deltaTime);
	}
	killDeadEntities();

	if(mPlayer->getPosition().y > 4000) getOverlay(DEATH_SCREEN).setEnabled(true);

	//Background sounds/music
	for(unsigned int i = 0; i < mMusicVector.size(); i++)
	{
		if(mMusicVector[i]->getLoop() == false)
		{
			mMusicVector[i]->play();
			mMusicVector[i]->setLoop(true);
		}
	}
	
	if(mFirstSong->getLoop() == false)
	{
		mFirstSong->play();
		mFirstSong->setLoop(true);
	}

	if(mAmbience->getLoop() == false)
	{
		mAmbience->play();
		mAmbience->setLoop(true);
	}


	//Positional sound and music
	for (auto i = 0; i < (int) mMusicVector.size(); i++)
	{
		float x = (mMusicVector[i]->getPosition().x - mPlayer->getPosition().x) * (mMusicVector[i]->getPosition().x - mPlayer->getPosition().x);
		float y = (mMusicVector[i]->getPosition().y - mPlayer->getPosition().y) * (mMusicVector[i]->getPosition().y - mPlayer->getPosition().y);
		float distance = std::sqrtf(x + y);

	/*	auto volume = 1500 / (distance+100);
		mMusicVector[i]->setVolume(volume);*/
		if (distance > 1000)
		{
			mMusicVector[i]->setVolume(0);
		}
		if (distance <= 400)
		{
			mMusicVector[i]->setVolume(20);
		}
		if (distance >401 && distance <= 700 )
		{
			mMusicVector[i]->setVolume(15);
		}
		if (distance > 701 && distance <=1000)
		{
			mMusicVector[i]->setVolume(5);
		}
	}

	for (AnimatedBackgroundImage* image : mAnimations) image->update(deltaTime);

	// Swap level when all stars are collected
	if(mStats->stars == mStats->totalStars) getOverlay(FADE_OUT).setEnabled(true);
}