Ejemplo n.º 1
0
void PendulumTest::handleInput(opal::real elapsedRealTime, 
	const SimulationEngine& engine)
{
	OIS::Keyboard* keyboard = engine.getKeyboard();

	// This variable can be used to keep keys from repeating too fast.
	static Ogre::Real toggleTimer = 0;
	if (toggleTimer >= 0)
	{
		toggleTimer -= elapsedRealTime;
	}

	// Toggle GUI.
	if (keyboard->isKeyDown(OIS::KC_G) && toggleTimer <= 0)
	{
		Ogre::Overlay* debugOverlay = Ogre::OverlayManager::getSingleton().
			getByName("Verve/TrialNumber");

		if (debugOverlay->isVisible())
        {
			debugOverlay->hide();
			mAgentDebugger->setDisplayEnabled(false);
		}
		else
		{
			debugOverlay->show();
			mAgentDebugger->setDisplayEnabled(true);
		}

		toggleTimer = 0.5;
	}
}
Ejemplo n.º 2
0
// create overlay uv test
void Test::createOverlay(void)
{
	// load the fade
	mFader = 0;
	Ogre::MaterialPtr		mFaderMaterial;
	Ogre::TextureUnitState 	*mTexture = 0;

	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();

	mFader = static_cast<Ogre::PanelOverlayElement*>(
		overlayManager.createOverlayElement("Panel", "Fader"));
	mFader->setMetricsMode(Ogre::GMM_RELATIVE);
	mFader->setPosition(0, 0);
	mFader->setDimensions(0.25f, 0.25f);
	mFader->setMaterialName("BotonTest"); // Optional background material

	// Ensures that the material exists
	mFader->setUV(0,0,0.5,1);

	// show the fade
	mFader->show();

	// Create an overlay, and add the panel
	Ogre::Overlay			*mOverlay = 0;
	mOverlay = overlayManager.create("FaderOverlay");
	mOverlay->add2D(mFader);
	mOverlay->show();
}
Ejemplo n.º 3
0
	// Create text area for SkyX parameters
	void createTextArea()
	{
		// Create a panel
		Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(
			OverlayManager::getSingleton().createOverlayElement("Panel", "SkyXParametersPanel"));
		panel->setMetricsMode(Ogre::GMM_PIXELS);
		panel->setPosition(10, 10);
		panel->setDimensions(400, 400);

		// Create a text area
		mTextArea = static_cast<Ogre::TextAreaOverlayElement*>(
			OverlayManager::getSingleton().createOverlayElement("TextArea", "SkyXParametersTextArea"));
		mTextArea->setMetricsMode(Ogre::GMM_PIXELS);
		mTextArea->setPosition(0, 0);
		mTextArea->setDimensions(100, 100);
		mTextArea->setCaption("SkyX plugin demo");
		mTextArea->setCharHeight(16);
		mTextArea->setFontName("BlueHighway");
		mTextArea->setColourBottom(ColourValue(0.3, 0.5, 0.3));
		mTextArea->setColourTop(ColourValue(0.5, 0.7, 0.5));

		// Create an overlay, and add the panel
		Ogre::Overlay* overlay = OverlayManager::getSingleton().create("OverlayName");
		overlay->add2D(panel);

		// Add the text area to the panel
		panel->addChild(mTextArea);

		// Show the overlay
		overlay->show();
	}
Ejemplo n.º 4
0
void FrameListener::showDebugOverlay(bool show) {
	Ogre::Overlay *overlay = Ogre::OverlayManager::getSingleton().getByName("Core/DebugOverlay");
	if (show)
		overlay->show();
	else
		overlay->hide();
}
Ejemplo n.º 5
0
 void setVisible(bool bShow) {
     if (bShow) {
         m_pOverlay->show();
     }
     else {
         m_pOverlay->hide();
     }
 }
