Skip to content

Commit

Permalink
inpututil: bug fix: out of range at scanning buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
hajimehoshi committed Jun 29, 2022
1 parent d6e2570 commit 8aeda9f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions inpututil/inpututil.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ func (i *inputState) update() {
if _, ok := i.gamepadButtonDurations[id]; !ok {
i.gamepadButtonDurations[id] = make([]int, ebiten.GamepadButtonMax+1)
}
n := ebiten.GamepadButtonNum(id)
for b := ebiten.GamepadButton(0); b < ebiten.GamepadButton(n); b++ {
for b := ebiten.GamepadButton(0); b <= ebiten.GamepadButtonMax; b++ {
if ebiten.IsGamepadButtonPressed(id, b) {
i.gamepadButtonDurations[id][b]++
} else {
Expand Down

0 comments on commit 8aeda9f

Please sign in to comment.