natiny_window_get_scale
float natiny_window_get_scale(NatinyWindow id);
Returns the display scaling factor captured when the window was created.
Parameters
| Name | Type | Description |
|---|---|---|
id |
NatinyWindow |
Window handle from natiny_window_create |
Returns
| Type | Description |
|---|---|
float |
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:
NatinyWindow win = natiny_window_create("My Game", 1280, 720);
float s = natiny_window_get_scale(win);
NatinyFont font = natiny_font_create(ttf, 16.0f * s);
natiny_render_text(font, 20.0f * s, 20.0f * s, "hello");
Notes
NATINY_SCALE_MODE_STRETCHandNATINY_SCALE_MODE_HIDPIapply this factor automatically.NATINY_SCALE_MODE_PIXELSignores it.- The value is captured when the window is created. Moving the window to another display does not update it.
- This function only reads the factor; it does not change the window's mode.