Z Layer of GUI elements

  • Hi @red51


    I'm working on some code that uses a GUI when items are moved from or to a chest (for player operated shops).


    The problem I am having is the GUI always appears underneath the in-game inventory's GUI. So I could do with something like:




    Behind this screen (indicated by red arrow) appears my confirmation GUI. Which is only visible once you close the inventory screen.





    As it appears behind the inventory screen its not much use currently ;(



    Edit: Maybe a way to show and hide (.setVisible(false || true) ) the inventory screen might work?

  • Hmm... well, just changing the Z order might not work in this case =O In Rising World, the Z order always depends on the Z order of the parent, or in other words, the parent automatically restricts the Z order of its childs (to avoid situations like having a button [child] being visible in front of the inventory, while the messagebox [parent] is shown behind the inventory)...


    API elements are always attached to the HUD, and the HUD is always rendered behind the inventory/journal/crafting GUI.


    However, our GUI already has an option to set a GUI element being always visible in front of other GUI elements (this setting is just not yet exposed to the API), internally this overrides the Z order. Maybe that would work in your case? You could set your confirmation window to be "always on top", so it will definitely be visible in front of the inventory or any other screen. Then we could add the .setAlwaysOnTop() method (and maybe also a .setAlwaysInBackground() method) with the next update ;)


    Edit: Maybe a way to show and hide (.setVisible(false true) ) the inventory screen might work?

    There will be some methods in the next update to show/hide the inventory as well as other screens (journal, chest content, map) :)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!