Trigary / Iodine

A Minecraft mod - server plugin pair that adds custom GUIs and overlays. No more inventory and chat menus!
GNU General Public License v3.0
24 stars 0 forks source link

Controllable draw order #10

Closed Trigary closed 4 years ago

Trigary commented 5 years ago

The order in which GUI elements are drawn should be controllable through the API. It is not enough to simply draw the one top which was added first/last to the GUI, a more customizable system is needed: each GUI element should have a "draw priority" variable. The client should store the elements in a sorted fashion, with the draw priority ascending. This way the element with the highest draw priority is drawn last, therefore it is drawn on top of any previous elements. A secondary sorting rule should be added, eg. based on the element ID, that way the sorting is deterministic.

What should happen when the draw priority of a container changes? Currently, I believe that the draw priority of all of its children should be set to the draw priority of the container + 1, but only if their previous draw priority was lower.

Since the secondary sorting rule is based on the element ID, therefore the default draw order is the order in which elements are added. It is not necessary to assign custom draw priorities to newly created elements.

Trigary commented 4 years ago

Fixed in 4e5f0ef