inpututil: bug fix: out of range at scanning buttons

Updates #2169
This commit is contained in:
Hajime Hoshi 2022-06-29 15:55:05 +09:00
parent d6e257084d
commit 8aeda9f543

View File

@ -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 {