diff --git a/main.lua b/main.lua index 64dfbf7..6699f2e 100644 --- a/main.lua +++ b/main.lua @@ -258,27 +258,13 @@ function love.joystickhat(joystick, hat, direction) has_hat = true end if input_pressed then - dir = direction - for i, direction in ipairs{"d", "l", "u", "r"} do - if dir:sub(1, 1) == direction or dir:sub(2) == direction then - scene:onInputPress({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) - else - scene:onInputRelease({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) - end - end + scene:onInputPress({input=input_pressed, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) elseif has_hat then for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do scene:onInputRelease({input=config.input.joysticks[joystick:getName()].hats[hat][direction], type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) end elseif direction ~= "c" then - dir = direction - for i, direction in ipairs{"d", "l", "u", "r"} do - if dir:sub(1, 1) == direction or dir:sub(2) == direction then - scene:onInputPress({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) - else - scene:onInputRelease({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) - end - end + scene:onInputPress({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction}) else for i, direction in ipairs{"d", "l", "ld", "lu", "r", "rd", "ru", "u"} do scene:onInputRelease({input=nil, type="joyhat", name=joystick:getName(), hat=hat, direction=direction})