Skip to content
Tangent 128 edited this page Mar 28, 2015 · 3 revisions

SDL.getMouseState

Use this function to retrieve the current state of the mouse.

Function

SYNOPSIS

state, x, y = function SDL.getMouseState()

RETURNS

  • state, the state of buttons as enumeration (see SDL.mouseMask)
  • x, the current x coordinate
  • y, the current y coordinate

EXAMPLES

local state, x, y = SDL.getMouseState()

-- Check for buttons left and right
if state[SDL.mouseMask.Left] then
print("Left is pressed")
end
if state[SDL.mouseMask.Right] then
print("Right is pressed")
end

print("x = " .. x)
print("y = " .. y)
Clone this wiki locally