UI Organization Library: UIStack


I made a library for organizing all my various game stages, menus, etc… I give you UI-Stack!!!
Why would you even want to use this?

  • Every UI has it’s own gui and root nodes.
  • Only one UI can be active at a time. You can’t display one UI over another.
  • As it the title, it’s a UI-Stack, so you can add things to the stack, but also remove layers, revealing the ones lower in the stack.
  • Bonus: 8kb(111 lines of code) jarfile

Please tell me if this is already in jme and I reinvented the wheel again… :joy:

How I used it:
I used to have a really convoluted system for this… Submenus inside the main menu, Attatching everything to a static reference of the root & gui nodes, and ad displays that showed up in the middle of the game (Good way to loose players :stuck_out_tongue: ), So I spent ~an hour last night making this! It’s actually quite easy to implement into an existing game, and I’ll be sure to use it in my next one.

This picture may or may not make what I said harder to understand…

If you’re sold(horray for sales pitching XD ), here’s a download & github link.


Just a polite observation: your UI screens should probably be app states. (Then I think 90% of what you’ve written is maybe already taken care of.)


Basically, the entire point of the library is providing the root & gui nodes without having to deal with cleanup. Remember Main.guiNode_? Not doing that again anytime soon…
Edit: At least, that’s why I made it

Here’s a picture with almost all of my game’s current problems though:


Yeah, but this is only a few lines in an app state that extends BaseAppState. Create what you need in initialize(), attach it to the application’s root nodes in onEnabled(), removeFromParent() in onDisabled().

There was never a reason to do that. AppStates already give you the application and you can use that to attach/detach your local root node.