Exemple #1
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();
	}
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();
}
Exemple #3
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();
}
Exemple #4
0
//-------------------------------------------------------------------------------------
///Load all songs, initializes overlay and play first
	Sound::Sound(const char* path, int width, int height):volumeDiff(1),actualSongNumber(0),overlayIsShowed(false),durationOverlay(0),startVolume(5)
{
	volume = startVolume; //50%
	engine = irrklang::createIrrKlangDevice();
	
	struct dirent *entry;
	DIR *dp;

	dp = opendir(path);
	std::string stringName;

	if (dp == NULL) {
		perror("opendir: Path does not exist or could not be read.");
	}else{
		while ((entry = readdir(dp))){
			stringName = entry->d_name;
			if(!(!strcmp(".", stringName.c_str())||!strcmp("..",stringName.c_str()))){
				songNames.push_back(std::string(path)+ '/'+ entry->d_name);	
			}
		}
	}
	song = engine->play2D(songNames[0].c_str(), false, false, true);
	song->setVolume(volume);

	closedir(dp);
	
	//Event Listener
	song->setSoundStopEventReceiver(this);
	
	//overlay
	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton(); 

    //Create a panel 
    Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "MusicPanel")); 
    panel->setMetricsMode(Ogre::GMM_PIXELS); 
	panel->setDimensions(width*9/10, 50);
 
	panel->setLeft((width - panel->getWidth()) / 2);   
    panel->setMaterialName("Core/StatsBlockCenter"); // Optional background material 
   
    // Create a text area 
    musicTextArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "MusicTextArea")); 
    musicTextArea->setMetricsMode(Ogre::GMM_PIXELS); 
	musicTextArea->setTop(5);
	musicTextArea->setLeft((( panel->getWidth())) / 4);
	musicTextArea->setCharHeight(14);   
    musicTextArea->setFontName("StarWars"); 

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

    // Create an overlay, and add the panel 
    overlay = overlayManager.create("MusicBox"); 
    overlay->add2D((panel)); 

	actualSong();
}
	void DirectShowControl::createOverlay()
	{
		mOverlay = Ogre::OverlayManager::getSingleton().create(mName);

		Ogre::OverlayContainer *mContainer = (Ogre::OverlayContainer*)
			(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "Ogre/DebugTexPanel" +mName));

		mContainer->setMetricsMode(Ogre::GMM_PIXELS);
		mContainer->setDimensions(mVp->getActualWidth(),mVp->getActualHeight());
		mContainer->setMaterialName(mMaterial->getName());
		mOverlay->add2D(mContainer);
		mOverlay->show();
		PlayMovie();
	}
/**
 * @inheritDoc
 */
BrowserWindow::BrowserWindow() {
    m_texture = Ogre::TextureManager::getSingleton().createManual("HUDTexture", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
       Ogre::TEX_TYPE_2D, 500, 500, 0, Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC);

    Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("HUDMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    material->getTechnique(0)->getPass(0)->createTextureUnitState("HUDTexture");
    material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);

    Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();
    m_overlay = overlayManager.create("OverlayName");

    Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "PanelName"));
    panel->setPosition(0.0, 0.0);
    panel->setDimensions(1.0, 1.0);
    panel->setMaterialName("HUDMaterial");

    m_overlay->add2D(panel);
    m_overlay->show();
}
Exemple #7
0
void GameScreen::setUpOverlay(){
	// Load the Font
	FontManager &fontMgr = FontManager::getSingleton();
	ResourcePtr font = fontMgr.create("GameFont","General");
	font->setParameter("type","truetype");
	font->setParameter("source","Smirnof.ttf");
	font->setParameter("size","20");
	font->setParameter("resolution","96");
	font->load();

	// Load the overlay
	OverlayManager& overlayMgr = OverlayManager::getSingleton();
	Ogre::OverlayContainer* panel = static_cast<OverlayContainer*>(
    overlayMgr.createOverlayElement("Panel", "PanelName"));
	panel->_setPosition(0.05, 0.925);
	panel->setDimensions(300, 120);

	TextAreaOverlayElement* textArea = static_cast<TextAreaOverlayElement*>(
    overlayMgr.createOverlayElement("TextArea", "TextAreaName"));
	textArea->setMetricsMode(Ogre::GMM_PIXELS);
	textArea->setPosition(0, 0);
	textArea->setDimensions(300, 120);
	textArea->setCharHeight(24);
	textArea->setColour(ColourValue(1,1,0));
	// set the font name to the font resource that you just created.
	textArea->setFontName("GameFont");
	// say something

	std::stringstream ss;
	ss << "Score: " << score;

	textArea->setCaption(ss.str().c_str());

	overlay = overlayMgr.create("OverlayName");
	overlay->add2D(panel);

	panel->addChild(textArea);

}
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());
    
}
    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();
    }
