예제 #1
0
void	cDialog::SetZOrder				(const size_t iZOrder) { 
	mpOverlay->setZOrder(iZOrder);
	
    // work around Ogre::Overlay::setZOrder() bug (dagon 1.2.4) (multiplication with 100 was missing)
	Ogre::Overlay::Overlay2DElementsIterator itor = mpOverlay->get2DElementsIterator();
	while (itor.hasMoreElements()) itor.getNext()->_notifyZOrder(iZOrder*100);
}
예제 #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());
}
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);
			}
		}
	}
}
예제 #4
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);
        }
    }
}
예제 #5
0
파일: gkHUD.cpp 프로젝트: guozanhua/OgreKit
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;
	}
}