summaryrefslogtreecommitdiffhomepage
path: root/controller.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-08-15 02:16:32 +0200
committerAki <nthirtyone@gmail.com>2016-08-15 02:16:32 +0200
commite1fa3cfc29d06c71b922414bd154c52924b4d878 (patch)
tree1ac02415b97a8d8a3d596d6836e3cfb7c6124595 /controller.lua
parenta32334ab27c86557543dadb91d50fbb72e54940b (diff)
downloadroflnauts-e1fa3cfc29d06c71b922414bd154c52924b4d878.zip
roflnauts-e1fa3cfc29d06c71b922414bd154c52924b4d878.tar.gz
roflnauts-e1fa3cfc29d06c71b922414bd154c52924b4d878.tar.bz2
Fixed gamepad support
Diffstat (limited to 'controller.lua')
-rw-r--r--controller.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/controller.lua b/controller.lua
index 982e5c7..b642bd9 100644
--- a/controller.lua
+++ b/controller.lua
@@ -21,6 +21,7 @@ function Controller.registerSet(left, right, up, down, attack, jump, joystick)
set.down = down or "down"
set.attack = attack or "return"
set.jump = jump or "rshift"
+ set.joystick = joystick
table.insert(Controller.sets, set)
print(set, left, right, up, down, attack, jump, joystick)
return set
@@ -77,23 +78,21 @@ end
-- Gamepad input callbacks
function Controller.gamepadpressed(joystick, key)
local set, action = Controller.testSets(key, joystick)
- print("Pressed:", set, action, key)
+ print(joystick, set, action, key)
Controller.controlpressed(set, action, key)
end
function Controller.gamepadreleased(joystick, key)
local set, action = Controller.testSets(key, joystick)
- print("Released:", set, action, key)
Controller.controlreleased(set, action, key)
end
-- Keyboard input callbacks
function Controller.keypressed(key)
local set, action = Controller.testSets(key, nil)
- print("Pressed:", set, action, key)
+ print(nil, set, action, key)
Controller.controlpressed(set, action, key)
end
function Controller.keyreleased(key)
local set, action = Controller.testSets(key, nil)
- print("Released:", set, action, key)
Controller.controlreleased(set, action, key)
end \ No newline at end of file