diff --git a/inpututil/inpututil.go b/inpututil/inpututil.go index 0d03a42f9..752a1ef12 100644 --- a/inpututil/inpututil.go +++ b/inpututil/inpututil.go @@ -141,8 +141,8 @@ func (i *inputState) update() { i.gamepadButtonDurations[id] = make([]int, ebiten.GamepadButtonMax+1) } n := ebiten.GamepadButtonNum(id) - if n > ebiten.GamepadButtonMax+1 { - n = ebiten.GamepadButtonMax + 1 + if n > int(ebiten.GamepadButtonMax)+1 { + n = int(ebiten.GamepadButtonMax) + 1 } for b := ebiten.GamepadButton(0); b < ebiten.GamepadButton(n); b++ { if ebiten.IsGamepadButtonPressed(id, b) {