From 49f485d298593526e1cdca5264e1b1b07b35b637 Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 15 Aug 2016 01:08:05 +0200 Subject: isDown added --- controller.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'controller.lua') 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) -- cgit v1.1