Page 1 of 1

How to hide all gui elements?

Posted: Fri Aug 30, 2024 12:30 pm
by mitras1
I know about get getChildren(), but I don't know how lists work in Irrlicht

Re: How to hide all gui elements?

Posted: Fri Aug 30, 2024 1:01 pm
by CuteAlien
You can loop over children like:

Code: Select all

irr::core::list<IGUIElement*>& children = guiElement->getChildren();
for (irr::core::list<IGUIElement*>::Iterator it = children.begin(); it != Children.end(); ++it)
{
	(*it)->setVisible(false);
}
Note that when you hide a parent element then all children are hidden as well. So when I need to hide a group of UI elements I often give them a common static-text (without text and border so it's invsible) as parent so I can just hide that one.

Also if you don't want _any_ gui then the simplest is: don't draw it. As long as you don't call IGUIEnvironment::drawAll() the gui isn't rendered.

Re: How to hide all gui elements?

Posted: Fri Aug 30, 2024 5:29 pm
by mitras1
CuteAlien wrote: Fri Aug 30, 2024 1:01 pm Note that when you hide a parent element then all children are hidden as well. So when I need to hide a group of UI elements I often give them a common static-text (without text and border so it's invsible) as parent so I can just hide that one.
Thanks for this trick!