diff options
author | Aki <nthirtyone@gmail.com> | 2016-08-15 01:08:05 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2016-08-15 01:08:05 +0200 |
commit | 49f485d298593526e1cdca5264e1b1b07b35b637 (patch) | |
tree | 3cb2e2b448997156fab612d9f73462a5517ba530 | |
parent | 1b46cb4fb84f8f21b8766f2a1af5d8a5e9cc15d6 (diff) | |
download | roflnauts-49f485d298593526e1cdca5264e1b1b07b35b637.zip roflnauts-49f485d298593526e1cdca5264e1b1b07b35b637.tar.gz roflnauts-49f485d298593526e1cdca5264e1b1b07b35b637.tar.bz2 |
isDown added
-rw-r--r-- | controller.lua | 9 |
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) |