Represents an application window on Win32 and MacOS X.
On other platforms, there may not be a window.
Window functions may be called in two ways:
Not passing any Window object to the function. In this case, the function affects the main application window. For example:
-- Sets the title of the main window
Window.set_title("main window")
Or, by passing an existing Window object to the function. In this case, the function affects the window that you pass. For example:
-- Creates a new window and sets its title win = Window.open() Window.set_title(win, "new window")
Related sample code
Other related reference items
Related help topics
clip_cursor ( window ) : booleanclip_cursor ( ) : booleanIndicates whether or not the window prevents the mouse pointer from moving outside its borders.
|
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the window confines the mouse pointer within its borders, or false otherwise. |
window : | The window to close. Optional; if not specified, uses the main application window. |
This function does not return any values. |
Available only for Windows platforms.
get_dpi_scale ( ) : numberGets the dpi scale.
|
This function does not accept any parameters. |
number |
Windows DPI scale. 1.0 on non-windows platforms. |
Available only for Windows platforms.
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the window has keyboard focus, or false otherwise. |
is_closing ( window ) : booleanis_closing ( ) : booleanIndicates whether or not the user has requested the specified window to be closed.
|
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the user has pressed the "close" icon for the specified window. |
Available only for Windows platforms.
is_resizable ( window ) : booleanis_resizable ( ) : booleanIndicates whether or not the window can be resized.
|
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the window has a resizable border, or false otherwise. |
window : | The window to maximize. Optional; if not specified, uses the main application window. |
This function does not return any values. |
Available only for Windows platforms.
window : | The window to minimize. Optional; if not specified, uses the main application window. |
This function does not return any values. |
Available only for Windows platforms.
mouse_focus ( window ) : booleanmouse_focus ( ) : booleanIndicates whether or not the window has mouse focus.
|
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the window has mouse focus, or false otherwise. |
When the window has mouse focus, it will hide the mouse pointer from the user and prevent the pointer from leaving the window.
open ( config )Opens a new window using the specified settings.
|
config : | Optional. A window_config table that provides settings for the new window. The ? notation indicates that this type is optional: there may be zero or one instances of it. |
This function does not return any values. |
Available only for Windows platforms.
Other related reference items
rect ( window ) : number, number, number, numberReturns the window rect.
|
number |
The x coordinate of the window. |
number |
The y coordinate of the window. |
number |
The width of the window. |
number |
The height of the window. |
window : | The window to restore from being maximized or minimized. Optional; if not specified, uses the main application window. |
This function does not return any values. |
Available only for Windows platforms.
set_clip_cursor ( window, doClip ) set_clip_cursor ( doClip )Determines whether or not the window prevents the mouse pointer from moving outside its borders.
|
window : | The window whose cursor setting will be set. Optional; if not specified, uses the main application window. | |
doClip : | boolean | Pass true to make the window confine the mouse pointer within its borders, or false otherwise. |
This function does not return any values. |
Related sample code
set_cursor ( window, cursor ) set_cursor ( cursor )Determines what type of mouse cursor resource will be used for the window.
|
window : | The window whose mouse cursor will be set. Optional; if not specified, uses the main application window. | |
cursor : | string | The name of the mouse cursor resource to use for this window. |
This function does not return any values. |
This cursor is used when the window has focus and the window is set to show a cursor (see also show_cursor() and set_show_cursor()).
The cursor parameter should be the name of a resource file in the project data directory that has the .mouse_cursor extension. This file must contain a single texture parameter, which points to the .texture resource that you want to use for the cursor image.
For example, if you create a resource called content/camera.mouse_cursor that contains the following line:
texture = "core/editor_slave/resources/gui/thumbnail_over"
You can assign it to the window by calling:
stingray.Window.set_cursor("content/camera")
window : | The window whose focus will be set. Optional; if not specified, uses the main application window. |
This function does not return any values. |
set_ime_enabled ( window, isEnabled ) set_ime_enabled ( isEnabled )Determines whether or not the input method editor (IME) is enabled for the specified window.
|
window : | The window to configure. Optional; if not specified, uses the main application window. | |
isEnabled : | boolean | true if the IME should be enabled for this window, or false otherwise. |
This function does not return any values. |
The IME is disabled by default.
set_keystroke_enabled ( window, key, isEnabled ) set_keystroke_enabled ( key, isEnabled )Determines whether or not specific keystrokes or key combinations are enabled for the specified window.
|
window : | Deprecated - The window parameter will be ignored and the implementation will use the main application window. | |
key : | integer | The keystroke or key combination to enable or disable. |
isEnabled : | boolean | true if the specified key should be enabled for this window, or false otherwise. |
This function does not return any values. |
Accepts any of the keystroke constants defined in the Window object: KEYSTROKE_WINDOWS, KEYSTROKE_ALT_TAB, KEYSTROKE_ALT_ENTER, or KEYSTROKE_ALT_F4.
Available only for Windows platforms.
set_mouse_focus ( window, focus ) set_mouse_focus ( focus )Determines whether or not the window should have mouse focus.
|
window : | The window whose focus will be set. Optional; if not specified, uses the main application window. | |
focus : | boolean | Pass true to give the window mouse focus, or false to remove mouse focus. |
This function does not return any values. |
Related sample code
set_rect ( window, x, y, width, height )Sets the window rect.
|
x : | number | The x coordinate of the window. |
y : | number | The y coordinate of the window. |
width : | number | The width of the window. |
height : | number | The height of the window. |
This function does not return any values. |
set_resizable ( window, resizeable ) set_resizable ( resizeable )Determines whether or not the window can be resized.
|
window : | The window whose border will be set. Optional; if not specified, uses the main application window. | |
resizeable : | boolean | Pass true if the window should have a resizable border, or false otherwise. |
This function does not return any values. |
set_resolution ( window, width, height ) : booleanset_resolution ( width, height ) : booleanSets the resolution of the specified window.
|
window : | The window whose resolution will be set. Optional; if not specified, uses the main application window. | |
width : | integer | The horizontal width of the window, in pixels. |
height : | integer | The vertical height of the window, in pixels. |
boolean |
true if the resolution could be set correctly, or false otherwise. |
set_show_cursor ( window, do_show, restore_cursor_pos ) set_show_cursor ( doShow )Determines whether or not the window shows the mouse pointer when it has focus.
|
window : | The window whose cursor setting will be set. Optional; if not specified, uses the main application window. | |
do_show : | boolean | Pass true to make the window show the mouse pointer when it has focus, or false otherwise. |
restore_cursor_pos : | boolean | When you show the cursor after it has been hidden, pass true to this parameter in order to make the cursor appear at its last visible position. Pass false to make the cursor appear at the position tracked by the operating system. Optional; if not specified, defaults to true. |
This function does not return any values. |
Related sample code
Basic template: /main_menu.lua Character template: /main_menu.lua Vehicle template: /main_menu.lua Oculus VR template: /main_menu.lua |
Other related reference items
window : | The window whose title will be set. Optional; if not specified, uses the main application window. | |
title : | string | The new title for the window. |
This function does not return any values. |
show_cursor ( window ) : booleanshow_cursor ( ) : booleanIndicates whether or not the window shows the mouse cursor when it has focus.
|
window : | The window to test. Optional; if not specified, uses the main application window. |
boolean |
true if the window is set to show the mouse cursor, or false otherwise. |
Related sample code
Other related reference items
sync_layered_window ( window, x, y, width, height, visible, opacity )Sets the layered window rect and alpha state.
|
x : | number | The x coordinate of the window. |
y : | number | The y coordinate of the window. |
width : | number | The width of the window. |
height : | number | The height of the window. |
visible : | boolean | Indicates if the window will be hidden or shown |
opacity : | number | Set the layered window transparency. |
This function does not return any values. |
trigger_resize ( window ) trigger_resize ( )Manually triggers 'on_resize' on the specified window.
|
window : | The window to trigger resize on. Optional; if not specified, uses the main application window. |
This function does not return any values. |
If the size has not been changed since last triggered it has no effect. Available only for Windows platforms.
Constants used to represent keystrokes and key combinations that interact with windows.
KEYSTROKE_ALT_ENTER : integerRepresents the Alt+Enter key combination.
|
Other related reference items
KEYSTROKE_ALT_F4 : integerRepresents the Alt+F4 key combination.
|
Other related reference items
KEYSTROKE_ALT_TAB : integerRepresents the Alt+Tab key combination.
|
Other related reference items
KEYSTROKE_WINDOWS : integerRepresents the Windows key.
|
Other related reference items