From c5e47c7166560bde83f893525c172b29506dae26 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 26 Oct 2024 17:29:58 +0900 Subject: [PATCH] inpututil: bug fix: `AppendJustReleasedGamepadButtons` and `AppendJustReleasedStandardGamepadButtons` returned just-pressed buttons Closes #3147 --- inpututil/inpututil.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/inpututil/inpututil.go b/inpututil/inpututil.go index 8a7b97145..85c0450bc 100644 --- a/inpututil/inpututil.go +++ b/inpututil/inpututil.go @@ -461,14 +461,12 @@ func AppendJustReleasedGamepadButtons(id ebiten.GamepadID, buttons []ebiten.Game } for b := ebiten.GamepadButton(0); b <= ebiten.GamepadButtonMax; b++ { - if theInputState.gamepadButtonDurations[id][b] == 0 { + if theInputState.gamepadButtonDurations[id][b] != 0 { continue } - - if theInputState.prevGamepadButtonDurations[id][b] > 0 { + if theInputState.prevGamepadButtonDurations[id][b] == 0 { continue } - buttons = append(buttons, b) } @@ -586,14 +584,12 @@ func AppendJustReleasedStandardGamepadButtons(id ebiten.GamepadID, buttons []ebi } for b := ebiten.StandardGamepadButton(0); b <= ebiten.StandardGamepadButtonMax; b++ { - if theInputState.standardGamepadButtonDurations[id][b] == 0 { + if theInputState.standardGamepadButtonDurations[id][b] != 0 { continue } - - if theInputState.prevStandardGamepadButtonDurations[id][b] > 0 { + if theInputState.prevStandardGamepadButtonDurations[id][b] == 0 { continue } - buttons = append(buttons, b) }