コード例 #1
0
GameplayScreen::~GameplayScreen()
{
	//Destroy our game objects
	delete mWhacker;
	for(unsigned int i=0; i<mDragons.size(); i++)
	{
		delete mDragons[i];
	}
	//Destroy all entities created
	Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager");
	mSceneManager->destroyEntity("Stage");
	//Remove the stage mesh
	mStageNode->removeAndDestroyAllChildren();
	mStageNode->getParentSceneNode()->removeAndDestroyChild(mStageNode->getName());
	//Destroy our score overlay
	//To do this, we must traverse all elements contained within
	//the overlay and remove them one at a time.
	Ogre::OverlayManager* overlayMgr = Ogre::OverlayManager::getSingletonPtr();
	Ogre::Overlay::Overlay2DElementsIterator iter = mOverlay->get2DElementsIterator();
	for(;iter.hasMoreElements();)
	{
		Ogre::OverlayContainer * childContainer = iter.getNext();
		Ogre::OverlayContainer::ChildIterator contIter = childContainer->getChildIterator();
		for(;contIter.hasMoreElements();)
		{
			Ogre::OverlayElement* curElement = contIter.getNext();
			overlayMgr->destroyOverlayElement(curElement->getName());
		}
		overlayMgr->destroyOverlayElement(childContainer->getName());
	}
	overlayMgr->destroy(mOverlay->getName());
}
コード例 #2
0
// virtual
EC_OgreMovableTextOverlay::~EC_OgreMovableTextOverlay()
{
    if (renderer_.expired())
        return;

    if (overlay_)
    {
        overlay_->hide();
        container_->removeChild(overlayName_);
        overlay_->remove2D(container_);

        Ogre::OverlayManager *overlayManager = Ogre::OverlayManager::getSingletonPtr();
        overlayManager->destroyOverlayElement(text_element_);
        overlayManager->destroyOverlayElement(container_);
        overlayManager->destroy(overlay_);
    }

    if (node_)
    {
        DetachNode();
        Ogre::SceneManager *scene_mgr = renderer_.lock()->GetSceneManager();
        scene_mgr->destroySceneNode(node_);
        node_ = 0;
    }
}
コード例 #3
0
ファイル: CObjectTitle.cpp プロジェクト: hjqqq/Forever
CObjectTitle::~CObjectTitle()
{
   Ogre::OverlayManager *pOverlayManager = Ogre::OverlayManager::getSingletonPtr();
   m_pContainer->removeChild(m_pTextArea->getName());
   m_pOverlay->remove2D(m_pContainer);
   pOverlayManager->destroyOverlayElement(m_pTextArea);
   pOverlayManager->destroyOverlayElement(m_pContainer);
   pOverlayManager->destroy(m_pOverlay);
}
コード例 #4
0
void TextComponent::OnDestroy() {
    Ogre::OverlayManager* mgr = Ogre::OverlayManager::getSingletonPtr();

    mPanel->removeChild(mLabel->getName());
    mOverlay->remove2D(mPanel);

    mgr->destroyOverlayElement(mLabel);
    mgr->destroyOverlayElement(mPanel);
    mgr->destroy(mOverlay);
}
コード例 #5
0
MovableTextOverlay::~MovableTextOverlay()
{
	// overlay cleanup -- Ogre would clean this up at app exit but if your app 
	// tends to create and delete these objects often it's a good idea to do it here.

	mpOv->hide();
	Ogre::OverlayManager *overlayManager = Ogre::OverlayManager::getSingletonPtr();
	mpOvContainer->removeChild(mName+"_OvTxt");
	mpOv->remove2D(mpOvContainer);
	overlayManager->destroyOverlayElement(mpOvText);
	overlayManager->destroyOverlayElement(mpOvContainer);
	overlayManager->destroy(mpOv);
}
コード例 #6
0
ファイル: Menu.cpp プロジェクト: Thoronador/Dusk
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