From e1fa3cfc29d06c71b922414bd154c52924b4d878 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 15 Aug 2016 02:16:32 +0200 Subject: Fixed gamepad support --- controller.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'controller.lua') 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 -- cgit v1.1