natiny.input.get_mouse_x

Lua
natiny.input.get_mouse_x() -> x

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

Returns

Type Description
number Mouse cursor X coordinate in drawing units

Example

Lua
local 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.