Added ability to bind joystick buttons (not yet used)
This commit is contained in:
parent
6f7e0777b1
commit
0162c2f353
2 changed files with 16 additions and 4 deletions
|
@ -135,6 +135,18 @@ function menu_state:keyreleased(key, unicode)
|
|||
|
||||
end
|
||||
|
||||
function menu_state:joystickpressed(key, button)
|
||||
if currentlyChosen == nil then
|
||||
else
|
||||
local key = string.format("button%d", button)
|
||||
KEYMAP[currentlyChosen.data.player][currentlyChosen.data.key][currentlyChosen.data.bindingIdx] = key
|
||||
currentlyChosen.data.label.label = key
|
||||
currentlyChosen:delete()
|
||||
currentlyChosen = nil
|
||||
save_settings()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function menu_state:mousepressed(x, y, button)
|
||||
for key, entity in pairs(menu_state.entity_list) do
|
||||
|
|
|
@ -16,18 +16,18 @@ KEYMAP = {
|
|||
ccw = { 'k' },
|
||||
cw = { 'l' },
|
||||
flip = { ',' },
|
||||
shoot = { 'o' },
|
||||
shoot = { 'o', 'button8' },
|
||||
accelerate = { 'j' },
|
||||
decelerate = { 'm' }
|
||||
decelerate = { 'm', 'button7' }
|
||||
},
|
||||
|
||||
[2] = {
|
||||
ccw = { 'a' },
|
||||
cw = { 's' },
|
||||
flip = { 'a' },
|
||||
shoot = { 'w' },
|
||||
shoot = { 'w', 'button8' },
|
||||
accelerate = { 'x' },
|
||||
decelerate = { 'z' }
|
||||
decelerate = { 'z', 'button7' }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue