Version: beta
FUNCTION | |
---|---|
window.set_listener() | sets a window event listener |
window.set_dim_mode() | set the mode for screen dimming |
window.get_dim_mode() | get the mode for screen dimming |
window.get_size() | get the window size |
CONSTANT | |
---|---|
window.WINDOW_EVENT_FOCUS_LOST | focus lost window event |
window.WINDOW_EVENT_FOCUS_GAINED | focus gained window event |
window.WINDOW_EVENT_RESIZED | resized window event |
window.WINDOW_EVENT_ICONFIED | iconify window event |
window.WINDOW_EVENT_DEICONIFIED | deiconified window event |
window.DIMMING_ON | dimming mode on |
window.DIMMING_OFF | dimming mode off |
window.DIMMING_UNKNOWN | dimming mode unknown |
window.set_listener(callback)
PARAMETERS
callback |
A callback which receives info about window events. Pass an empty function or nil if you no longer wish to receive callbacks.
|
EXAMPLES
function window_callback(self, event, data) if event == window.WINDOW_EVENT_FOCUS_LOST then print("window.WINDOW_EVENT_FOCUS_LOST") elseif event == window.WINDOW_EVENT_FOCUS_GAINED then print("window.WINDOW_EVENT_FOCUS_GAINED") elseif event == window.WINDOW_EVENT_ICONFIED then print("window.WINDOW_EVENT_ICONFIED") elseif event == window.WINDOW_EVENT_DEICONIFIED then print("window.WINDOW_EVENT_DEICONIFIED") elseif event == window.WINDOW_EVENT_RESIZED then print("Window resized: ", data.width, data.height) end end function init(self) window.set_listener(window_callback) end
window.set_dim_mode(mode)
PARAMETERS
mode |
The mode for screen dimming
|
window.get_dim_mode()
window.DIMMING_UNKNOWN
is always returned.
PARAMETERS
RETURNS
mode |
The mode for screen dimming
|
window.get_size()
PARAMETERS
RETURNS
width |
The window width |
height |
The window height |
focus lost window event
This event is sent to a window event listener when the game window or app screen has lost focus.
focus gained window event
This event is sent to a window event listener when the game window or app screen has gained focus. This event is also sent at game startup and the engine gives focus to the game.
resized window event
This event is sent to a window event listener when the game window or app screen is resized. The new size is passed along in the data field to the event listener.
iconify window event
This event is sent to a window event listener when the game window or app screen is iconified (reduced to an application icon in a toolbar, application tray or similar).
deiconified window event
This event is sent to a window event listener when the game window or app screen is restored after being iconified.
dimming mode on
Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
dimming mode off
Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
dimming mode unknown
Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction. This mode indicates that the dim mode can't be determined, or that the platform doesn't support dimming.