Skip to content

Instantly share code, notes, and snippets.

@8bitgentleman
Created April 9, 2014 20:43
Show Gist options
  • Save 8bitgentleman/10312834 to your computer and use it in GitHub Desktop.
Save 8bitgentleman/10312834 to your computer and use it in GitHub Desktop.
joystick
function love.load()
joystick = love.joystick.getJoysticks()[1]
position = {x = 400, y = 300}
speed = 300
end
function love.draw()
local joysticks = love.joystick.getJoysticks()
for i, joystick in ipairs(joysticks) do
love.graphics.print(joystick:getName(), 10, i * 20)
love.graphics.print("GUID: "..joystick:getGUID(), 10, i * 35)
love.graphics.print("number of buttons: " .. joystick:getButtonCount( ), 10, i * 50)
love.graphics.print("axis: 0 value: "..joystick:getAxis(0, 0), 10, i * 70)
love.graphics.print("axis: 1 value: "..joystick:getAxis(0, 1), 10, i * 80)
love.graphics.print("Is the button down? "..tostring(joystick:isDown( 1, 1 )), 10, i * 110)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment