Sign in to follow this  
MattHughes

Removing objects from gui

Recommended Posts

MattHughes    122
Hi, I'm trying to adapt JavaCoolDude's GUI to my project, and I'm wondering if any of you would be able to shed some light on a specific topic. I would like to remove some elements from the interface after a specific event occurs. I can use element->setVisible(false) to hide it, but it is still there, just not being rendered. I can use element->setParent(NULL), but the object is still in whatever sort of manager is keeping track of all the elements. What would be the best way to completely remove a UI element from the scene? Thanks!

Share this post


Link to post
Share on other sites
Rasmadrak    196
I use a GUI-manager that handles all elements.
In its update-loop I check if it's marked (mouse-over-element) and if it's dying.
If it's dying, it gets removed from the list.

But before the update loop gets it's hand on the elements, the dying element removes all it's children so the GUI-manager has less to process.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this