Each player can only bind buttons from their own joystick
This commit is contained in:
parent
2af0378bb7
commit
541dc1e38c
1 changed files with 8 additions and 15 deletions
|
@ -92,23 +92,16 @@ end
|
||||||
function menu_state:update(dt)
|
function menu_state:update(dt)
|
||||||
menuTime = menuTime + dt
|
menuTime = menuTime + dt
|
||||||
|
|
||||||
local buttons
|
|
||||||
for i, joystick in ipairs(love.joystick.getJoysticks()) do
|
|
||||||
local jButtons = getJoystickButtons(joystick)
|
|
||||||
if buttons == nil then
|
|
||||||
buttons = jButtons
|
|
||||||
else
|
|
||||||
for j = 1, #buttons, 1 do
|
|
||||||
buttons[j] = buttons[j] or jButtons[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if currentlyChosen ~= nil then
|
if currentlyChosen ~= nil then
|
||||||
local button = nil
|
local button = nil
|
||||||
for i = 1, #buttons, 1 do
|
local joysticks = love.joystick.getJoysticks()
|
||||||
if buttons[i] then
|
if #joysticks >= currentlyChosen.data.player then
|
||||||
button = i
|
local buttons = getJoystickButtons(joysticks[currentlyChosen.data.player])
|
||||||
|
|
||||||
|
for i = 1, #buttons, 1 do
|
||||||
|
if buttons[i] then
|
||||||
|
button = i
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue