GUI question

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
NightBird
Posts: 12
Joined: Tue May 25, 2004 6:47 pm

GUI question

Post by NightBird »

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!
rincewind
Posts: 35
Joined: Thu Mar 25, 2004 5:28 pm
Location: Germany --> Bonn

Post by rincewind »

You can do something like that:

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 */
}
hope, that helps.
greetings, rincewind
NightBird
Posts: 12
Joined: Tue May 25, 2004 6:47 pm

Post by NightBird »

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? :D

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();
}
Post Reply