t0neg0d GUI and removing screens/elements

Hello there,

I’m making an application using t0neg0d GUI and I was wondering the best way to have multiple button menus being manages.

Currently I have one screen and continuously add the buttons to the screen, which isn’t the wisest thing to do because I end up with more and more buttons.

So my question is.

Would it be better to have one screen and remove all the elements and re add them as I switch back and forth between button menus.

If so, how would I easily clear the screen of all elements?

Or to have separate screens and remove and add the screen itself to the gui node?

If so would it be as simple as adding and removing the screens at the proper time?

I may be able to help you here, but not sure I understand correctly.

NB: it would be easier to understand if you didn’t use the word screen… kinda means something different in tonegodGUI.

What are those buttons you keep adding?

In case this is of any help (yah, reread your question and not sure I’m answering to it now, but since this was already typed and may help…):

I use windows, and attach all buttons etc to them. So by removing the window, I remove all the window content in one stroke.
Each of those windows is a class here, in charge of it’s display. I also have a class per window for controlling it (removing it, reacting to events, getting data, etc).

I have a static class in charge of remembering what window is open and calling all opened windows controller to close their window when needed.
I’m going from the idea that I won’t run into concurrency issues here.

So:

  • MainMenuDisplay

  • MainMenuController

  • HomeDisplay

  • HomeController

  • OptionsDisplay

  • OptionsController

etc

Pressing a MainMenu button ends up asking the static class to close all opened windows and then opening the required window (and linking it to it’s controller).

I also have a MainMenuListener, HomeListener, etc, but brighter people frowned (well, the way I did it) on that so I guess that even if I love it, it may be complect (yes, I just visioned that video about simplicity hehe).
I also inherit my display and controllers from abstract classes, since most of what happens is generic.

@BigBob said: Hello there,

I’m making an application using t0neg0d GUI and I was wondering the best way to have multiple button menus being manages.

Currently I have one screen and continuously add the buttons to the screen, which isn’t the wisest thing to do because I end up with more and more buttons.

So my question is.

Would it be better to have one screen and remove all the elements and re add them as I switch back and forth between button menus.

If so, how would I easily clear the screen of all elements?

Or to have separate screens and remove and add the screen itself to the gui node?

If so would it be as simple as adding and removing the screens at the proper time?

I’ll try and answer this…

Always use one screen. Use AppStates to manage your groups of Elements/Controls, passing in a reference to the single screen. When you instantiate the AppState, you can create the Elements and add them to the screen using using screen.addElement(el, true) which will hide the element (basically it adds a reference to the element to screen, but removes it from the rendered scene). In initialize of the AppState, call el.show() or el.showWithEffect(); And in cleanup call el.hide() or el.hideWithEffect();

If this didn’t answer your question, let me know and I’ll try again. =)