Implement joystick, recognize background inputs

This commit is contained in:
MMaker 2025-08-23 23:17:44 -04:00
commit 0d8bf75228
Signed by: mmaker
GPG key ID: CCE79B8FEDA40FB2
2 changed files with 54 additions and 40 deletions

View file

@ -10,10 +10,19 @@ function Button:new(x, y, r, b)
end
function Button:update(dt)
if love.keyboard.isDown(self.b) then
if self.b == "triggerleft" or self.b == "triggerright" then
local axis = joystick:getGamepadAxis(self.b)
if axis > 0.5 then
self.press = true
else
else
self.press = false
end
else
if joystick:isGamepadDown(self.b) then
self.press = true
else
self.press = false
end
end
end