Exemple #1
0
bool Menu::isQuestLogVisible() const
{
  Ogre::OverlayManager* om = Ogre::OverlayManager::getSingletonPtr();
  if (om==NULL) return false;
  const Ogre::Overlay* o_lay = om->getByName(cQuestLogOverlay);
  if (o_lay!=NULL) return o_lay->isVisible();
  return false;
}
Exemple #2
0
void Menu::hideDialogue()
{
  Ogre::OverlayManager* olMgr =Ogre::OverlayManager::getSingletonPtr();
  /*If overlay manager is NULL, then it is not present any more and all overlays
    should already be destroyed at that point. So we can return anyway. */
  if (olMgr==NULL) return;
  Ogre::Overlay* ol = olMgr->getByName(cDialogueOverlay);
  if (ol!=NULL)
  {
    ol->hide();
  }
}
Exemple #3
0
void Gui::createGui(Ogre::SceneManager* p_scene_manager, OgreBites::SdkTrayManager* p_tray_manager){
	m_tray_manager = p_tray_manager;
	m_button = m_tray_manager->createButton(OgreBites::TL_TOPLEFT, "MyButton", "Click me!");

	if(m_button->getName() == "MyButton"){
		int p = 0;
	}

	// Load layout
   Ogre::ResourceGroupManager::getSingletonPtr();
   Ogre::OverlayManager* mg = Ogre::OverlayManager::getSingletonPtr();
   Ogre::Overlay* ov = mg->getByName("testOverlay");
   ov->show();


}
Exemple #4
0
	bool GBaseEngine::loadBootResources()
	{
		if( bBootResourcesWereLoaded )
		{
			GTRACE(1, "Warning: received command to load boot resources again! (Ignoring)");
			return false;
		}
		ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
		ResourceGroupManager::getSingleton().loadResourceGroup("Bootstrap");
		Ogre::OverlayManager * overlayManager = OverlayManager::getSingletonPtr();
		if( ! overlayManager )
		{
			GTRACE(3, "ERROR! OverlayManager is NULL!");
			return false;
		}
		
		loaderOverlay = overlayManager->getByName("GusApp/Loader4_3");

		bool result = (loaderOverlay != NULL);
		bBootResourcesWereLoaded = result;
		return result;
	}
