natiny.window.get_scale

Lua
natiny.window.get_scale(win)

Returns the display scaling factor captured when the window was created.

Parameters

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

Returns

Type Description
number Display scale: 1 for 100%, 1.5 for 150%, 2 for 200%, or 0 if the window does not exist

Example

Manual display scaling in the default pixel-for-pixel mode:

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

local font = natiny.font.create(ttf, 16 * s)

natiny.render.text(font, 20 * s, 20 * s, "hello")