natiny_input_get_mouse_x

C
int natiny_input_get_mouse_x(void);

Returns the mouse cursor's X coordinate relative to the window's left edge.

Returns

Type Description
int Mouse cursor X coordinate in drawing units

Example

C
int x = natiny_input_get_mouse_x();

Notes

  • On desktop, input state is global across windows. The coordinate is relative to the window that produced the most recent cursor event. On web it is relative to the single canvas.
  • The result uses the same units as 2D drawing: window pixels in NATINY_SCALE_MODE_PIXELS, and display-scaled drawing units in NATINY_SCALE_MODE_STRETCH and NATINY_SCALE_MODE_HIDPI.