yvanvds
Member
|
hide/show several gui objects at once
Hey.
I'm trying to create a mode in my game that needs all current Gui objects hidden and some other shown. And being able to switch back to the previous mode.
The solution I came up first was a function that hides all the current gui objects and keeps track of which ones where shown before. This way I can show them again afterwards. Drawback is that I have to update this function every time I add a gui object.
Another solution would be having a second EE::GUI object, add the windows for the special mode to this gui and switch between these two in update and draw mode. I tried this but it seems I missed something, because my second gui didn't show.
I also saw that objects are added to the "current desktop" if added to the Gui with +=. So there's more than one desktop? And can I somehow switch between several desktops? I can't find any code for that.
Any ideas?
Regards,
yvan
|
|
03-12-2012 12:51 PM |
|
Esenthel
Administrator
|
RE: hide/show several gui objects at once
currently there is no api to switch between desktops
you can use region1, region2 with transparent backgrounds, and add objects to them.
however I recommend simply calling hide/show for all objects separately
|
|
03-12-2012 02:53 PM |
|
yvanvds
Member
|
RE: hide/show several gui objects at once
ok, thanks
|
|
03-12-2012 03:50 PM |
|
fatcoder
Member
|
RE: hide/show several gui objects at once
I am facing the same issue with some of my complex gui windows that have many controls and can be in different "states." I have found it useful to logically group the controls into transparent regions. Then whenever the gui window needs to change state, it is just a matter of adjusting the visibility of a few regions, rather than dozens of individual controls. In my case, the gui window state can change from frame to frame, so I need to check every frame and adjust region visibility. That is why I was asking if it was ok to do this every frame in a previous thread, performance wise, as I wasn't sure if changing a region's visibility was an expensive operation.
|
|
03-13-2012 02:20 AM |
|
yvanvds
Member
|
RE: hide/show several gui objects at once
Thanks, fatcoder. I came up with another idea. Wrote it down in the code snippets forum, as usual :-)
|
|
03-14-2012 09:49 PM |
|