Description
Manages UI elements across different render layers to ensure proper
visual hierarchy and interaction.
Attributes:
layers (Dict[LayerType, List[UIElement]]): Elements organized by layer
layer_order (List[LayerType]): Order in which layers should be rendered
Methods
def __init__(self: Any) -> Any
Initialize the layer manager with empty layers.
def get_all_elements(self: Any) -> Any
Get all UI elements across all layers.
Returns:
List[UIElement]: A list of all UI elements
def add_element(self: Any, element: UIElement, layer: LayerType = None) -> Any
Add a UI element to the appropriate layer.
Args:
element (UIElement): The UI element to add
layer (LayerType, optional): Specific layer to add to. If None,
determines layer based on element properties.
def remove_element(self: Any, element: UIElement) -> Any
Remove a UI element from all layers.
Args:
element (UIElement): The UI element to remove
def clear_layer(self: Any, layer: LayerType) -> Any
Clear all elements from a specific layer.
Args:
layer (LayerType): The layer to clear
def clear_all(self: Any) -> Any
Clear all elements from all layers.
def _determine_layer(self: Any, element: UIElement) -> LayerType
Determine the appropriate render layer for a UI element.
Args:
element (UIElement): The element to classify
Returns:
LayerType: The appropriate render layer
def determine_list_layers(self: Any, element_list: List[UIElement]) -> Dict[LayerType, List[UIElement]]
Determine the appropriate render layers for a list of UI elements.
Args:
element_list (List[UIElement]): The list of elements to classify
Returns:
Dict[LayerType, List[UIElement]]: A dictionary mapping layers to elements
def get_elements_in_order_from(self: Any, elements: List[UIElement]) -> List[UIElement]
Get elements in the correct render order from a dictionary of layers.
Args:
layers (Dict[LayerType, List[UIElement]]): A dictionary mapping layers to elements
Returns:
List[UIElement]: Elements sorted by render layer and z-index
def get_elements_in_order(self: Any) -> List[UIElement]
Get all elements in the correct render order.
Returns:
List[UIElement]: Elements sorted by render layer and z-index
def update(self: Any, dt: float, input_state: Any) -> Any
Update all elements in the layer manager.
Args:
dt (float): Delta time in seconds
input_state: Current input state