void ViargoOgreKinectTrackingCalibrationMetaphor::_buildPattern() {
	// Horizontal and vertical offets
	float horizontalOffset = _offsets.x + _offsets.z;
	float verticalOffset   = _offsets.y + _offsets.w;

	// Step in horizontal and vertical direction
	double widthStep  = (1.0 - horizontalOffset) / (_patternSize  - 1);
	double heightStep = (1.0 - verticalOffset)   / (_patternSize - 1);

	// Clear old positions
	_screenPositions.clear();
	_screenPositions3D.clear();

	// Build new 2d screen positions
	for (int j = 0; j < _patternSize; j++) {
		for (int i = 0; i < _patternSize; i++) {
			double positionX = _offsets.x + i * widthStep;
			double positionY = _offsets.y + j * heightStep;

			// Add to list
			_screenPositions.push_back(cv::Point2d(positionX, positionY));
		}
	}

	// Transform 2d screen positions into world space relative to window center
	for (unsigned int i = 0; i < _screenPositions.size(); i++) {
		cv::Point3f worldPosition = cv::Point3f(0, 0, 0);

		// Scale to window size and correct position for [0,0] in window center
		worldPosition.x = _screenPositions[i].x * _windowSize.x - _windowSize.x / 2.0f;
		worldPosition.y = -(_screenPositions[i].y * _windowSize.y - _windowSize.y / 2.0f); // Flipped
		
		_screenPositions3D.push_back(worldPosition);
	}

	// Build pattern as overlays
	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();

	// Main overlay, specific overlay containers are inserted here
	_overlay = overlayManager.create("KinectTrackingCalibrationOverlay");
	_overlay->hide();

	_backgroundOverlayContainer = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", "KinectTrackingCalibrationBG"));
	_backgroundOverlayContainer->setPosition(0.0, 0.0);
	_backgroundOverlayContainer->setDimensions(1.0, 1.0);
	_backgroundOverlayContainer->setMaterialName("kinecttrackingCalibrationBlackMat");
	_backgroundOverlayContainer->hide();

	// Add background first
	_overlay->add2D(_backgroundOverlayContainer);

	char overlayName[100];

	// Build overlay for each marker
	for (unsigned int i = 0; i < _screenPositions.size(); i++) {
		Ogre::Vector2 screenPostion = Ogre::Vector2(_screenPositions[i].x, _screenPositions[i].y);

		sprintf(overlayName, "KinectTrackingCalibration_%d", i);

		Ogre::OverlayContainer* container = static_cast<Ogre::OverlayContainer*>(overlayManager.createOverlayElement("Panel", std::string(overlayName)));
		container->setPosition(screenPostion.x - _markerSize.x / (Ogre::Real)2.0, screenPostion.y - _markerSize.y / (Ogre::Real)2.0);
		container->setDimensions(_markerSize.x, _markerSize.y);
		container->setMaterialName("kinecttrackingCalibrationRedMat");
		container->hide();

		// Add overlay item
		_overlay->add2D(container);

		// Add to list
		_markers.push_back(container);
	}
}
Exemple #11
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
GameplayScreen::GameplayScreen()
{
	//Set up the 3D scene
	Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager");
	Ogre::Entity* stageEntity = mSceneManager->createEntity("Stage", "Stage.mesh");
	mStageNode = mSceneManager->getRootSceneNode()->createChildSceneNode("StageNode");
	mStageNode->attachObject(stageEntity);
	mStageNode->setPosition(0.0f, -6.0f, -6.5f);

	//Set up game objects
	mWhacker = new Whacker(mSceneManager, mSceneManager->getRootSceneNode());
	mWhacker->SetMovePlane(Ogre::Vector3(0.0f, 2.0f, 1.0f), Ogre::Vector3(0.0f, -0.5f, -6.5f), 3.8f, 3.0f);
	float dragonPositions[] = { -3.0f, -2.5f, -7.0f,
								-1.5f, -2.0f, -8.0f,
								-1.5f, -3.0f, -6.0f,
								0.0f, -2.5f, -7.0f,
								1.5f, -2.0f, -8.0f,
								1.5f, -3.0f, -6.0f,
								3.0f, -2.5f, -7.0f };
	mDragons = std::vector<Dragon*>();
	for (int i=0; i < 7; i++)
	{
		mDragons.push_back(new Dragon(mSceneManager, mSceneManager->getRootSceneNode()));
		mDragons[i]->SetPosition(Ogre::Vector3(dragonPositions[i*3], dragonPositions[(i*3)+1], dragonPositions[(i*3)+2]));
	}

	//Set up game variables
	timeBetweenPopups = 1.0f;
	timeSinceLastPopup = 0.0f;
	score = 0;
	numPeasants = 200;
	subtractPopTime = 0.05f;
	scorePerPopTimeSub = 15;
	minPopTime = 0.75f;
	mWhackerMoveScalar = 0.01f;

	//Lets set up our scoring overlay (Lots of uninteresting code :/ )
	//Fonts are loaded due to a resource loading bug in OGRE 1.8 http://www.ogre3d.org/forums/viewtopic.php?f=2&t=63652
	Ogre::FontManager::getSingleton().load( "YeOldShire", "General" );
	Ogre::FontManager::getSingleton().load( "DejaVuSans", "General" );
	//Title overlays
	Ogre::OverlayManager* overlayMgr = Ogre::OverlayManager::getSingletonPtr();
	mOverlay = overlayMgr->create("GameStats");
	Ogre::OverlayContainer* newContainer = static_cast<Ogre::OverlayContainer*>(overlayMgr->createOverlayElement("Panel", "StatsTitleContainer")); //Breaks Here
	newContainer->setMetricsMode(Ogre::GMM_RELATIVE);
    newContainer->setDimensions(0.4f, 0.15f);
    newContainer->setPosition(0.5f, 0.75f);
	newContainer->setHorizontalAlignment(Ogre::GHA_LEFT);
	Ogre::TextAreaOverlayElement* newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "ScoreTitleText"));
	newElement->setCaption("Score");
	newElement->setFontName("YeOldShire");
	newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
	newElement->setAlignment(Ogre::TextAreaOverlayElement::Right);
	newElement->setVerticalAlignment(Ogre::GVA_TOP);
	newElement->setMetricsMode(Ogre::GMM_RELATIVE);
    newElement->setPosition(0, 0);
    newElement->setDimensions(0.4f, 0.4f);
    newElement->setCharHeight(0.028f);
	newContainer->addChild(newElement);
	newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "PeasantsTitleText"));
	newElement->setCaption("Peasants Left");
	newElement->setFontName("YeOldShire");
	newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
	newElement->setAlignment(Ogre::TextAreaOverlayElement::Right);
	newElement->setVerticalAlignment(Ogre::GVA_BOTTOM);
	newElement->setMetricsMode(Ogre::GMM_RELATIVE);
    newElement->setPosition(0, 0);
    newElement->setDimensions(0.4f, 0.4f);
    newElement->setCharHeight(0.028f);
	newContainer->addChild(newElement);
	mOverlay->add2D(newContainer);
	//Value Overlays
	newContainer = static_cast<Ogre::OverlayContainer*>(overlayMgr->createOverlayElement("Panel", "StatsValueContainer"));
	newContainer->setMetricsMode(Ogre::GMM_RELATIVE);
    newContainer->setDimensions(0.4f, 0.15f);
    newContainer->setPosition(0.5f, 0.75f);
	newContainer->setHorizontalAlignment(Ogre::GHA_LEFT);
	newContainer->setColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f, 0.3f));
	newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "ScoreValueText"));
	Ogre::String num_str = Ogre::StringConverter::toString(score);
	newElement->setCaption(":"+num_str);
	newElement->setFontName("DejaVuSans");
	newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
	newElement->setAlignment(Ogre::TextAreaOverlayElement::Left);
	newElement->setVerticalAlignment(Ogre::GVA_TOP);
	newElement->setMetricsMode(Ogre::GMM_RELATIVE);
    newElement->setPosition(0, 0);
    newElement->setDimensions(0.4f, 0.4f);
    newElement->setCharHeight(0.045f);
	mScoreText = newElement;
	newContainer->addChild(newElement);
	newElement = static_cast<Ogre::TextAreaOverlayElement*>(overlayMgr->createOverlayElement("TextArea", "PeasantsValueText"));
	num_str = Ogre::StringConverter::toString(numPeasants);
	newElement->setCaption(":"+num_str);
	newElement->setFontName("DejaVuSans");
	newElement->setColour(Ogre::ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
	newElement->setAlignment(Ogre::TextAreaOverlayElement::Left);
	newElement->setVerticalAlignment(Ogre::GVA_BOTTOM);
	newElement->setMetricsMode(Ogre::GMM_RELATIVE);
    newElement->setPosition(0, 0);
    newElement->setDimensions(0.4f, 0.4f);
    newElement->setCharHeight(0.045f);
	mPeasantText = newElement;
	newContainer->addChild(newElement);
	mOverlay->add2D(newContainer);

	mOverlay->show();
}
static void InitStartScene()
{
	if(app.state.CurentState > 0)
	{
		return;
	}

	Ogre::RTShader::ShaderGenerator::initialize();
	Ogre::RTShader::ShaderGenerator::getSingletonPtr()->setTargetLanguage("glsles");
	gMatListener = new Ogre::ShaderGeneratorTechniqueResolverListener();
	Ogre::MaterialManager::getSingleton().addListener(gMatListener);

	LOGW("Create SceneManager");
	gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
	Ogre::RTShader::ShaderGenerator::getSingletonPtr()->addSceneManager(gSceneMgr);

	camera = gSceneMgr->createCamera("MyCam");
	camera->setNearClipDistance(1.0f);
	camera->setFarClipDistance(100000.0f);
	camera->setPosition(0,0,20.0f);
	camera->lookAt(0,0,0);
	camera->setAutoAspectRatio(true);

	vp = gRenderWnd->addViewport(camera);
	vp->setBackgroundColour(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
	vp->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);

	/**
	 * http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Creating+Overlays+via+Code
	 * http://www.ogre3d.org/forums/viewtopic.php?f=2&t=78278#p492027
	 */
	LOGW("Create OverlaySystem");
	Ogre::OverlaySystem *mOverlaySystem = OGRE_NEW Ogre::OverlaySystem();
	gSceneMgr->addRenderQueueListener(mOverlaySystem);

	LOGW("Create overlayManager");
	Ogre::OverlayManager& overlayManager = Ogre::OverlayManager::getSingleton();

	loadResources("resources.cfg");
	Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup("Start");

	LOGW("Create a img overlay panel");
	Ogre::OverlayContainer* panel = static_cast<Ogre::OverlayContainer*>( overlayManager.createOverlayElement( "Panel", "PanelLogo" ) );
	panel->setPosition( vp->getActualWidth()/2 - 64, vp->getActualHeight()/2 - 64 - 20 );
	panel->setDimensions( 128, 64 );
	panel->setMaterialName("overlay_image_material");
	panel->setMetricsMode(Ogre::GMM_PIXELS);

	Ogre::Overlay* LogoOverlay = overlayManager.create( "OverlayLogo" );
	LogoOverlay->add2D( panel );
	LogoOverlay->show();


	LOGW("Create a text overlay panel");
	textArea = static_cast<Ogre::TextAreaOverlayElement*>(overlayManager.createOverlayElement("TextArea", "TextAreaName"));
	textArea->setMetricsMode(Ogre::GMM_PIXELS);
	textArea->setPosition(0, 0);
	textArea->setDimensions(100, 100);
	textArea->setCaption("Hello, World!");
	textArea->setCharHeight(48);
	textArea->setFontName("QWcuckoo");
	textArea->setColourBottom(Ogre::ColourValue(0.0f, 0.0f, 1.0f));
	textArea->setColourTop(Ogre::ColourValue(1.0f, 0.0f, 0.0f));

	Ogre::OverlayContainer* TextPanel = static_cast<Ogre::OverlayContainer*>( overlayManager.createOverlayElement( "Panel", "PanelText" ) );
	TextPanel->setPosition( vp->getActualWidth()/2 - 128, vp->getActualHeight()/2 + 20 );
	TextPanel->setDimensions( 256, 64 );
	TextPanel->setMaterialName("overlay_text_material");
	TextPanel->setMetricsMode(Ogre::GMM_PIXELS);
	TextPanel->addChild(textArea);

	Ogre::Overlay* TextOverlay = overlayManager.create( "OverlayText" );
	TextOverlay->add2D( TextPanel );
	TextOverlay->show();

	app.state.CurentState = 1;

}