Skip to content

Commit

Permalink
inpututil: bug fix: AppendJustReleasedGamepadButtons and `AppendJus…
Browse files Browse the repository at this point in the history
…tReleasedStandardGamepadButtons` returned just-pressed buttons

Closes #3147
  • Loading branch information
hajimehoshi committed Oct 26, 2024
1 parent aeff4c2 commit c5e47c7
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions inpututil/inpututil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit c5e47c7

Please sign in to comment.