CorsixTH Lua Documentation

UI Class

Top-level container for all other user-interface components.

Declared on: line 23 of Lua/ui.lua.
Inheritance: UI ยป Window
Subclasses: GameUI

Method Index

Member Index

(*) only used in superclass methods
function UI:UI(app, minimal)

Parameters:

NameTypeDescription
app ? ?
minimal ? ?

Declared on: line 146 of Lua/ui.lua.

function UI:_translateKeyCode(code, rawchar)

Parameters:

NameTypeDescription
code ? ?
rawchar ? ?

Declared on: line 548 of Lua/ui.lua.

function UI:addKeyHandler(keys, window, callback, ...)

Register a key handler / hotkey for a window.

Parameters:

NameTypeDescription
keys string or or or table The keyboard key which should trigger the callback (for example, "left" or "z" or "F9"), or a list with modifier(s) and the key (e.g. {"ctrl", "s"}).
window Window The UI window which should receive the callback.
callback function The method to be called on `window` when `key` is pressed.
... ? Additional arguments to `callback`.

Overrides: Window:addKeyHandler.
Declared on: line 349 of Lua/ui.lua.

function UI:addWindow(window)

Parameters:

NameTypeDescription
window ? ?

Overrides: Window:addWindow.
Declared on: line 786 of Lua/ui.lua.

function UI:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Window:afterLoad.
Declared on: line 830 of Lua/ui.lua.

function UI:changeResolution(width, height)

Parameters:

NameTypeDescription
width ? ?
height ? ?

Declared on: line 465 of Lua/ui.lua.

function UI:closeWindow()

Closes one window (the topmost / active window, if possible)

Declared on: line 888 of Lua/ui.lua.

function UI:disableKeyboardRepeat()

Disables the keyboard repeat.

Declared on: line 403 of Lua/ui.lua.

function UI:draw(canvas)

Parameters:

NameTypeDescription
canvas ? ?

Overrides: Window:draw.
Declared on: line 327 of Lua/ui.lua.

function UI:drawTooltip(canvas)

Parameters:

NameTypeDescription
canvas ? ?

Declared on: line 311 of Lua/ui.lua.

function UI:enableKeyboardRepeat(delay, interval)

Enables a keyboard repeat. Default is 500 delay, interval 30

Parameters:

NameTypeDescription
delay ? ?
interval ? ?

Declared on: line 396 of Lua/ui.lua.

function UI:exitApplication()

Added this function as quit does not exit the application, it only exits the game to the menu screen

Declared on: line 916 of Lua/ui.lua.

function UI:getCursorPosition(window)

Parameters:

NameTypeDescription
window ? ?

Declared on: line 818 of Lua/ui.lua.

function UI:onKeyDown(code, rawchar)

Called when the user presses a key on the keyboard

Parameters:

NameTypeDescription
code integer The hardware key-code for the pressed key. Note that these codes only coincide with ASCII for certain keyboard layouts.
rawchar string The unicode character corresponding to the pressed key, encoded as UTF8 in a Lua string (for non-character keys, this value is "\0"). This value is affected by shift/caps-lock keys, but is not affected by any key-remappings.

Declared on: line 577 of Lua/ui.lua.

function UI:onKeyUp(code)

Called when the user releases a key on the keyboard

Parameters:

NameTypeDescription
code integer The hardware key-code for the pressed key. Note that these codes only coincide with ASCII for certain keyboard layouts.

Declared on: line 651 of Lua/ui.lua.

function UI:onMouseDown(code, x, y)

Parameters:

NameTypeDescription
code ? ?
x ? ?
y ? ?

Overrides: Window:onMouseDown.
Declared on: line 669 of Lua/ui.lua.

function UI:onMouseMove(x, y, dx, dy)

Parameters:

NameTypeDescription
x ? ?
y ? ?
dx ? ?
dy ? ?

Overrides: Window:onMouseMove.
Declared on: line 751 of Lua/ui.lua.

function UI:onMouseUp(code, x, y)

Parameters:

NameTypeDescription
code ? ?
x ? ?
y ? ?

Overrides: Window:onMouseUp.
Declared on: line 692 of Lua/ui.lua.

function UI:onWindowActive(gain)

Called when the mouse enters or leaves the game window.

Parameters:

NameTypeDescription
gain ? ?

Declared on: line 747 of Lua/ui.lua.

function UI:playAnnouncement(name)

Used for announcements only

Parameters:

NameTypeDescription
name ? ?

Declared on: line 273 of Lua/ui.lua.

function UI:playSound(name)

Used for everything except music and announcements

Parameters:

NameTypeDescription
name ? ?

Declared on: line 266 of Lua/ui.lua.

function UI:quit()

Triggers quitting the application

Declared on: line 921 of Lua/ui.lua.

function UI:registerTextBox(box)

Parameters:

NameTypeDescription
box ? ?

Declared on: line 435 of Lua/ui.lua.

function UI:removeKeyHandler(keys, window)

Unregister a key handler previously registered by `addKeyHandler`.

Parameters:

NameTypeDescription
keys string or or or table The key or list of modifiers+key of a key / window pair previously passed to `addKeyHandler`.
window Window The window of a key / window pair previously passed to `addKeyHandler`.

Declared on: line 373 of Lua/ui.lua.

function UI:removeWindow(window)

Parameters:

NameTypeDescription
window ? ?

Overrides: Window:removeWindow.
Declared on: line 803 of Lua/ui.lua.

function UI:resetApp()

Triggers reset of the application (reloads .lua files)

Declared on: line 911 of Lua/ui.lua.

function UI:setCursor(cursor)

Parameters:

NameTypeDescription
cursor ? ?

Declared on: line 293 of Lua/ui.lua.

function UI:setDefaultCursor(cursor)

Parameters:

NameTypeDescription
cursor ? ?

Declared on: line 280 of Lua/ui.lua.

function UI:showLuaConsole()

Shows the Lua console

Declared on: line 906 of Lua/ui.lua.

function UI:stopMovie()

Tries to stop a video, if one is currently playing

Declared on: line 926 of Lua/ui.lua.

function UI:stopVideo()

Stub for compatibility with savegames r1896-1921

Declared on: line 933 of Lua/ui.lua.

function UI:togglePlayMusic(item)

Parameters:

NameTypeDescription
item ? ?

Declared on: line 729 of Lua/game_ui.lua.

function UI:tutorialStep(...)

Stub to allow the function to be called in e.g. the information dialog without having to worry about a GameUI being present

Parameters:

NameTypeDescription
... ? ?

Declared on: line 866 of Lua/ui.lua.

function UI:unregisterTextBox(box)

Parameters:

NameTypeDescription
box ? ?

Declared on: line 439 of Lua/ui.lua.

function UI:updateTooltip()

Amount of ticks until a tooltip is displayed

Declared on: line 723 of Lua/ui.lua.

Page generated on Sat Feb 07, 2015 at 18:38:28 by LDocGen.