From 8aeda9f5435da82d81417ae78b1e8dd1acb56645 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 29 Jun 2022 15:55:05 +0900 Subject: [PATCH] inpututil: bug fix: out of range at scanning buttons Updates #2169 --- inpututil/inpututil.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inpututil/inpututil.go b/inpututil/inpututil.go index 1fdb6e4cc..547025956 100644 --- a/inpututil/inpututil.go +++ b/inpututil/inpututil.go @@ -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 {