Ejemplo n.º 6
0
void OgreApp::createScene()
{
	sceneMgr->setSkyBox(true, "Sky", 5, 8, 4000);
    sceneMgr->setAmbientLight(ColourValue(0.5f, 0.5f, 0.5f));
    sceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);

	node = sceneMgr->getRootSceneNode()->createChildSceneNode("OgreHead");
	ent = sceneMgr->createEntity("Ogre", "ogrehead.mesh");
	node->attachObject(ent);
	node->setPosition(0, 50, 0);

	OgreAL::Sound *bgSound = soundManager->createSound("5.1 Test", "6chan.ogg", true);
	bgSound->setGain(2);
	bgSound->setRelativeToListener(true);
	bgSound->play();

	node = sceneMgr->getRootSceneNode()->createChildSceneNode("CameraNode");
	node->setPosition(0, 100, 100);
	node = node->createChildSceneNode("PitchNode");
	node->attachObject(camera);
	node->attachObject(soundManager->getListener());
	node->pitch(Ogre::Degree(-30));

	// Create a ground plane
    Plane plane(Vector3::UNIT_Y, 0);
    MeshManager::getSingleton().createPlane("ground",
       ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
       15000,15000,20,20,true,1,5,5,Vector3::UNIT_Z);
    ent = sceneMgr->createEntity("GroundEntity", "ground");
    sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ent);
    ent->setMaterialName("Ground");
    ent->setCastShadows(false);

	light = sceneMgr->createLight("sun");
	light->setType(Light::LT_DIRECTIONAL);
	light->setDirection(-1,-1,-1);

	OverlayManager& overlayMgr = OverlayManager::getSingleton();
	Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(
	   overlayMgr.createOverlayElement("Panel", "PanelName"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setPosition(10, 10);
	panel->setDimensions(100, 100);

	TextAreaOverlayElement* textArea = static_cast<TextAreaOverlayElement*>(
	   overlayMgr.createOverlayElement("TextArea", "TextAreaName"));
	textArea->setMetricsMode(Ogre::GMM_PIXELS);
	textArea->setPosition(0, 0);
	textArea->setDimensions(100, 100);
	textArea->setCharHeight(16);
	textArea->setFontName("Arial");
	textArea->setCaption("Hello, World!");

	Ogre::Overlay* overlay = overlayMgr.create("AverageFps");
	overlay->add2D(panel);
	panel->addChild(textArea);
	overlay->show();
}
Ejemplo n.º 7
0
void Menu::showDialogue(const std::string& first, const std::vector<std::string>& options)
{
  Ogre::OverlayManager& om = Ogre::OverlayManager::getSingleton();
  std::cout << "getByName(overlay)\n";
  Ogre::Overlay* dialOverlay = om.getByName(cDialogueOverlay);
  if (dialOverlay == NULL)
  {
    std::cout << "create(overlay)\n";
    dialOverlay = om.create(cDialogueOverlay);
  }
  Ogre::OverlayContainer* dialCont = NULL;
  std::cout << "getOE(Box)\n";
  dialCont = static_cast<Ogre::OverlayContainer*> (om.getOverlayElement(cDialogueOverlay+"/Box"));
  if (dialCont == NULL)
  {
    std::cout << "createOE(Box)\n";
    dialCont = static_cast<Ogre::OverlayContainer*>
                    (om.createOverlayElement("Panel", cDialogueOverlay+"/Box"));
    dialCont->setPosition(0.0, 0.75);
    dialCont->setDimensions(1.0, 0.25);
    dialCont->setMaterialName("Dusk/Dialogue/Black");
  }
  std::cout << "getOE(Box/First)\n";
  Ogre::OverlayElement* dialElem;
  dialElem = om.getOverlayElement(cDialogueOverlay+"/Box/First");
  if (dialElem==NULL)
  {
    std::cout << "createOE(Box/First)\n";
    dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/First");
    dialElem->setDimensions(1.0, 0.0625);
    dialElem->setPosition(0.0, 0.0);
    dialElem->setMaterialName("Dusk/Dialogue/Element");
    dialCont->addChild(dialElem);
  }
  dialElem->setCaption(first);
  dialElem->show();
  unsigned int elemCount = options.size();
  if (elemCount > cMaxDialogueOptions)
  {
    elemCount = cMaxDialogueOptions;
  }

  killDialogueOverlayLines();
  unsigned int i;
  const float elemHeight = 0.8/(float)elemCount;
  for (i=0; i<elemCount; i=i+1)
  {
    //dialElem = om.createOverlayElement("TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
    dialElem = om.createOverlayElementFromTemplate(cDialogueOverlay+"/LineTemplate", "TextArea", cDialogueOverlay+"/Box/Line"+IntToString(i));
    dialElem->setPosition(0.1, dialCont->getHeight()*(0.2+i*elemHeight));
    dialElem->setDimensions(0.8, elemHeight*dialCont->getHeight());
    dialElem->setCaption(IntToString(i+1)+": "+options[i]);
    dialElem->show();
    dialCont->addChild(dialElem);
    m_DialogueLineCount = i+1;
  }//for
  dialOverlay->show();
}
Ejemplo n.º 8
0
void cStateEndRun::Init(){
	printf("cStateMenu: Init\n");
	MenuSet[0] = "MenuOpt1";
	MenuSet[1] = "MenuOpt2";
	MenuSet[2] = "MenuOpt3";
	MenuSet[3] = "MenuOpt4";
	MenuSet[4] = "MenuOpt5";

	m_pOverlayMgr = Ogre::OverlayManager::getSingletonPtr();

	//m_pProgLPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ProgLPanel"));
	//m_pProgLPanel->setMetricsMode(Ogre::GMM_PIXELS);
	//m_pProgLPanel->setPosition(10, 10);
	//m_pProgLPanel->setDimensions(32, 32);
	//m_pProgLPanel->setMaterialName( "Programs/Crash" );
	//m_pProgRPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ProgRPanel"));
	//m_pProgRPanel->setMetricsMode(Ogre::GMM_PIXELS);
	//m_pProgRPanel->setPosition(900, 10);
	//m_pProgRPanel->setDimensions(32, 32);
	//m_pProgRPanel->setMaterialName( "Programs/Validate" );

	m_pMenuPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","MenuP"));
	m_pMenuPanel->setMetricsMode(Ogre::GMM_PIXELS);
	m_pMenuPanel->setPosition(400, 200);
	m_pMenuPanel->setDimensions(200, 200);
	m_pMenuPanel->setMaterialName( "BaseWhite" );
	TextRenderer::getSingleton().addLTextBox( MenuSet[0], "MenuP", "Controls", 10, 10, 100, 40, Ogre::ColourValue::Red);
	TextRenderer::getSingleton().addLTextBox( MenuSet[1], "MenuP", "Video", 10, 50, 100, 40, Ogre::ColourValue::Black);
	TextRenderer::getSingleton().addLTextBox( MenuSet[2], "MenuP", "Audio", 10, 90, 100, 40, Ogre::ColourValue::Black);
	TextRenderer::getSingleton().addLTextBox( MenuSet[3], "MenuP", "OPP", 10, 130, 100, 40, Ogre::ColourValue::Black);
	TextRenderer::getSingleton().addLTextBox( MenuSet[4], "MenuP", "About", 10, 170, 100, 40, Ogre::ColourValue::Black);

	m_pDeckPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","DeckP"));
	m_pDeckPanel->setMetricsMode(Ogre::GMM_PIXELS);
	m_pDeckPanel->setPosition(500, 300);
	m_pDeckPanel->setDimensions(400, 400);
	m_pDeckPanel->setMaterialName( "BaseWhite" );

	m_pActionPanel = static_cast<Ogre::OverlayContainer*>(m_pOverlayMgr->createOverlayElement("Panel","ActionP"));
	m_pActionPanel->setMetricsMode(Ogre::GMM_PIXELS);
	m_pActionPanel->setPosition(300, 200);
	m_pActionPanel->setDimensions(200, 400);
	m_pActionPanel->setMaterialName( "BaseWhite" );

	Ogre::Overlay* overlay = m_pOverlayMgr->getByName("overlay1");
	overlay->add2D(m_pMenuPanel);
	overlay->add2D(m_pDeckPanel);
	overlay->add2D(m_pActionPanel);

	if(m_pMenuPanel->isVisible() == true) m_pMenuPanel->hide();
	if(m_pDeckPanel->isVisible() == true) m_pDeckPanel->hide();
	if(m_pActionPanel->isVisible() == true) m_pActionPanel->hide();

	//m_pMainPanel->addChild(m_pProgLPanel);
	//m_pMainPanel->addChild(m_pProgRPanel);
	//TextRenderer::getSingleton().addTextBox("txtGreeting", "container1", "Hello", 10, 10, 100, 20, Ogre::ColourValue::Green);
}
Ejemplo n.º 9
0
void MenuState::createOverlay()
{
	unsigned int width, height, depth;
	int left, top;

	Ogre::Overlay *overlay = _overlayManager->getByName("Menu");
	_root->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top);

	overlay->setScale(((float(width) / 100) / 1024) * 100, ((float(height) / 100) / 768) * 100);
	overlay->show();
//	_fader->startFadeIn(0);
}
Ejemplo n.º 10
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();
  }
}
Ejemplo n.º 11
0
void MenuState::exit ()
{
//	delete _fader;
	// musica del menu STOP
	IntroState::getSingleton().getMenuTrackPtr()->stop();

	CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().hide();
	CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->hide();
	Ogre::Overlay *overlay = _overlayManager->getByName("Menu");
	overlay->hide();
	_sceneMgr->clearScene();
	_root->getAutoCreatedWindow()->removeAllViewports();
}
void ResourceGroupReloader::updateOnEveryRenderable()
{

	//1/ get all the available object type (entity, light, user defined types ...)
	std::vector<std::string> allAvailableTypes; 
	Ogre::Root::MovableObjectFactoryIterator iterFactory = Ogre::Root::getSingleton().getMovableObjectFactoryIterator();
	for(;iterFactory.hasMoreElements();)
	{
		Ogre::MovableObjectFactory* factory = iterFactory.getNext();
		allAvailableTypes.push_back(factory->getType());
	}

	UpdateMaterialRenderableVisitor lRenderableVisitor;

	//2/ for each scene manager, lets visit renderables!
	// unfortunately that does not cover all renderables type... (overlays...)
	Ogre::SceneManagerEnumerator::SceneManagerIterator iterSceneManager = Ogre::Root::getSingleton().getSceneManagerIterator();
	for(;iterSceneManager.hasMoreElements();)
	{
		Ogre::SceneManager * scMgr = iterSceneManager.getNext();

		std::vector<std::string>::iterator iterMovableType = allAvailableTypes.begin();
		std::vector<std::string>::iterator iterMovableTypeEnd = allAvailableTypes.end();
		for(;iterMovableType!=iterMovableTypeEnd;iterMovableType++)
		{
			Ogre::SceneManager::MovableObjectIterator iterMovable = scMgr->getMovableObjectIterator(*iterMovableType);
			for(;iterMovable.hasMoreElements();)
			{
				Ogre::MovableObject * movable = iterMovable.getNext();
				movable->visitRenderables(&lRenderableVisitor,false);
			}
		}
	}

	// 3 / visit overlays!
	{
		Ogre::OverlayManager::OverlayMapIterator iterOverlay = Ogre::OverlayManager::getSingleton().getOverlayIterator();
		for(;iterOverlay.hasMoreElements();)
		{
			Ogre::Overlay* lOverlay = iterOverlay.getNext();
			// get the first level of OverlayContainer in the Overlay
			Ogre::Overlay::Overlay2DElementsIterator iterOverlayElem = lOverlay->get2DElementsIterator();
			for(;iterOverlayElem.hasMoreElements();)
			{
				Ogre::OverlayContainer * lOverlayCont = iterOverlayElem.getNext();
				visitRecursivelyRenderablesFrom(lOverlayCont,lRenderableVisitor, false);
			}
		}
	}
}
Ejemplo n.º 13
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();


}
Ejemplo n.º 14
0
    void fade(Ogre::Real tpf) {
        if (m_eFadeOperation != FADE_NONE && m_pTextUnitState) {
            m_pTextUnitState->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_TEXTURE, m_fAlpha);

            if (m_eFadeOperation == FADE_IN) {
                m_fCurrentDuration -= tpf;
                m_fAlpha = m_fCurrentDuration / m_fTotalDuration;
                if (m_fAlpha < 0.0) {
                    m_pOverlay->hide();
                    m_eFadeOperation = FADE_NONE;
                    if (m_pFaderCallback) {
                        m_pFaderCallback->fadeInCallback();
                    }
                }
            }
            else if (m_eFadeOperation == FADE_OUT) {
                m_fCurrentDuration += tpf;
                m_fAlpha = m_fCurrentDuration / m_fTotalDuration;
                if (m_fAlpha > 1.0) {
                    m_eFadeOperation = FADE_NONE;
                    if (m_pFaderCallback) {
                        m_pFaderCallback->fadeOutCallback();
                    }
                }
            }
        }
