1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-28 01:29:31 +00:00

Add triggerThresold (0.5 by default) for buttons associated with axes, grabbing terminology change

courtesy of Lenade Lamidedi
This commit is contained in:
Étienne Fildadut 2020-04-02 21:02:09 +02:00
parent f22e0bef26
commit d85424d866
3 changed files with 95 additions and 80 deletions

View file

@ -113,9 +113,9 @@ input.basicButtonDetector = function(id)
-- Gamepad axis
elseif id:match("^gamepad%.axis%.") then
local gid, axis, threshold = id:match("^gamepad%.axis%.(.+)%.(.+)%%(.+)$")
if not gid then gid, axis = id:match("^gamepad%.axis%.(.+)%.(.+)$") end -- no threshold (=0)
if not gid then gid, axis = id:match("^gamepad%.axis%.(.+)%.(.+)$") end -- no threshold (=0.5)
gid = tonumber(gid)
threshold = tonumber(threshold) or 0.1
threshold = tonumber(threshold) or 0.5
return function()
local gamepad
for _,j in ipairs(love.joystick.getJoysticks()) do
@ -168,7 +168,7 @@ input.basicAxisDetector = function(id)
-- Gamepad axis
elseif id:match("^gamepad%.axis%.") then
local gid, axis, threshold = id:match("^gamepad%.axis%.(.+)%.(.+)%%(.+)$")
if not gid then gid, axis = id:match("^gamepad%.axis%.(.+)%.(.+)$") end -- no threshold (=0)
if not gid then gid, axis = id:match("^gamepad%.axis%.(.+)%.(.+)$") end -- no threshold (=0.1)
gid = tonumber(gid)
threshold = tonumber(threshold) or 0.1
return function()