本文整理汇总了C++中ogre::OverlayContainer::getChildIterator方法的典型用法代码示例。如果您正苦于以下问题:C++ OverlayContainer::getChildIterator方法的具体用法?C++ OverlayContainer::getChildIterator怎么用?C++ OverlayContainer::getChildIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::OverlayContainer
的用法示例。
在下文中一共展示了OverlayContainer::getChildIterator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Ogre::OverlayContainer *GUIHelper::findContainer(Ogre::OverlayContainer *overlay,
const Ogre::String subStrName)
{
ASSERT(overlay);
std::queue<Ogre::OverlayContainer *> q;
q.push(overlay);
Ogre::OverlayContainer *parent = 0;
while(!q.empty()){
parent = q.back();
q.pop();
if(parent->getName().find(subStrName) != Ogre::String::npos){
// we find it
return parent;
}
// else we have to iterate over all the children an put it in the queue
Ogre::OverlayContainer *child = 0;
Ogre::OverlayContainer::ChildIterator it = parent->getChildIterator();
while(it.hasMoreElements()){
child = static_cast<Ogre::OverlayContainer *>(it.peekNextValue());
if(!child){
break;
}
// else we put it in the queue
q.push(child);
it.moveNext();
}
}
return 0;
}
示例2:
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());
}
示例3: deleteOverlayContainerContents
void LoadingBar::deleteOverlayContainerContents(Ogre::OverlayContainer& container) const
{
{
OverlayContainer::ChildContainerIterator I = container.getChildContainerIterator();
while (I.hasMoreElements()) {
deleteOverlayContainerContents(*I.getNext());
}
}
OverlayContainer::ChildIterator I = container.getChildIterator();
while (I.hasMoreElements()) {
OverlayManager::getSingleton().destroyOverlayElement(I.getNext());
}
}
示例4: fullDestroyOverlay
void GUIHelper::fullDestroyOverlay(Ogre::Overlay *overlay)
{
ASSERT(overlay);
Ogre::Overlay::Overlay2DElementsIterator it = overlay->get2DElementsIterator();
Ogre::OverlayManager &om = Ogre::OverlayManager::getSingleton();
std::vector<Ogre::OverlayElement *> elements;
Ogre::OverlayContainer *parent = 0;
while(it.hasMoreElements()){
parent = it.peekNext();
if(!parent){
break;
}
Ogre::OverlayContainer::ChildIterator it2 = parent->getChildIterator();
Ogre::OverlayContainer *child = 0;
while(it2.hasMoreElements()){
child = static_cast<Ogre::OverlayContainer *>(it2.peekNextValue());
if(!child){
break;
}
// else.. delete the container
fullDestroyOverlayElement(child);
it2.moveNext();
}
elements.push_back(parent);
it.moveNext();
}
for(int i = 0; i < elements.size(); ++i){
destroyMaterial(elements[i]->getMaterialName());
om.destroyOverlayElement(elements[i]);
}
om.destroy(overlay);
}
示例5: fixOverlayPosition
/**
* Bugfix for the nested overlay containers position. This function will
* get a overlay and will iterate over all the (child) containers and will
* set the new "relative" position
* @param overlay The overlay to fix the childs positions
*/
void GUIHelper::fixOverlayPosition(Ogre::Overlay *overlay)
{
ASSERT(overlay);
Ogre::Overlay::Overlay2DElementsIterator it = overlay->get2DElementsIterator();
Ogre::OverlayContainer *parent = 0;
while(it.hasMoreElements()){
parent = it.peekNext();
if(!parent){
break;
}
// else we have the parent... get the top left and sizes
Ogre::Real top = parent->getTop();
Ogre::Real left = parent->getLeft();
Ogre::Real height = parent->getHeight();
Ogre::Real width = parent->getWidth();
Ogre::OverlayContainer::ChildIterator it2 = parent->getChildIterator();
Ogre::OverlayContainer *child = 0;
while(it2.hasMoreElements()){
child = static_cast<Ogre::OverlayContainer *>(it2.peekNextValue());
if(!child){
break;
}
// else.. we have to configure this child with the parent size and
// position
reposContainer(child, left, top, height, width);
it2.moveNext();
}
it.moveNext();
}
}
示例6: newImpl
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;
}
}