#ifdef USE_SPRITE_SHADER
        m_SpritePixelShaderParameters->setNamedConstant("colour", Ogre::ColourValue(1, 1, 1, m_fAlpha));
#endif
    }
Ejemplo n.º 15
0
    void startFadeIn(Ogre::Real fDuration) {
        if (fDuration < 0) fDuration = -fDuration;

        m_fAlpha = 1.0;
        m_fTotalDuration = fDuration;
        m_fCurrentDuration = fDuration;
        m_eFadeOperation = FADE_IN;
        m_pOverlay->show();
    }
Ejemplo n.º 16
0
void BasisManager::createInput() // создаем систему ввода
{
	Ogre::LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
	OIS::ParamList pl;
	size_t windowHnd = 0;
	std::ostringstream windowHndStr;

	mWindow->getCustomAttribute("WINDOW", &windowHnd);
	windowHndStr << windowHnd;
	pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));

	mInputManager = OIS::InputManager::createInputSystem( pl );

	mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject( OIS::OISKeyboard, true ));
	mKeyboard->setEventCallback(this);


	mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject( OIS::OISMouse, true ));
	mMouse->setEventCallback(this);

	mRoot->addFrameListener(this);

	windowResized(mWindow); // инициализация

	Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

	Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().getByName("wallpaper");
	if (false == material.isNull()) {
		Ogre::OverlayManager & manager = Ogre::OverlayManager::getSingleton();
		Ogre::Overlay * overlay = manager.create("wallpaper");
		overlay->setZOrder(0);
		overlay->show();
		Ogre::PanelOverlayElement * panel = static_cast<Ogre::PanelOverlayElement*>(manager.createOverlayElement("Panel", "wallpaper"));
		panel->setDimensions(1, 1);
		/*Ogre::FontPtr mpFont = Ogre::FontManager::getSingleton().getByName("MyGUI_font");
		mpFont->load();
		if (!mpFont.isNull()) {
			const Ogre::MaterialPtr & material2 = mpFont->getMaterial();
			panel->setMaterialName(material2->getName());
		}*/
		panel->setMaterialName(material->getName());
		overlay->add2D(panel);
	}
}
Ejemplo n.º 17
0
void Game::initRendering()
{
#ifdef _DEBUG
    const char* plugin_file = "plugins_d.cfg";
#else
    const char* plugin_file = "plugins.cfg";
#endif

    m_ogreRoot = new Ogre::Root(plugin_file);
    m_ogreRoot->showConfigDialog();
    m_ogreRoot->initialise(true);

    m_renderWindow = m_ogreRoot->getAutoCreatedWindow(); //createRenderWindow("mkdemo", 800, 600, false);

    m_ogreSceneMgr = m_ogreRoot->createSceneManager(Ogre::ST_GENERIC);
    m_ogreCamera = m_ogreSceneMgr->createCamera("main_cam");
    Ogre::Viewport* viewport = m_renderWindow->addViewport(m_ogreCamera);
    m_ogreCamera->setAspectRatio(viewport->getActualWidth() / (float)viewport->getActualHeight());

    // DebugDrawer singleton
    new DebugDrawer(m_ogreSceneMgr, .75f);

    loadOgreResources();

    // overlay
    Ogre::Overlay* hud = Ogre::OverlayManager::getSingleton().getByName("Game/HUD");
    hud->show();

    if (m_disableShadows)
        m_ogreSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_NONE);
    else
        m_ogreSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
    m_ogreCamera->setNearClipDistance(0.1f);

    if (!m_startWithFreelook)
        m_playerCam = new CameraTPP(m_ogreCamera, NULL);
    else
        m_playerCam = new CameraFPP(m_ogreCamera, NULL);

    m_ogreSceneMgr->setAmbientLight(Ogre::ColourValue(0.3f, 0.3f, 0.3f)); // please note it's usually changed on level deserialization with RenderSettingsSetter
}
Ejemplo n.º 18
0
void OgreAppLogic::createCanvasOverlay()
{
	//create Texture
	mTexture = new Ogre::Canvas::Texture("Canvas", 640, 480, true, 0);

	//create Material
	mTexture->createMaterial();

	//create Overlay
	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
	Ogre::Overlay* overlay = overlayManager.create("Canvas/Overlay");

	mPanel = static_cast<Ogre::PanelOverlayElement*>(overlayManager.createOverlayElement("Panel", "Canvas/Panel"));
	mPanel->setMetricsMode(Ogre::GMM_PIXELS);
	mPanel->setMaterialName("Canvas");
	mPanel->setDimensions(640, 480);
	mPanel->setPosition(0, 0);
	overlay->add2D(mPanel);

	overlay->show();
}
Ejemplo n.º 19
0
void OgreAppLogic::createCanvasOverlay()
{
	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
	Ogre::Overlay* overlay = overlayManager.create("Canvas/Overlay");

	Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*>(overlayManager.createOverlayElement("Panel", "CanvasClock1/Panel"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setMaterialName("CanvasClock1");
	panel->setDimensions(150.0f, 150.0f);
	panel->setPosition(0, 0);
	overlay->add2D(panel);

	panel = static_cast<Ogre::PanelOverlayElement*>(overlayManager.createOverlayElement("Panel", "CanvasClock2/Panel"));
	panel->setMetricsMode(Ogre::GMM_PIXELS);
	panel->setMaterialName("CanvasClock2");
	panel->setDimensions(150.0f, 150.0f);
	panel->setPosition(mApplication->getRenderWindow()->getWidth()-150.0f, 0);
	overlay->add2D(panel);

	overlay->show();
}
Ejemplo n.º 20
0
void SalamancerApplication::createBrowser(){
    Ogre::TexturePtr renderTexture = Ogre::TextureManager::getSingleton().createManual(
                "texture",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                Ogre::TEX_TYPE_2D, mWindow->getWidth(), mWindow->getHeight(), 0, Ogre::PF_A8R8G8B8, Ogre::TU_WRITE_ONLY);

    Ogre::MaterialPtr material = Ogre::MaterialManager::getSingletonPtr()->create("BrowserMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    material->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_CLOCKWISE); // print both sides of the polygones
    material->getTechnique(0)->getPass(0)->createTextureUnitState("texture");
    material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
    material->getTechnique(0)->getPass(0)->setLightingEnabled(false);
    
    Ogre::Overlay *overlay = Ogre::OverlayManager::getSingletonPtr()->create("BrowserOverlay");
    Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(Ogre::OverlayManager::getSingletonPtr()->createOverlayElement("Panel", "BrowserPanel"));
    
    panel->setPosition(0.0, 0.0);
    panel->setDimensions(1.0, 1.0);
    panel->setMaterialName("BrowserMaterial");
    overlay->add2D(panel);
    
    overlay->show();
    
    this->windowInfo.SetAsWindowless(0, true);
    
    this->clientHandler = new ClientHandler(renderTexture, this->mRoot->getAutoCreatedWindow(), mMouse, this->mCamera, this->mSceneMgr, this->world, this->context);
    
    browserSettings.web_security = STATE_DISABLED;
    
    this->browser = CefBrowserHost::CreateBrowserSync(windowInfo, this->clientHandler.get(),
            "file:///home/nathan/Projects/salamancer/dist/bin/hud/index.html",
            browserSettings, 
            NULL);
    
    this->clientHandler->SetBrowser(this->browser);
    
    mRoot->addFrameListener(this->clientHandler.get());
    
}
Ejemplo n.º 21
0
    void init() {
        Ogre::MaterialPtr matptr = Ogre::MaterialManager::getSingleton().getByName("FadeMaterial");
#ifdef USE_SPRITE_SHADER
        CShaderManager::getSingleton().addAlphaBlendTextureShader(matptr);
        Ogre::Pass *pPass = matptr->getTechnique(0)->getPass(0);
        m_SpritePixelShaderParameters = pPass->getFragmentProgram()->createParameters();
        m_SpriteVertexShaderParameters = pPass->getVertexProgram()->createParameters();
        pPass->setFragmentProgramParameters(m_SpritePixelShaderParameters);
        pPass->setVertexProgramParameters(m_SpriteVertexShaderParameters);
#endif
        m_pTextUnitState = matptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
        m_pOverlay = Ogre::OverlayManager::getSingleton().getByName("FadeOverlay");
        m_pOverlay->hide();
    }
Ejemplo n.º 22
0
    void OgreEngine::initOverlay() {

        Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
        Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "PanelName"));
            panel->setMetricsMode(Ogre::GMM_PIXELS);
            panel->setPosition(10, 10);
            panel->setDimensions(100, 100);

            Ogre::TextAreaOverlayElement* textArea = static_cast<Ogre::TextAreaOverlayElement*>(
            overlayManager.createOverlayElement("TextArea", "worldName"));
            textArea->setMetricsMode(Ogre::GMM_PIXELS);
            textArea->setPosition(10, 10);
            textArea->setDimensions(100, 200);
            textArea->setFontName("StarWars");
            //textArea->setCaption(this->data["name"].toString().toStdString());
            textArea->setCharHeight(16);
            textArea->setColourBottom(Ogre::ColourValue(1, 1, 1));
            textArea->setColourTop(Ogre::ColourValue(1, 1, 1));

            Ogre::TextAreaOverlayElement* textArea2 = static_cast<Ogre::TextAreaOverlayElement*>(
            overlayManager.createOverlayElement("TextArea", "timeArea"));
            textArea2->setMetricsMode(Ogre::GMM_PIXELS);
            textArea2->setPosition(10, 30);
            textArea2->setDimensions(100, 200);
            textArea2->setFontName("StarWars");
            textArea2->setCaption("0min 0sec");
            textArea2->setCharHeight(16);
            textArea2->setColourBottom(Ogre::ColourValue(1, 1, 1));
            textArea2->setColourTop(Ogre::ColourValue(1, 1, 1));

            Ogre::Overlay* overlay = overlayManager.create("OverlayName");
            overlay->add2D(panel);
            panel->addChild(textArea);
            panel->addChild(textArea2);
            overlay->show();
    }
Ejemplo n.º 23
0
void OverlayMask::preViewportUpdate(const Ogre::RenderTargetViewportEvent &event)
{
    if(event.source == mViewport)
    {
        Ogre::OverlayManager &overlayMgr = Ogre::OverlayManager::getSingleton();
        for(Ogre::OverlayManager::OverlayMapIterator iter = overlayMgr.getOverlayIterator();
                iter.hasMoreElements();)
        {
            Ogre::Overlay* item = iter.getNext();
            for(Ogre::Overlay::Overlay2DElementsIterator it = item->get2DElementsIterator();
                    it.hasMoreElements();)
            {
                Ogre::OverlayContainer* container = it.getNext();
                if(container) container->hide();
            }
        }

        std::map<CSMWorld::CellCoordinates, TextOverlay *>::iterator it = mTextOverlays.begin();
        for(; it != mTextOverlays.end(); ++it)
        {
            it->second->show(true);
        }
    }
}
Ejemplo n.º 24
0
  CAlphaFader(CFaderCallback *pCallback = NULL)
    :
    m_fAlpha(0),
    m_fCurrentDuration(0),
    m_fTotalDuration(0),
    m_pFaderCallback(pCallback),
    m_eFadeOperation(FADE_NONE) {
    Ogre::MaterialPtr matptr = Ogre::MaterialManager::getSingleton().getByName("FadeMaterial");
#ifdef USE_SPRITE_SHADER
    CShaderManager::getSingleton().addAlphaBlendTextureShader(matptr);
    Ogre::Pass *pPass = matptr->getTechnique(0)->getPass(0);
    m_SpritePixelShaderParameters = pPass->getFragmentProgram()->createParameters();
    m_SpriteVertexShaderParameters = pPass->getVertexProgram()->createParameters();
    pPass->setFragmentProgramParameters(m_SpritePixelShaderParameters);
    pPass->setVertexProgramParameters(m_SpriteVertexShaderParameters);
#endif
    m_pTextUnitState = matptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
    m_pOverlay = Ogre::OverlayManager::getSingleton().getByName("FadeOverlay");
    m_pOverlay->hide();
  }
Ejemplo n.º 25
0
	void PlaypenApp::createScene()
	{
		// Setup shadows.
		if (mUseShadows)
		{
			mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
		}
		else
		{
			mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE);
		}

		//mSceneMgr->showBoundingBoxes(true);
		//mSimulator->setStepSize(0.02);
		mSimulator->setGravity(opal::Vec3r(0, -30, 0));

		// Set the ambient light level.
		mSceneMgr->setAmbientLight(ColourValue(0.3, 0.3, 0.3));

		// Create a light source.
		Ogre::Light* light = mSceneMgr->createLight("light0");
		light->setType(Ogre::Light::LT_POINT);
		light->setDiffuseColour(0.5, 0.5, 0.5);
		light->setSpecularColour(0.5, 0.5, 0.5);
		light->setPosition(100.0, 300.0, 100.0);

		// Create another light source.
		light = mSceneMgr->createLight("light1");
		light->setType(Ogre::Light::LT_POINT);
		light->setDiffuseColour(0.5, 0.5, 0.5);
		light->setSpecularColour(0.5, 0.5, 0.5);
		light->setPosition(-100.0, 300.0, 100.0);
		light->setVisible(false);

		// Setup the initial camera position.
		mPhysicalCamera->setPosition(opal::Point3r(0, 20, 30));
		mPhysicalCamera->lookAt(opal::Point3r(0, 0, 0));

		// Create a skybox.
		mSceneMgr->setSkyBox(true, "Skyboxes/Gray", 5000);

		// Make a sphere used to show the grasp position.
		Ogre::SceneNode* sphereNode = mSceneMgr->getRootSceneNode()->
			createChildSceneNode("pickingSphere0");
		sphereNode->scale(0.3, 0.3, 0.3);
		Entity* sphereEntity = mSceneMgr->createEntity("pickingSphere", 
			"sphere.mesh");
		sphereEntity->setMaterialName("Unlit/Yellow");
		sphereEntity->setCastShadows(false);
		sphereEntity->setVisible(false);
		sphereNode->attachObject(sphereEntity);

		// Make a "line" (scaled cylinder) to show the grasping spring.
		Ogre::SceneNode* lineNode = mSceneMgr->getRootSceneNode()->
			createChildSceneNode("springLine");
		Entity* lineEntity = mSceneMgr->createEntity("springLine", 
			"cylinder.mesh");
		lineEntity->setMaterialName("Unlit/White");
		lineEntity->setCastShadows(false);
		lineEntity->setVisible(false);
		lineNode->attachObject(lineEntity);

		// Make a crosshairs for picking.
		Ogre::Overlay* overlay = 
			OverlayManager::getSingleton().getByName("General/Crosshair");
		overlay->show();

		// Load models, create physical objects, etc. here.

		setupInitialPhysicalEntities();
	}
