void ResourceGroupReloader::visitRecursivelyRenderablesFrom(Ogre::OverlayContainer* pOverlayContainer, Ogre::Renderable::Visitor& pVisitor, bool debugRenderable)
{
	// call on 'this'
	pOverlayContainer->visitRenderables(&pVisitor,false);

	// call on 'leaf' (cf composite pattern)
	{
		Ogre::OverlayContainer::ChildIterator childIter = pOverlayContainer->getChildIterator();
		for(;childIter.hasMoreElements();)
		{
			Ogre::OverlayElement* lOverElem = childIter.getNext();
			lOverElem->visitRenderables(&pVisitor,false);
		}
	}

	// call on 'not-leaf' (cf composite pattern)
	{
		Ogre::OverlayContainer::ChildContainerIterator childContainerIter = pOverlayContainer->getChildContainerIterator();
		for(;childContainerIter.hasMoreElements();)
		{
			Ogre::OverlayContainer * childContainer = childContainerIter.getNext();
			visitRecursivelyRenderablesFrom(childContainer, pVisitor,debugRenderable);
		}
	}
}
Exemplo n.º 2
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());
}
Exemplo n.º 3
0
void gkHUD::newImpl(void)
{

	try
	{

		m_overlay = Ogre::OverlayManager::getSingleton().getByName(m_name.getName());

		// Auto create if it's here
		if (m_overlay)
		{
			Ogre::Overlay::Overlay2DElementsIterator elements = m_overlay->get2DElementsIterator();

			while (elements.hasMoreElements())
			{
				Ogre::OverlayContainer* cont = elements.getNext();
				addChild(new gkHUDElement(cont->getName()));

				Ogre::OverlayContainer::ChildIterator childs = cont->getChildIterator();

				while (childs.hasMoreElements())
				{
					Ogre::OverlayElement* elm = childs.getNext();
					gkHUDElement* hele = new gkHUDElement(elm->getName());
					addChild(hele);
				}
			}

		}
	}
	catch (Ogre::Exception& e)
	{
		gkLogMessage("HUD: " << e.getDescription());
		m_overlay = 0;
	}
}