internal/gamepad: bug fix: out of range at hatState on Windows

Closes #2103
This commit is contained in:
Hajime Hoshi 2022-05-25 11:44:43 +09:00
parent 7030840efa
commit 1202e66114

View File

@ -736,6 +736,9 @@ func (g *nativeGamepad) buttonValue(button int) float64 {
func (g *nativeGamepad) hatState(hat int) int {
if g.usesDInput() {
if hat < 0 || hat >= len(g.dinputHats) {
return 0
}
return g.dinputHats[hat]
}