sandbox:mouse_move
Client
Fired whenever the mouse cursor moves
Signal
"sandbox:mouse_move"Arguments
| Type | Name | Description |
|---|---|---|
float | x | Horizontal cursor position in pixels from the left of the viewport |
float | y | Vertical 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_moveand read them insidesandbox:drawfor cursor-relative UI.
Example
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)