summaryrefslogtreecommitdiff
path: root/meta/3rd/Defold/library/window.lua
blob: e62ae7c4c03e39bdf042b2d5b160da9e65a2d5f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---Window API documentation
---Functions and constants to access the window, window event listeners
---and screen dimming.
---@class window
window = {}
---dimming mode off
window.DIMMING_OFF = nil
---dimming mode on
window.DIMMING_ON = nil
---dimming mode unknown
window.DIMMING_UNKNOWN = nil
---deiconified window event
window.WINDOW_EVENT_DEICONIFIED = nil
---focus gained window event
window.WINDOW_EVENT_FOCUS_GAINED = nil
---focus lost window event
window.WINDOW_EVENT_FOCUS_LOST = nil
---iconify window event
window.WINDOW_EVENT_ICONFIED = nil
---resized window event
window.WINDOW_EVENT_RESIZED = nil
--- Returns the current dimming mode set on a mobile device.
---The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction.
---On platforms that does not support dimming, window.DIMMING_UNKNOWN is always returned.
---@return constant # The mode for screen dimming
function window.get_dim_mode() end

---This returns the current lock state of the mouse cursor
---@return boolean # The lock state
function window.get_mouse_lock() end

---This returns the current window size (width and height).
---@return number # The window width
---@return number # The window height
function window.get_size() end

--- Sets the dimming mode on a mobile device.
---The dimming mode specifies whether or not a mobile device should dim the screen after a period without user interaction. The dimming mode will only affect the mobile device while the game is in focus on the device, but not when the game is running in the background.
---This function has no effect on platforms that does not support dimming.
---@param mode constant # The mode for screen dimming
function window.set_dim_mode(mode) end

---Sets a window event listener.
---@param callback fun(self: object, event: constant, data: table) # A callback which receives info about window events. Pass an empty function or nil if you no longer wish to receive callbacks.
function window.set_listener(callback) end

---Set the locking state for current mouse cursor on a PC platform.
---This function locks or unlocks the mouse cursor to the center point of the window. While the cursor is locked,
---mouse position updates will still be sent to the scripts as usual.
---@param flag boolean # The lock state for the mouse cursor
function window.set_mouse_lock(flag) end




return window