Exemple #5
0
bit GameVisualScene::init( Game* game )
{
	game->visualSystem.lockThread();

	game->visualSystem.loadResources("InGame");
	Ogre::Viewport* vp = game->visualSystem.getPrimaryRenderWindow()->getViewport(0);
	Ogre::CompositorManager* compositorMgr = Ogre::CompositorManager::getSingletonPtr();
	Ogre::CompositorInstance* compositor = compositorMgr->addCompositor(vp,"LuminanceBloom");
	compositorMgr->setCompositorEnabled(vp,"LuminanceBloom",true);

	VisualScene::init(game);

	Ogre::Light* light = game->visualSystem.getSceneMgr()->createLight("MainLight");
	light->setType(Ogre::Light::LT_DIRECTIONAL);
	light->setPosition(800,900,-550);
	Ogre::Vector3 dir = -light->getPosition();
	dir.normalise();
	light->setDirection(dir);
	light->setSpecularColour(1.0f,1.0f,1.0f);
	light->setDiffuseColour(0.8f,0.8f,0.8f);
	//light->setSpotlightRange(Ogre::Degree(50), Ogre::Degree(75));
	light->setPowerScale(1.0f);
	light->setCastShadows(true);	

	//Ogre::LiSPSMShadowCameraSetup* cameraSetup = new Ogre::LiSPSMShadowCameraSetup;
	//game->visualSystem.getSceneMgr()->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(cameraSetup));

	game->visualSystem.getSceneMgr()->getRootSceneNode()->attachObject(light);

	game->visualSystem.getSceneMgr()->setAmbientLight(Ogre::ColourValue(0.1,0.90,0.75));
	//game->visualSystem.getSceneMgr()->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE);
	game->visualSystem.getSceneMgr()->setShadowTextureSize(1024);
	//game->visualSystem.getSceneMgr()->setShadowTextureSettings(1024,2);
	game->visualSystem.getSceneMgr()->setShadowFarDistance(24);
	game->visualSystem.getSceneMgr()->setShadowDirLightTextureOffset(0.05);
	game->visualSystem.getSceneMgr()->setShadowTextureSelfShadow(false);
	game->visualSystem.getSceneMgr()->setShadowColour( Ogre::ColourValue(0.75f, 0.75f, 0.75f) );
	game->visualSystem.getSceneMgr()->setSkyBox(true,"skybox",1000);	
	game->visualSystem.getSceneMgr()->setShadowTextureCasterMaterial("depthShadowMapCasterMaterial");
	//game->visualSystem.getSceneMgr()->setShadowTextureCasterMaterial("VarianceShadowMapping/ShadowCaster");
	game->visualSystem.getSceneMgr()->setShadowTexturePixelFormat(PF_FLOAT32_R);
	game->visualSystem.getSceneMgr()->setShadowCasterRenderBackFaces(true);
	game->visualSystem.getSceneMgr()->setShadowTechnique(SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
	
	Bridge* bridge = new Bridge(game);
	bridge->init("bridge");

	RoadBarrier* barrier[20];

	for(u32 i=0 ; i<20 ; i++)
	{		
		barrier[i] = new RoadBarrier(game);
		barrier[i]->init("barrier"+IntToStr(i));		
	}
	hkQuaternion q;
	q.setAxisAngle(hkVector4(0,1,0),Deg2Rad(90));
	barrier[0]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,-50.0),q);
	barrier[1]->getPhysicsEntity()->setPositionAndRotation(hkVector4(4.5,0.51f,-40.0),q);
	barrier[2]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,-30.0),q);
	barrier[3]->getPhysicsEntity()->setPositionAndRotation(hkVector4(1.5,0.51f,-20.0),q);
	barrier[4]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,-10.0),q);
	barrier[5]->getPhysicsEntity()->setPositionAndRotation(hkVector4(2.5,0.51f,-70.0),q);
	barrier[6]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,-90.0),q);
	barrier[7]->getPhysicsEntity()->setPositionAndRotation(hkVector4(0.5,0.51f,100.0),q);
	barrier[8]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,110.0),q);
	barrier[9]->getPhysicsEntity()->setPositionAndRotation(hkVector4(5.5,0.51f,40.0),q);
	barrier[10]->getPhysicsEntity()->setPositionAndRotation(hkVector4(1.5,0.51f,50.0),q);
	barrier[11]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,60.0),q);
	barrier[12]->getPhysicsEntity()->setPositionAndRotation(hkVector4(5.5,0.51f,70.0),q);
	barrier[13]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,80.0),q);
	barrier[14]->getPhysicsEntity()->setPositionAndRotation(hkVector4(3.5,0.51f,90.0),q);
	barrier[15]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-5.5,0.51f,100.0),q);
	barrier[16]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-2.5,0.51f,110.0),q);
	barrier[17]->getPhysicsEntity()->setPositionAndRotation(hkVector4(-0.5,0.51f,120.0),q);
	barrier[18]->getPhysicsEntity()->setPositionAndRotation(hkVector4(2.5,0.51f,130.0),q);
	barrier[19]->getPhysicsEntity()->setPositionAndRotation(hkVector4(5.5,0.51f,140.0),q);

	Crate* crate[32];
	for(u32 i=0 ; i<32 ; i++)
	{
		crate[i] = new Crate(game);
		crate[i]->init("crate"+IntToStr(i));		
	}
	crate[0]->getPhysicsEntity()->setPosition(hkVector4(-1.25,0.0f,20.75));
	crate[1]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.0f,20.75));
	crate[2]->getPhysicsEntity()->setPosition(hkVector4(-2,0.0f,20.75));
	crate[3]->getPhysicsEntity()->setPosition(hkVector4(-1,25,0.0f,20.0));
	crate[4]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.0f,20.0));
	crate[5]->getPhysicsEntity()->setPosition(hkVector4(-2.75,0.0f,20.0));
	crate[6]->getPhysicsEntity()->setPosition(hkVector4(-1,25,0.0f,20.75));
	crate[7]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.0f,20.75));
	crate[8]->getPhysicsEntity()->setPosition(hkVector4(-2.75,0.0f,20.75));

	crate[9]->getPhysicsEntity()->setPosition(hkVector4(-1.25,0.5f,20.75));
	crate[10]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.5f,20.75));
	crate[11]->getPhysicsEntity()->setPosition(hkVector4(-2.75,0.5f,20.75));
	crate[12]->getPhysicsEntity()->setPosition(hkVector4(-1,25,0.5f,20.0));
	crate[13]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.5f,20.0));
	crate[14]->getPhysicsEntity()->setPosition(hkVector4(-2.75,0.5f,20.0));
	crate[15]->getPhysicsEntity()->setPosition(hkVector4(-1,25,0.5f,20.750));
	crate[16]->getPhysicsEntity()->setPosition(hkVector4(-2   ,0.5f,20.750));
	crate[17]->getPhysicsEntity()->setPosition(hkVector4(-2.75,0.5f,20.750));

	crate[18]->getPhysicsEntity()->setPosition(hkVector4(-1.25,1.0f,20.75));
	crate[19]->getPhysicsEntity()->setPosition(hkVector4(-2   ,1.0f,20.75));
	crate[20]->getPhysicsEntity()->setPosition(hkVector4(-2.75,1.0f,20.75));
	crate[21]->getPhysicsEntity()->setPosition(hkVector4(-1,25,1.0f,20.0));
	crate[22]->getPhysicsEntity()->setPosition(hkVector4(-2   ,1.0f,20.0));
	crate[23]->getPhysicsEntity()->setPosition(hkVector4(-2.75,1.0f,20.0));
	crate[24]->getPhysicsEntity()->setPosition(hkVector4(-1,25,1.0f,20.75));
	crate[25]->getPhysicsEntity()->setPosition(hkVector4(-2   ,1.0f,20.75));
	crate[26]->getPhysicsEntity()->setPosition(hkVector4(-2.75,1.0f,20.75));

	crate[27]->getPhysicsEntity()->setPosition(hkVector4(-1.25,1.5f,-20.75));
	crate[28]->getPhysicsEntity()->setPosition(hkVector4(-20   ,1.5f,-20.75));
	crate[29]->getPhysicsEntity()->setPosition(hkVector4(-2.75,1.5f,-20.75));
	crate[30]->getPhysicsEntity()->setPosition(hkVector4(-1,25,1.5f,-20.0));
	crate[31]->getPhysicsEntity()->setPosition(hkVector4(-2   ,1.5f,-20.0));


	//RoadBarrier* barrier = new RoadBarrier(game);
	//barrier->init("barrier");
	//barrier->getPhysicsEntity()->setPosition(hkVector4(-5.5,0.25f,0.0f));

	Ogre::OverlayManager* overlayManager = Ogre::OverlayManager::getSingletonPtr();
	Ogre::Overlay* overlay = overlayManager->getByName("debugText");
	overlay->show();
	debugTextOverlay  = (Ogre::TextAreaOverlayElement*)overlayManager->getOverlayElement("debugTextArea");
	debugTextOverlay->show();

	updateCamera();

	game->visualSystem.unlockThread();

	return true;
}