Skip to content

Commit c5e47c7

Browse files
committed
inpututil: bug fix: AppendJustReleasedGamepadButtons and AppendJustReleasedStandardGamepadButtons returned just-pressed buttons
Closes #3147
1 parent aeff4c2 commit c5e47c7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

inpututil/inpututil.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,12 @@ func AppendJustReleasedGamepadButtons(id ebiten.GamepadID, buttons []ebiten.Game
461461
}
462462

463463
for b := ebiten.GamepadButton(0); b <= ebiten.GamepadButtonMax; b++ {
464-
if theInputState.gamepadButtonDurations[id][b] == 0 {
464+
if theInputState.gamepadButtonDurations[id][b] != 0 {
465465
continue
466466
}
467-
468-
if theInputState.prevGamepadButtonDurations[id][b] > 0 {
467+
if theInputState.prevGamepadButtonDurations[id][b] == 0 {
469468
continue
470469
}
471-
472470
buttons = append(buttons, b)
473471
}
474472

@@ -586,14 +584,12 @@ func AppendJustReleasedStandardGamepadButtons(id ebiten.GamepadID, buttons []ebi
586584
}
587585

588586
for b := ebiten.StandardGamepadButton(0); b <= ebiten.StandardGamepadButtonMax; b++ {
589-
if theInputState.standardGamepadButtonDurations[id][b] == 0 {
587+
if theInputState.standardGamepadButtonDurations[id][b] != 0 {
590588
continue
591589
}
592-
593-
if theInputState.prevStandardGamepadButtonDurations[id][b] > 0 {
590+
if theInputState.prevStandardGamepadButtonDurations[id][b] == 0 {
594591
continue
595592
}
596-
597593
buttons = append(buttons, b)
598594
}
599595

0 commit comments

Comments
 (0)