Class LayerStack
java.lang.Object
com.github.darksoulq.abyssallib.world.gui.layer.LayerStack
- All Implemented Interfaces:
GuiLayer
A composite GUI layer that manages a collection of sub-layers in a stack.
Only one layer from the stack is rendered at any given time. This class facilitates navigation through these layers, handling the cleanup of the previous layer before rendering the next one.
-
Constructor Summary
ConstructorsConstructorDescriptionLayerStack(List<GuiLayer> layers) Constructs a new LayerStack with the provided layers. -
Method Summary
Modifier and TypeMethodDescriptionvoidCleans up the currently active layer.intgetIndex()Gets the index of the current active layer.voidForces a re-render on the next tick by invalidating the render cache.voidSwitches to the next layer in the stack, wrapping back to the start if necessary.voidSwitches to the previous layer in the stack, wrapping to the end if necessary.voidRenders the currently active layer to the GUI view.voidJumps directly to a specific layer index in the stack.intsize()Gets the total number of layers in the stack.
-
Constructor Details
-
LayerStack
-
-
Method Details
-
next
Switches to the next layer in the stack, wrapping back to the start if necessary.- Parameters:
view- the active GUI view context
-
previous
Switches to the previous layer in the stack, wrapping to the end if necessary.- Parameters:
view- the active GUI view context
-
setIndex
Jumps directly to a specific layer index in the stack.- Parameters:
view- the active GUI view contextindex- the target index
-
renderTo
-
cleanup
-
getIndex
public int getIndex()Gets the index of the current active layer.- Returns:
- the current index
-
size
public int size()Gets the total number of layers in the stack.- Returns:
- the layer count
-
invalidate
public void invalidate()Forces a re-render on the next tick by invalidating the render cache.
-