selene.ui.lml
Provides functions for loading, skinning and manipulating UIs.
| Property | Type | Description |
|---|---|---|
Root | Stack |
| Function |
|---|
Loads a UI from an XML file with optional actions and configuration.
Returns an array of root actors and a table of actors by name.
Throws an error if the XML file is not found. |
LoadSkin(skinPath: string): Skin |
Loads a skin from a JSON file.
Throws an error if the skin file is not found. |
CreateSkin(): Skin |
Creates a new empty skin with default font and styles. |
Creates a container actor with optional child and styling. |
CreateLabel(skin: Skin, config: { style: string; text: string; wrap: boolean }): Label |
Creates a label actor with text and styling.
Throws an error if the label style is not found in the skin. |
Adds actors to the root UI container. Accepts a single actor or table of actors. |
SetFocus(actor: Actor | nil) |
Sets keyboard focus to the specified actor, or clears focus if nil. |
GetFocus(): Actor | nil |
Returns the actor with keyboard focus, or nil if there is none. |
CreateImageButtonStyle(config: table): ImageButtonStyle, VisImageButtonStyleCreateImageButtonStyle(config: table, skin: Skin): ImageButtonStyle, VisImageButtonStyle |
Creates image button styles from configuration table.
Returns both ImageButtonStyle and VisImageButtonStyle. |
AddInputProcessor(processor: { KeyUp: function(event: InputEvent, keyCode: number); KeyDown: function(event: InputEvent, keyCode: number); KeyTyped: function(event: InputEvent, char: number) }) |
Adds an input processor for handling keyboard events to the UI.
The processor table can contain KeyUp, KeyDown, and KeyTyped functions. |