How to hide all gui elements?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mitras1
Posts: 26
Joined: Mon Jan 29, 2024 8:02 am

How to hide all gui elements?

Post by mitras1 »

I know about get getChildren(), but I don't know how lists work in Irrlicht
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to hide all gui elements?

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
mitras1
Posts: 26
Joined: Mon Jan 29, 2024 8:02 am

Re: How to hide all gui elements?

Post 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!
Post Reply