suppress JUST_PRESSED event on first frame with gamepad input

This commit is contained in:
2023-07-07 09:05:47 -06:00
parent 81396050dd
commit bc5213d4d3

View File

@@ -33,13 +33,17 @@
(unless gamepadId (set gamepadId FlxInputDeviceID.ALL))
(set buttonActions
(for =>buttonId keyString buttonToKeyMappings
(.addGamepad
(new FlxActionDigital
"${buttonId}->${keyString}"
->:Void _ (handleKey keyString))
buttonId
JUST_PRESSED
gamepadId))))
(let [action
(.addGamepad
(new FlxActionDigital
"${buttonId}->${keyString}")
buttonId
JUST_PRESSED
gamepadId)]
// capture the fake JUST_PRESSED event harmlessly
(action.update)
(set action.callback ->:Void _ (handleKey keyString))
action))))
(method :Void update []
(doFor action buttonActions