natiny.window.get_width

Lua
natiny.window.get_width(win)

Returns the current width of a window in drawing units.

Parameters

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

Returns

Type Description
number Window width, 0 if the window does not exist

Example

Lua
local win = natiny.window.create("My Game", 1280, 720)

local w = natiny.window.get_width(win)
print("Width: " .. w)

Notes

  • In natiny.window.SCALE_MODE_PIXELS, the result is the number of window pixels. In SCALE_MODE_STRETCH and SCALE_MODE_HIDPI, it is the width used by 2D drawing and mouse input.