UI Class
Top-level container for all other user-interface components.
Method Index
- _translateKeyCode(code, rawchar)
- addBevelPanel(x, y, w, h, colour, highlight_colour, shadow_colour, disabled_colour) (inherited from Window)
- addColourPanel(x, y, w, h, r, g, b) (inherited from Window)
- addKeyHandler(keys, window, callback, ...) (overrides Window:addKeyHandler)
- addPanel(sprite_index, x, y, w, h) (inherited from Window)
- addWindow(window) (overrides Window:addWindow)
- afterLoad(old, new) (overrides Window:afterLoad)
- beginDrag(x, y) (inherited from Window)
- bringToTop() (inherited from Window)
- changeResolution(width, height)
- close() (inherited from Window)
- closeWindow()
- disableKeyboardRepeat()
- draw(canvas) (overrides Window:draw)
- drawTooltip(canvas)
- enableKeyboardRepeat(delay, interval)
- exitApplication()
- getCursorPosition(window)
- getSavedWindowPositionName() (inherited from Window)
- getScreenOffset()
- getTooltipAt(x, y) (inherited from Window)
- getTooltipForElement(elem, x, y) (inherited from Window)
- getWindow(window_class) (inherited from Window)
- getWindows(window_class) (inherited from Window)
- hitTest(x, y) (inherited from Window)
- hitTestPanel(x, y, panel) (inherited from Window)
- initKeyAndButtonCodes()
- makeButtonOnPanel(panel, x, y, w, h, sprite, on_click, on_click_self, on_rightclick) (inherited from Window)
- makeDynamicTooltip(callback, x, y, r, b, tooltip_x, tooltip_y) (inherited from Window)
- makeScreenshot()
- makeScrollbarOnPanel(panel, slider_colour, callback, min_value, max_value, page_size, value) (inherited from Window)
- makeTextboxOnPanel(panel, confirm_callback, abort_callback) (inherited from Window)
- makeTooltip(text, x, y, r, b, tooltip_x, tooltip_y) (inherited from Window)
- onChangeLanguage() (inherited from Window)
- onChangeResolution() (overrides Window:onChangeResolution)
- onCursorWorldPositionChange(x, y) (inherited from Window)
- onKeyDown(code, rawchar)
- onKeyUp(code)
- onMouseDown(code, x, y) (overrides Window:onMouseDown)
- onMouseMove(x, y, dx, dy) (overrides Window:onMouseMove)
- onMouseUp(code, x, y) (overrides Window:onMouseUp)
- onTick() (overrides Window:onTick)
- onWindowActive(gain)
- onWorldTick() (inherited from Window)
- playAnnouncement(name)
- playSound(name)
- quit()
- registerTextBox(box)
- removeAllPanels() (inherited from Window)
- removeKeyHandler(keys, window)
- removeWindow(window) (overrides Window:removeWindow)
- resetApp()
- resetVideo()
- sendToBottom(window) (inherited from Window)
- sendToTop(window) (inherited from Window)
- setCursor(cursor)
- setDefaultCursor(cursor)
- setDefaultPosition(x, y) (inherited from Window)
- setMenuBackground()
- setPosition(x, y) (inherited from Window)
- setupGlobalKeyHandlers()
- showLuaConsole()
- startButtonBlinking(button_index) (inherited from Window)
- stopButtonBlinking() (inherited from Window)
- stopMovie()
- stopVideo()
- toggleAdviser()
- toggleFullscreen()
- togglePlayAnnouncements()
- togglePlayMusic(item)
- togglePlaySounds()
- tutorialStep(...)
- unregisterTextBox(box)
- updateTooltip()
Member Index
- active_button (*)
- active_scrollbar (*)
- app
- background
- background_height
- background_width
- blink_counter (*)
- blinking_button (*)
- btn_repeat_delay (*)
- button_codes
- buttons (*)
- buttons_down
- closed (*)
- cursor
- cursor_entity
- cursor_x
- cursor_y
- debug_cursor_entity
- default_button_sound (*)
- default_cursor
- down_count
- down_cursor
- drag_mouse_move
- draggable (*)
- dragging (*)
- edit_room_cursor
- editing_allowed
- grab_cursor
- height (*)
- key_code_to_rawchar
- key_codes
- key_handlers
- key_remaps
- key_to_button_remaps
- keyboard_repeat_enable_count
- modal_windows
- panel_sprites (*)
- panels (*)
- parent (*)
- screen_offset_x
- screen_offset_y
- scrollbars (*)
- simulated_cursor
- textboxes
- tick_scroll_amount
- tick_scroll_amount_mouse
- tick_scroll_mult
- tooltip
- tooltip_counter
- tooltip_font
- tooltip_regions (*)
- ui (*)
- visible (*)
- waiting_cursor
- width (*)
- windows
- x (*)
- x_original (*)
- y (*)
- y_original (*)
function UI:UI(app, minimal)
Parameters:
Name | Type | Description |
---|---|---|
app | ? | ? |
minimal | ? | ? |
Declared on: line 146 of Lua/ui.lua.
function UI:_translateKeyCode(code, rawchar)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
window | ? | ? |
Overrides: Window:addWindow.
Declared on: line 786 of Lua/ui.lua.
function UI:afterLoad(old, new)
Parameters:
Name | Type | Description |
---|---|---|
old | ? | ? |
new | ? | ? |
Overrides: Window:afterLoad.
Declared on: line 830 of Lua/ui.lua.
function UI:changeResolution(width, height)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
canvas | ? | ? |
Overrides: Window:draw.
Declared on: line 327 of Lua/ui.lua.
function UI:drawTooltip(canvas)
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
window | ? | ? |
Declared on: line 818 of Lua/ui.lua.
function UI:getScreenOffset()
Declared on: line 719 of Lua/ui.lua.
function UI:initKeyAndButtonCodes()
Declared on: line 46 of Lua/ui.lua.
function UI:makeScreenshot()
Declared on: line 871 of Lua/ui.lua.
function UI:onChangeResolution()
Overrides: Window:onChangeResolution.
Declared on: line 424 of Lua/ui.lua.
function UI:onKeyDown(code, rawchar)
Called when the user presses a key on the keyboard
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
code | ? | ? |
x | ? | ? |
y | ? | ? |
Overrides: Window:onMouseDown.
Declared on: line 669 of Lua/ui.lua.
function UI:onMouseMove(x, y, dx, dy)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
dx | ? | ? |
dy | ? | ? |
Overrides: Window:onMouseMove.
Declared on: line 751 of Lua/ui.lua.
function UI:onMouseUp(code, x, y)
Parameters:
Name | Type | Description |
---|---|---|
code | ? | ? |
x | ? | ? |
y | ? | ? |
Overrides: Window:onMouseUp.
Declared on: line 692 of Lua/ui.lua.
function UI:onTick()
Overrides: Window:onTick.
Declared on: line 771 of Lua/ui.lua.
function UI:onWindowActive(gain)
Called when the mouse enters or leaves the game window.
Parameters:
Name | Type | Description |
---|---|---|
gain | ? | ? |
Declared on: line 747 of Lua/ui.lua.
function UI:playAnnouncement(name)
Used for announcements only
Parameters:
Name | Type | Description |
---|---|---|
name | ? | ? |
Declared on: line 273 of Lua/ui.lua.
function UI:playSound(name)
Used for everything except music and announcements
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
box | ? | ? |
Declared on: line 435 of Lua/ui.lua.
function UI:removeKeyHandler(keys, window)
Unregister a key handler previously registered by `addKeyHandler`.
Parameters:
Name | Type | Description |
---|---|---|
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:
Name | Type | Description |
---|---|---|
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:resetVideo()
Declared on: line 452 of Lua/ui.lua.
function UI:setCursor(cursor)
Parameters:
Name | Type | Description |
---|---|---|
cursor | ? | ? |
Declared on: line 293 of Lua/ui.lua.
function UI:setDefaultCursor(cursor)
Parameters:
Name | Type | Description |
---|---|---|
cursor | ? | ? |
Declared on: line 280 of Lua/ui.lua.
function UI:setMenuBackground()
Declared on: line 417 of Lua/ui.lua.
function UI:setupGlobalKeyHandlers()
Declared on: line 251 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:toggleAdviser()
Declared on: line 713 of Lua/game_ui.lua.
function UI:toggleFullscreen()
Declared on: line 494 of Lua/ui.lua.
function UI:togglePlayMusic(item)
Parameters:
Name | Type | Description |
---|---|---|
item | ? | ? |
Declared on: line 729 of Lua/game_ui.lua.
function UI:togglePlaySounds()
Declared on: line 718 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:
Name | Type | Description |
---|---|---|
... | ? | ? |
Declared on: line 866 of Lua/ui.lua.
function UI:unregisterTextBox(box)
Parameters:
Name | Type | Description |
---|---|---|
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.