Window
Basic GUI window
pos.gui.Window(name: string, color: number|nil)
Creates a new Window with name and optional background color.
Type | Name | Description |
---|---|---|
number |
x |
Screen x origin |
number |
y |
Screen y origin |
number |
w |
Window pixel width |
number |
h |
Window pixel height |
number |
bg |
Window background color |
boolean |
visible |
If the window is visible |
boolean |
exitOnHide |
If the window should exit the program on being hidden |
Type | Name | Description |
---|---|---|
string |
_name |
Window name |
table |
_elements |
Table of all UiElement s drawn in this window, indexed by element id |
number |
__elementIndex |
Last assigned element index |
table |
_menuOptions |
Table of all MenuOption s drawn in this window, indexed by element id |
number |
__menuIndex |
Last assigned menu option index |
number |
_nameOffset |
Pixel offset for centering name |
number |
_windowIndex |
Global window index, set by pos.gui.addWindow(window) |
Return | Name | Description |
---|---|---|
nil |
show() |
Makes the window visible |
nil |
hide() |
Hides the window |
nil |
draw() |
Draws the window, including all elements |
nil |
process(event: table) |
Processes event, and passes to all elements |
number |
addElement(element: UiElement) |
Adds an element to the window, returns element index |
nil |
removeElement(index: number) |
Removes an element from the window by index |
number |
addMenuOption(element: MenuOption) |
Adds an menu option to the window, returns menu option index |
nil |
removeMenuOption(index: number) |
Removes an menu option from the window by index |
nil |
setName(name: string) |
Sets the name of the window |
string |
getName() |
Returns the name of the window |
nil |
setPos(x: number, y: number) |
Sets the origin of the window |
nil |
setSize(w: number, h: number) |
Sets the size of the window |