I'm using a standard Dual Shock 3 (Playstation 3) controller under Linux. Probably with the xpad og xboxdrv drivers, not entirely sure.
When running the following code:
Code: Select all
function love.load()
joystick = love.joystick.getJoysticks()[1]
if joystick:isGamepad() == true then
print("joystick 1 \"" .. joystick:getName() .. "\" is a gamepad")
end
_, abutton = joystick:getGamepadMapping("a")
print("A button is " .. abutton)
end
function love.update(dt)
if joystick:isGamepadDown("a") then
print("isGamepadDown(a) == true")
end
if joystick:isDown(abutton) then
print("isDown(a) == true")
end
end
Code: Select all
joystick 1 "Sony PLAYSTATION(R)3 Controller" is a gamepad
A is button 15
Code: Select all
isGamepadDown(a) == true
Code: Select all
isDown(a) == true
Am I wrong in assuming getGamepadMapping should give the same button id that isGamepadDown uses?