natiny.window.get_state

Lua
natiny.window.get_state(win) -> state

Returns the current window state observed by the platform.

Parameters

Name Type Description
win number Window handle from natiny.window.create

Returns

Type Description
number One of the natiny.window.STATE_* constants; natiny.window.STATE_NORMAL for an invalid handle

Example

Lua
if natiny.window.get_state(win) ~= natiny.window.STATE_MINIMIZED then
    draw_the_world()
end

Notes

  • On desktop, the result reflects user actions such as minimizing from the taskbar or leaving fullscreen with Escape.
  • In a browser, the function returns only natiny.window.STATE_NORMAL or natiny.window.STATE_FULLSCREEN.
  • On Android, the function returns the last supported state requested through natiny.window.set_state: natiny.window.STATE_NORMAL or natiny.window.STATE_FULLSCREEN.
  • A state requested during the current frame becomes visible after the event loop processes it, normally in the next frame.
  • A minimized fullscreen desktop window returns natiny.window.STATE_MINIMIZED.