GUI question
GUI question
Is there a way to wipe the gui of all elements currently in use? without having to change deivce, or anything quite that drastic. and without haveing to keep a record of all of the gui elements(because I'm lazy). Any help would be appreciated!
You can do something like that:
hope, that helps.
greetings, rincewind
Code: Select all
irr::gui::IGUIElement *root = myGUIEnvironment->getRootGUIElement(); /* get the root-guielement.
here myGUIEnvironment is a pointer to the GUIEnvironment */
irr::list<irr::gui::IGUIElement*> children = root->getChildren(); /* get a list of all children */
irr::list<irr::gui::IGUIElement*>::iterator it = children.begin();
while(it != children.end() ){
irr::gui::IGUIElement element = (*it);
it++;
element.remove(); /* remove each child */
}
greetings, rincewind
Ok, I had to make a few tweaks to the code you gave me. I'll post it later if anyone cares for it. But on to my next question: Is there a way to set the color/transparencies for the GUI elements? or would I have to go play with the source code some? ![Very Happy :D](./images/smilies/icon_biggrin.gif)
the code I promised:
IGUIElement *root = m_device->getGUIEnvironment()->getRootGUIElement();
irr::core::list<IGUIElement*>* child = (list<IGUIElement*>*)&root->getChildren();
irr::core::list<IGUIElement*>::Iterator it = child->begin();
while (it != child->end()) {
IGUIElement *element = (*it);
it++;
element->remove();
}
![Very Happy :D](./images/smilies/icon_biggrin.gif)
the code I promised:
IGUIElement *root = m_device->getGUIEnvironment()->getRootGUIElement();
irr::core::list<IGUIElement*>* child = (list<IGUIElement*>*)&root->getChildren();
irr::core::list<IGUIElement*>::Iterator it = child->begin();
while (it != child->end()) {
IGUIElement *element = (*it);
it++;
element->remove();
}