Ejemplo n.º 26
0
void MyApp::createOverlay() {
  _overlayManager = Ogre::OverlayManager::getSingletonPtr();
  Ogre::Overlay *overlay = _overlayManager->getByName("Info");
  overlay->show();
}
Ejemplo n.º 27
0
void test()
{
	Ogre::Root* pOgre = new Ogre::Root("", "");

    pOgre->loadPlugin(RENDER_SYSTEM);
	pOgre->setRenderSystem(pOgre->getAvailableRenderers().front());

	pOgre->initialise(false);
	
	Ogre::NameValuePairList lArgs;
	//lArgs["externalWindowHandle"] = bk::format("%d", (bk::uint)l_window.get_handle()).astr;
	Ogre::RenderWindow* pWindow = pOgre->createRenderWindow("Heart|Dockyard", 1024, 768, false, &lArgs);

	Ogre::SceneManager* pSceneManager = pOgre->createSceneManager(Ogre::ST_GENERIC,"SceneManager");
	pSceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
	pSceneManager->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(new Ogre::FocusedShadowCameraSetup()));
	pSceneManager->setAmbientLight(Ogre::ColourValue(0.1f, 0.1f, 0.1f));

	Ogre::Camera* pCamera = pSceneManager->createCamera("Camera");
	pCamera->setFixedYawAxis(true, Ogre::Vector3::UNIT_Z);
	pCamera->setPosition(Ogre::Vector3(0.0f, 50.0f, 20.0f));
	pCamera->lookAt(Ogre::Vector3(0.0f, 0.0f, 0.0f)); 
	pCamera->setNearClipDistance(0.1f);
	pCamera->setFarClipDistance(100.0f);
	Ogre::Viewport* pViewport = pWindow->addViewport(pCamera);
	pViewport->setBackgroundColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f));
	pCamera->setAspectRatio(Ogre::Real(pViewport->getActualWidth()) / Ogre::Real(pViewport->getActualHeight()));

	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../data/dockyard.zip", "Zip", "Dockyard", true);
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	Ogre::MeshManager::getSingleton().createPlane("GroundPlane", "Dockyard", Ogre::Plane(0.0f, 0.0f, 1.0f, 0.0f), 100.0f, 100.0f, 100, 100, true, 1, 3.0f, 3.0f);
	Ogre::Entity* pGroundEntity = pSceneManager->createEntity("GroundPlane");
	pGroundEntity->setMaterialName("Examples/Rockwall");
	pGroundEntity->setCastShadows(false);
	pGroundEntity->getSubEntity(0)->getMaterial()->setShadingMode(Ogre::SO_PHONG);
	Ogre::SceneNode* pGroundNode = pSceneManager->getRootSceneNode()->createChildSceneNode();
	pGroundNode->attachObject(pGroundEntity);

	Ogre::Entity* pCubeEntity = pSceneManager->createEntity("Cube", Ogre::SceneManager::PT_CUBE);
	pCubeEntity->setMaterialName("Examples/10PointBlock");
	pCubeEntity->setCastShadows(true);
	Ogre::SceneNode* pCubeNode = pSceneManager->getRootSceneNode()->createChildSceneNode();
	pCubeNode->attachObject(pCubeEntity);
	pCubeNode->setPosition(0.0f, 0.0f, 5.f);
	pCubeNode->setScale(0.1f, 0.1f, 0.1f);

	Ogre::ColourValue lColour1(1.0f, 1.0f, 1.0f);
	Ogre::ColourValue lColour2(1.0f, 1.0f, 1.0f);
	Ogre::ColourValue lColour3(1.0f, 1.0f, 1.0f);
	Ogre::Light* pLight1 = pSceneManager->createLight();
	pLight1->setType(Ogre::Light::LT_SPOTLIGHT);
	pLight1->setPosition(30.0f, 30.0f, 30.0f);
	pLight1->setDirection(-1.0f, -1.0f, -1.0f);
	pLight1->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
	pLight1->setDiffuseColour(lColour1 * 0.5f);
	Ogre::Light* pLight2 = pSceneManager->createLight();
	pLight2->setType(Ogre::Light::LT_SPOTLIGHT);
	pLight2->setPosition(-30.0f, 30.0f, 30.0f);
	pLight2->setDirection(1.0f, -1.0f, -1.0f);
	pLight2->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
	pLight2->setDiffuseColour(lColour2 * 0.5f);
	Ogre::Light* pLight3 = pSceneManager->createLight();
	pLight3->setType(Ogre::Light::LT_SPOTLIGHT);
	pLight3->setPosition(30.0f, -30.0f, 30.0f);
	pLight3->setDirection(-1.0f, 1.0f, -1.0f);
	pLight3->setSpotlightRange(Ogre::Degree(30), Ogre::Degree(50));
	pLight3->setDiffuseColour(lColour3 * 0.5f);

	Ogre::Overlay* pMenuOverlay = Ogre::OverlayManager::getSingleton().create("Menu");
	Ogre::OverlayElement* pMenu = Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Menu");
    pMenu->setMetricsMode(Ogre::GMM_PIXELS);
    pMenu->setWidth(200);
    pMenu->setHeight(200);
    pMenu->setTop(30);
    pMenu->setLeft(30);
    pMenu->setMaterialName("Examples/BumpyMetal");
	if (pMenu->isContainer()) pMenuOverlay->add2D(static_cast<Ogre::OverlayContainer*>(pMenu));
	pMenuOverlay->show();

	pOgre->startRendering();
}
Ejemplo n.º 28
0
void handleInput(Ogre::Real elapsedRealTime)
{
	// This variable can be used to keep keys from repeating too fast.
	static Ogre::Real toggleTimer = 0;
	if (toggleTimer >= 0)
	{
		toggleTimer -= elapsedRealTime;
	}

	OIS::Keyboard* keyboard = gEngine.getKeyboard();

	if (keyboard->isKeyDown(OIS::KC_W))
	{
		gCar->forward();
	}
	else if (keyboard->isKeyDown(OIS::KC_S))
	{
		gCar->reverse();
	}
	else
	{
		gCar->idle();
	}

	if (keyboard->isKeyDown(OIS::KC_A))
	{
		gCar->setSteering(-1);
	}
	else if (keyboard->isKeyDown(OIS::KC_D))
	{
		gCar->setSteering(1);
	}
	else
	{
		gCar->setSteering(0);
	}

	// If available, get data from the game controller.
	if (gGamePad)
	{
		// Update the game controller state.
		SDL_JoystickUpdate();

		Ogre::Real joy0X = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 0) / 
			(Ogre::Real)32768;
		Ogre::Real joy0Y = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 1) / 
			(Ogre::Real)32768;
		Ogre::Real joy1X = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 4) / 
			(Ogre::Real)32768;
		Ogre::Real joy1Y = (Ogre::Real)SDL_JoystickGetAxis(gGamePad, 3) / 
			(Ogre::Real)32768;

		if (fabs(joy0Y) > 0.1)
		{
			gCar->setThrottle(-joy0Y);
		}
		else
		{
			gCar->idle();
		}

		if (fabs(joy0X) > 0.1)
		{
			gCar->setSteering(joy0X);
		}
		else
		{
			gCar->setSteering(0);
		}

		if (joy1X > 0.2 || joy1X < -0.2)
		{
			Ogre::Degree rotAroundY = -Ogre::Degree(joy1X);
			gEngine.getCamera()->yawRelative(rotAroundY.valueDegrees());
		}

		if (joy1Y > 0.2 || joy1Y < -0.2)
		{
			Ogre::Degree rotAroundX = -Ogre::Degree(joy1Y);
			gEngine.getCamera()->pitchRelative(rotAroundX.valueDegrees());
		}
	}

	// Toggle GUI.
	if (keyboard->isKeyDown(OIS::KC_G) && toggleTimer <= 0)
	{
		Ogre::Overlay* debugOverlay = Ogre::OverlayManager::getSingleton().
			getByName("Verve/Debug");

		if (debugOverlay->isVisible())
        {
			debugOverlay->hide();
			gAgentDebugger->setDisplayEnabled(false);
		}
		else
		{
			debugOverlay->show();
			gAgentDebugger->setDisplayEnabled(true);
		}

		toggleTimer = 0.5;
	}
}
Ejemplo n.º 29
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;
}
Ejemplo n.º 30
0
void Menu::showQuestLog(const bool visible)
{
  Ogre::OverlayManager* om = Ogre::OverlayManager::getSingletonPtr();
  if (om==NULL) return;
  //Do we actually need to do something?
  if (visible==isQuestLogVisible()) return;

  if (visible)
  {
    //show it
    // -- create basic overlay
    Ogre::Overlay* ol = om->create(cQuestLogOverlay);
    // -- create container - panel
    Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(
                 om->createOverlayElement("Panel", cQuestLogOverlay+"/Panel"));
    panel->setMetricsMode(Ogre::GMM_RELATIVE);
    panel->setPosition(0.0, 0.0);
    panel->setDimensions(1.0, 1.0);
    /*set material via panel->setMaterialName(...)?*/
    panel->setMaterialName("QuestLog/Transparency");
    //add panel to overlay
    ol->add2D(panel);

    //create elements
    // -- "vorwärts blättern"
    Ogre::TextAreaOverlayElement* text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
                         om->createOverlayElement("TextArea", cQuestLogOverlay+"/Plus"));
    text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
    text_elem->setPosition(0.125, 0.9);
    text_elem->setDimensions(0.25, 0.1);
    text_elem->setCaption("+ (Next)");
    text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
    text_elem->setFontName("Console");
    text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
    text_elem->setCharHeight(cQuestLogCharHeight);
    panel->addChild(text_elem);
    //-- "rückwärts blättern"
    text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
              om->createOverlayElement("TextArea", cQuestLogOverlay+"/Minus"));
    text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
    text_elem->setPosition(0.425, 0.9);
    text_elem->setDimensions(0.25, 0.1);
    text_elem->setCaption("- (Previous)");
    text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
    text_elem->setFontName("Console");
    text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
    text_elem->setCharHeight(cQuestLogCharHeight);
    panel->addChild(text_elem);

    //lists all entries that fit onto the page
    showQuestLogEntries();

    // -- page number
    text_elem = static_cast<Ogre::TextAreaOverlayElement*>(
              om->createOverlayElement("TextArea", cQuestLogOverlay+"/Page"));
    text_elem->setMetricsMode(Ogre::GMM_RELATIVE);
    text_elem->setPosition(0.725, 0.9);
    text_elem->setDimensions(0.25, 0.1);
    text_elem->setCaption("Page "+IntToString(m_QuestLogOffset/cQuestLogEntriesPerPage+1));
    text_elem->setAlignment(Ogre::TextAreaOverlayElement::Center);
    text_elem->setFontName("Console");
    text_elem->setColour(Ogre::ColourValue(1.0, 0.5, 0.0));
    text_elem->setCharHeight(cQuestLogCharHeight);
    panel->addChild(text_elem);

    //show the overlay
    ol->show();
  }//if visible
  else
  {
    //destroy all elements
    unsigned int i;
    // destroy entries
    for (i=0; i<m_QuestLogEntryCount; ++i)
    {
      om->destroyOverlayElement(cQuestLogOverlay+"/"+IntToString(i));
    }//for
    m_QuestLogEntryCount = 0;
    //destroy navigation elements
    om->destroyOverlayElement(cQuestLogOverlay+"/Plus");
    om->destroyOverlayElement(cQuestLogOverlay+"/Minus");
    om->destroyOverlayElement(cQuestLogOverlay+"/Page");
    //destroy panel
    om->destroyOverlayElement(cQuestLogOverlay+"/Panel");
    //destroy overlay
    om->destroy(cQuestLogOverlay);
  }//else
}//function