summaryrefslogtreecommitdiffhomepage
path: root/controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'controller.lua')
-rw-r--r--controller.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/controller.lua b/controller.lua
index ec9552e..e0bdab1 100644
--- a/controller.lua
+++ b/controller.lua
@@ -57,6 +57,15 @@ function Controller.testControl(set, key, joystick)
end
end
+-- Checks if given action of given set is down
+function Controller.isDown(set, action)
+ if set.joystick == nil then
+ return love.keyboard.isDown(set[action])
+ else
+ return set.joystick:isGamepadDown(set[action])
+ end
+end
+
-- Callbacks from LÖVE2D
-- Create new sets when new joystick is added
function Controller.joystickadded(joystick)