natiny_window_get_width

C
int natiny_window_get_width(NatinyWindow id);

Returns the current width of a window in drawing units.

Parameters

Name Type Description
id NatinyWindow Window handle from natiny_window_create

Returns

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

Example

C
NatinyWindow win = natiny_window_create("My Game", 1280, 720);

int w = natiny_window_get_width(win);
printf("Width: %d\n", w);

Notes

  • In NATINY_SCALE_MODE_PIXELS, the result is the number of window pixels. In NATINY_SCALE_MODE_STRETCH and NATINY_SCALE_MODE_HIDPI, it is the width used by 2D drawing and mouse input.