sandbox:mouse_move

Client

Fired whenever the mouse cursor moves


Signal

"sandbox:mouse_move"

Arguments

TypeNameDescription
floatxHorizontal cursor position in pixels from the left of the viewport
floatyVertical cursor position in pixels from the top of the viewport

Can fire multiple times per frame under fast cursor movement.

  • Coordinates are in viewport-space pixels.
  • Store the latest values in sandbox:mouse_move and read them inside sandbox:draw for cursor-relative UI.

Example

Track cursor position
local mx, my = 0, 0

util.event.on("sandbox:mouse_move", function(x, y)
    mx, my = x, y
end)

util.event.on("sandbox:draw", function()
    core.engine.draw_text("Cursor: " .. mx .. ", " .. my, 10, 10, 14)
end)

On this page