This section describes the base level UI system definitions and functions.
Interface System | This section describes the base level UI system definitions and functions. |
XML Definitions | These are non-window XML definitions. |
System Interface XML | |
Interface | This is the top level xml-tag for each interface xml file. |
Include | This element allows you to include additiontional files. |
Scripts | This element allows you to include lua files directly. |
Assets | This is the container tag for all source file assets. |
Texture | This element defines a single art texture component. |
Font | This element defines a font defintion. |
Icon | This element defines the data for a single icon. |
MapIcon | This element defines the data for a single icon. |
Ui Log Filters Type | |
Constants | |
Constants | |
Button Flags | |
Variables | |
Variables | |
SystemData. ActiveWindow.name | |
SystemData. InputProcessed. EnterKey | |
SystemData. InputProcessed. EscapeKey | |
SystemData. InputProcessed. GamepadKey | |
SystemData. InputProcessed. LButtonDown | |
SystemData. InputProcessed. LButtonUp | |
SystemData. InputProcessed. RButtonDown | |
SystemData. InputProcessed. RButtonUp | |
SystemData. MouseOverWindow.name | |
SystemData. InputProcessed. RButtonUp | |
SystemData. MousePosition.x | |
SystemData. MousePosition.y | |
SystemData. UpdateProcessed.Time | |
Events | All events are cached in the lua table in the format of SystemData.Events.EVENT_NAME |
Events | |
ENTER_KEY_PROCESSED | This event is broadcast when the enter key processing has completed. |
ESCAPE_KEY_PROCESSED | This event is broadcast when the enter key processing has completed. |
L_BUTTON_DOWN_PROCESSED | This event is broadcast when the LButtonDown processing has completed. |
ENTER_KEY_PROCESSED | his event is broadcast when the LButtonUP processing has completed. |
ENTER_KEY_PROCESSED | |
L_BUTTON_DOWN_PROCESSED | |
R_BUTTON_DOWN_PROCESSED | This event is broadcast when the RButtonDown processing has completed.not. |
R_BUTTON_UP_PROCESSED | This event is broadcast when the RButtonUp processing has completed. |
UPDATE_PROCESSED | This event is broadcast when the update pass has completed. |
ALL_MODULES_INITIALIZED | This event is broadcast after all modules have had their OnInitialize handlers executed |
Functions | |
Functions | |
LoadResources() | Loads UI resources from an xml file. |
RegisterWindowSet() | Registers a new set of windows with the UI system. |
CreateWindow() | Creates a window from an XML definition. |
CreateWindowFromTemplate() | Creates a window of the specified name from an XML definition. |
CreateWindowFromTemplateShow() | Creates a window of the specified name from an XML definition. |
DestroyWindow() | Removes a window and all of it’s children from the current UI. |
GetScreenResolution() | Returns the current screen resolution. |
BroadcastEvent() | Broadcasts an event with the UI system’s assigned event processor. |
BuildTableFromCSV() | Broadcasts an event with the UI system’s assigned event processor. |
GetIconData() | Returns the data for the specified icon. |
GetMapIconData() | Returns the data for the specified map icon. |
LoadStringTable() | Creates a new string table of the specified name from the data file. |
UnloadStringTable() | Unloads the specified string table. |
GetStringFromTable() | Returns the specified string from a string table |
GetStringFormatFromTable() | Returns a string from a string table with the substitution tags replaced by values in the params table. |
LogSystem() | Creates log files for all the functions & variables available to Lua. |
CreateUIDocumentFile() | Creates a NaturalDocs style output file that lists all registered functions and variables. |
StringToWString() | Converts a string to a wstring |
WStringToString() | Converts a string to a wstring |
ScaleInterface() | Sets the master UI scale. |
SetUseLuaErrorHandling() | Enables lua_errors for UI debugging. |
GetUseLuaErrorHandling() | Returns if lua-error handling is currently turned on. |
SetLoadLuaDebugLibrary() | Sets if the lua debug library should be loaded when reloading the UI. |
GetLoadLuaDebugLibrary() | Returns if the Lua debug library will be loaded when reloading the UI |
SetCheckForCircularDependencies() | Sets if the UI should check for circular dependencies. |
GetCheckForCircularDependencies() | Returns if the UI is currently checking for circular dependencies. |
SetItemDragging() | Inform the UI system that we are currently dragging something |
RegisterEventHandler() | Registers a generic lua callback event handler that is not tied to a window. |
UnregisterEventHandler() | Unregisters a generic event handler that is not tied to a window. |
ForceProcessAllWindowAnchors() | Force anchor processing for all windows. |
These are non-window XML definitions.
System Interface XML | |
Interface | This is the top level xml-tag for each interface xml file. |
Include | This element allows you to include additiontional files. |
Scripts | This element allows you to include lua files directly. |
Assets | This is the container tag for all source file assets. |
Texture | This element defines a single art texture component. |
Font | This element defines a font defintion. |
Icon | This element defines the data for a single icon. |
MapIcon | This element defines the data for a single icon. |
Ui Log Filters Type |
This is the top level xml-tag for each interface xml file. All other elements must be contained within the Interface tag
<?xml version="1.0" encoding="UTF-8"?>
<Interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Interface.xsd">
...
</Interface>
xmlns:xsi | The location of the xml language specification. |
xsi:noNamespaceSchemaLocation | The location of the MythInterface scheme file. |
This element allows you to include additiontional files. This must be inside of an Interface tag.
<Include file="Source/ChatWindow.xml" />
file = The relative file path of the xml file from the location of the main xml file.
none
This element allows you to include lua files directly. This must be inside of an Interface tag.
<Scripts>
<Script file="Interface.lua" />
<Script file="Source/Cursor.lua" />
</Scripts>
file = The relative file path of the lua file from the location of the main xml file.
none
This element defines a single art texture component. This must be inside of an Assets tag.
<Texture name="ui_main" file="Textures/UI_Main01.dds" />
name | The name for the texture to be used in other window-element texture fields. |
file | The relative file path of the texture file from the location of the main xml file. |
This element defines a font defintion. In this UI system a font, is a single font style at a single size. This must be inside of an Assets tag.
<Font name="font_default_text" face="AgeOfReckoning" file="fonts/AgeOfReckoning.ttf" height="18" texsize="256"
antialias="true" hinting="false" autohinting="true" outline="true" shadow="false"/>
name | The name to call this font definition. |
face | The face name of the font type. |
file | The relative file path of the texture file from the location of the main xml file. |
height | The height in pixels for this font. |
texsize | The texture size to use to render this font. If the texture runs out of space, additional textures of this size will be created as needed. |
anitialias | Enables/Disabled anitialiasing. |
hinting | Turns on/off the TrueType hinting algorithm. |
autohinting | Turns on/off the FreeType custom hinting algorithm. |
outline | Turns on/off an outline on the characters. |
shadow | Turns on/off a drop shadow on the characters. |
This element defines the data for a single icon. This must be inside of an Assets tag.
<Icon id="00100" texture="Icons/Skl_Strength.dds" x="0" y="0" name="Strength Icon"/>
id | The icon id number, must be unique. |
texture | The relative file path of the icon texture file from the location of the main xml file. |
x | The x coordinate within the texture. |
y | The y coordinate within the texture. |
name | A descriptive name field, this is only added for readability and is not loaded. |
This element defines the data for a single icon. This must be inside of an Assets tag.
<MapIcon id="00001" texture="map_markers01" textureX="514" textureY="2" sizeX="16" sizeY="21" pointX="8" pointY="10" />
id | The icon id number, must be unique. |
texture | The UI texture name for the map icons. |
textureX | The x coordinate within the texture. |
textureY | The y coordinate within the texture. |
sizeX | The x pixel size. |
sizeY | The y pixel size. |
pointX | The x point within the icon that should be considered its center. |
pointY | The y point within the icon that should be considered its center. |
string | This variable contains the name of the window that is currently active for the callback event. This is updated prior to every <SystemData.Events.UPDATE_PROCESSED> event. |
boolean | This variable contains result for the last enter key event. True if the event was handled by the UI, false if not. This is updated prior to every <SystemData.Events.ENTER_KEY_PROCESSED> event. |
boolean | The result for the last escape key event. True if the event was handled by the UI, false if not. |
boolean | The result for the last game pad key event. True if the event was handled by the UI, false if not. |
boolean | The result for the last LButtonDown event. True if the event was handled by the UI, false if not. |
boolean | The result for the last LButtonUp event. True if the event was handled by the UI, false if not. |
boolean | The result for the last RButtonDown event. True if the event was handled by the UI, false if not. |
boolean | The result for the last RButtonUp event. True if the event was handled by the UI, false if not. |
All events are cached in the lua table in the format of SystemData.Events.EVENT_NAME
Events | |
ENTER_KEY_PROCESSED | This event is broadcast when the enter key processing has completed. |
ESCAPE_KEY_PROCESSED | This event is broadcast when the enter key processing has completed. |
L_BUTTON_DOWN_PROCESSED | This event is broadcast when the LButtonDown processing has completed. |
ENTER_KEY_PROCESSED | his event is broadcast when the LButtonUP processing has completed. |
ENTER_KEY_PROCESSED | |
L_BUTTON_DOWN_PROCESSED | |
R_BUTTON_DOWN_PROCESSED | This event is broadcast when the RButtonDown processing has completed.not. |
R_BUTTON_UP_PROCESSED | This event is broadcast when the RButtonUp processing has completed. |
UPDATE_PROCESSED | This event is broadcast when the update pass has completed. |
ALL_MODULES_INITIALIZED | This event is broadcast after all modules have had their OnInitialize handlers executed |
This event is broadcast when the enter key processing has completed. The variable SystemData.InputProcessed.EnterKey is updated prior to each broadcast.
This event is broadcast when the enter key processing has completed. The variable SystemData.InputProcessed.EnterKey is updated prior to each broadcast.
boolean | The result for the last LButtonDown event. True if the event was handled by the UI, false if not. |
boolean | The result for the last LButtonUp event. True if the event was handled by the UI, false if not. |
This event is broadcast after all modules have had their OnInitialize handlers executed
Functions | |
LoadResources() | Loads UI resources from an xml file. |
RegisterWindowSet() | Registers a new set of windows with the UI system. |
CreateWindow() | Creates a window from an XML definition. |
CreateWindowFromTemplate() | Creates a window of the specified name from an XML definition. |
CreateWindowFromTemplateShow() | Creates a window of the specified name from an XML definition. |
DestroyWindow() | Removes a window and all of it’s children from the current UI. |
GetScreenResolution() | Returns the current screen resolution. |
BroadcastEvent() | Broadcasts an event with the UI system’s assigned event processor. |
BuildTableFromCSV() | Broadcasts an event with the UI system’s assigned event processor. |
GetIconData() | Returns the data for the specified icon. |
GetMapIconData() | Returns the data for the specified map icon. |
LoadStringTable() | Creates a new string table of the specified name from the data file. |
UnloadStringTable() | Unloads the specified string table. |
GetStringFromTable() | Returns the specified string from a string table |
GetStringFormatFromTable() | Returns a string from a string table with the substitution tags replaced by values in the params table. |
LogSystem() | Creates log files for all the functions & variables available to Lua. |
CreateUIDocumentFile() | Creates a NaturalDocs style output file that lists all registered functions and variables. |
StringToWString() | Converts a string to a wstring |
WStringToString() | Converts a string to a wstring |
ScaleInterface() | Sets the master UI scale. |
SetUseLuaErrorHandling() | Enables lua_errors for UI debugging. |
GetUseLuaErrorHandling() | Returns if lua-error handling is currently turned on. |
SetLoadLuaDebugLibrary() | Sets if the lua debug library should be loaded when reloading the UI. |
GetLoadLuaDebugLibrary() | Returns if the Lua debug library will be loaded when reloading the UI |
SetCheckForCircularDependencies() | Sets if the UI should check for circular dependencies. |
GetCheckForCircularDependencies() | Returns if the UI is currently checking for circular dependencies. |
SetItemDragging() | Inform the UI system that we are currently dragging something |
RegisterEventHandler() | Registers a generic lua callback event handler that is not tied to a window. |
UnregisterEventHandler() | Unregisters a generic event handler that is not tied to a window. |
ForceProcessAllWindowAnchors() | Force anchor processing for all windows. |
Loads UI resources from an xml file.
directory | (string) The directory from which to load. |
xmlFileName | (number) The name of the main xml file |
allowRaw | (boolean) Can we load raw versions of these files, or should be only look in a Mythic-Approved archive? |
nil | no return value |
none
Registers a new set of windows with the UI system. When the current window set changes, the specified lua callback function is called.
setId | (number) The id # for the window set |
initializationFunction | (string) The lua-callback function to be called for initialization. |
shutdownFunction | (string) The lua-callback function to be called when this set is de-activated. |
nil | no return value |
none
Creates a window from an XML definition.
windowName | (string) The name of the XML definition |
show | (boolean) Shows the window after creation if true, hides the window if false. |
nil | no return value |
CreateWindow( "ChatWindow", true )
Creates a window of the specified name from an XML definition.
windowName | (string) The desired name for the created window. |
templateName | (string) The name of the XML template to use for creation. |
parent | (string) The name of the parent this new window should be a child of. |
bool | Whether or not the window could be created. |
none
Creates a window of the specified name from an XML definition.
windowName | (string) The desired name for the created window. |
templateName | (string) The name of the XML template to use for creation. |
parent | (string) The name of the parent this new window should be a child of. |
showWindow | (boolean) Show the window on creation. |
bool | Whether or not the window could be created. |
none
Removes a window and all of it’s children from the current UI. If an OnShutDown() callback is specified, that callback is executed prior to destruction.
windowName | (string) The name of the window. |
nil | no return value |
none
Returns the current screen resolution. This is also the size of the Root window.
none
xRes | (number) The x screen resolution, in pixels. |
yRes | (number) The y screen resolution, in pixels. |
none
Broadcasts an event with the UI system’s assigned event processor. This is intended to be the primary method of communication between game system and lua interface layer.
eventId | (number) The event id to broadcast. |
nil | no return value |
none
Broadcasts an event with the UI system’s assigned event processor. This is intended to be the primary method of communication between game system and lua interface layer.
csvFilePath | (string) The path for the csv file. |
baseLuaVarName | (string) The lua-table name to which to add the csv data. |
nil | no return value |
none
Returns the data for the specified icon.
iconId | (string) The icon id |
texutureName | (string) The texture name for the icon. |
xTexCoord | (number) The x pixel texture coordinate in the texture. |
yTexCoord | (number) The y pixel texture coordinate in the texture. |
disabledTexutureName | (string) The texture name for the disable version of the icon. |
Icon -1 | Invalid Icon Def. |
Icon -2 | Icon texture is missing. |
local texture, x, y, disabledTexture = GetIconData( iconNum )
Returns the data for the specified map icon.
iconId | (string) The map icon id |
texutureName | (string) The texture name for the icon. |
xTexCoord | (number) The x pixel texture coordinate in the texture. |
yTexCoord | (number) The y pixel texture coordinate in the texture. |
xSize | (number) The x pixel size of the icon. |
ySize | (number) The y pixel size of the icon. |
rTintColor | (number) The red tint color value for the icon (0-255). |
gTintColor | (number) The green tint color value for the icon (0-255). |
bTintColor | (number) The blue tint color value for the icon (0-255). |
none
local texture, textureX, textureY, sizeX, sizeY, colorR, colorG, colorB = GetMapIconData( ptData.icon )
Creates a new string table of the specified name from the data file.
tableName | (string) The name for this new string table. |
fileDirectory | (string) The directory for the string table file |
fileName | (string) The file name of the string table file. |
cacheDir | (string) The cache directory to use for the string table file. |
enumRoot | (string) A lua-table name to use to create an enumeration for the string table. |
nil | no return value |
LoadStringTable("Default", "data/strings/"..language, "default.txt", "cache/"..language, "StringTables.Default" )
Simplify this function...
Unloads the specified string table.
tableName | (string) The name of the string table. |
nil | no return value |
none
UnloadStringTable( "Default" )
Returns the specified string from a string table
tableName | (string) The name of the string table. |
id | (number) Index within this string table. |
text | (string) The string table entry text. |
Returns the empty string “” if the function fails for any reason.
local text = GetStringFromTable("Default", id )
Returns a string from a string table with the substitution tags replaced by values in the params table.
tableName | (string) The name of the string table. |
id | (number) Index within this string table. |
params | (wstringTable) A table of wide-string parameters |
text | (string) The string table entry text. |
none
local text = GetStringFormatFromTable( "Default", id, params )
Creates log files for all the functions & variables available to Lua.
functionsFileName | (string) Name of file to export the list of functions. |
variablesFileName | (string) Name of file to export the list of variables. |
nil | no return value |
none
none
Creates a NaturalDocs style output file that lists all registered functions and variables. This file can be included in a Natural docs project to track which functions and variables have been documented.
fileName | (string) Name of file to export the NaturalDocs output. |
nil | no return value |
none
none
Converts a string to a wstring
stringText | (string) The string-type text. |
wStringText | (wstring) The wide-string conversion. |
none
none
Converts a string to a wstring
wstringText | (wstring) The wstring-type text, |
stringText | (string) The string conversion. |
none
none
Sets the master UI scale. Scales the entire interface and establishes the default scale for all subsequently created windows.
scale | (number) Global scaling factor for the UI. A scale of 1.0 is 100%. |
nil | no return value. |
none
ScaleInterface( InterfaceCore.scale )
Enables lua_errors for UI debugging. When enabled, all code-detected errors, such as failures in function calls, will trigger lua_error and force execution of the lua script to halt. This will cause an error message with the file and line number to be printed to the DebugWindow.
enabled | (boolean) True = turns on, False = turns off |
nil | no return value. |
none
local enabled = GetUseLuaErrorHandling()
enabled = not enabled
SetUseLuaErrorHandling( enabled )
Returns if lua-error handling is currently turned on.
nil | no parameters |
enabled | (boolean) True = turns on, False = turns off |
none
local enabled = GetUseLuaErrorHandling()
enabled = not enabled
SetUseLuaErrorHandling( enabled )
Sets if the lua debug library should be loaded when reloading the UI.
enabled | (boolean) True = turns on, False = turns off |
nil | no return value. |
local enabled = GetLoadLuaDebugLibrary()
enabled = not enabled
SetLoadLuaDebugLibrary( enabled )
Returns if the Lua debug library will be loaded when reloading the UI
nil | no parameters |
enabled | (boolean) True = yes, False = no |
none
local enabled = GetLoadLuaDebugLibrary()
Sets if the UI should check for circular dependencies. This provides some additional debug checking at a cost of performance. This is intended to be used by UI developers. Currently this turns on checks for:
enabled | (boolean) True = turns on, False = turns off |
nil | no return value. |
local enabled = SetCheckForCircularDependencies()
enabled = not enabled
SetCheckForCircularDependencies( enabled )
Returns if the UI is currently checking for circular dependencies.
nil | no parameters |
enabled | (boolean) True = yes, False = no |
none
local enabled = GetCheckForCircularDependencies()
Inform the UI system that we are currently dragging something
itemDraggingg | (boolean) Sets item dragging to to true/fasle |
nil | no return value. |
none
none
Registers a generic lua callback event handler that is not tied to a window.
eventId | (number) The id number of the event for which to register a callback. |
callback | (string) Full name of the lua function to be called when this event occurs. |
nil | no return value |
You may register as many unique callbacks for a particular event as you wish. General callbacks will remain registered as long as the current lua state persists or until you call UnregisterEventHandler() for this event/callback pairing. All generic event registration will be cleared (and must be re-registered) when you reload the UI.
If your event really pertains to a specific window, it is better to use the WindowRegisterEventHandler(), so that the <GameData.ActiveWindow.name> variable will be set prior to the call.
RegisterEventHandler( SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "PlayerWindow.UpdateCurrentHitPoints")
Unregisters a generic event handler that is not tied to a window.
eventId | (number) The id number of the event for which to register a callback. |
callback | (string) Full name of the lua callback function. |
nil | no return value |
UnregisterEventHandler( SystemData.Events.PLAYER_CUR_HIT_POINTS_UPDATED, "PlayerWindow.UpdateCurrentHitPoints")