selene.ui.lml

Provides functions for loading, skinning and manipulating UIs.
PropertyTypeDescription
Root
Stack
 
Function
LoadUI(xmlFilePath: string, config: { i18nBundle: string; skin: Skin; actions: table<string, function(actor: Actor)> }): actors
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.
CreateContainer(skin: Skin, config: { child: Actor; background: string; width: number; height: number }): Container
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.
AddToRoot(actors: Actor | table<Actor>)
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, VisImageButtonStyle
CreateImageButtonStyle(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.