Skip to content

Commit

Permalink
Ignore unmapped pads (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
kivutar authored Jul 18, 2021
1 parent ba1b6e4 commit 5749239
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions input/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ func floatToAnalog(v float32) int16 {

// pollJoypads process joypads of all players
func pollJoypads(state States, analogState AnalogStates) (States, AnalogStates) {
for p := range state {
joystik := glfw.Joystick(p)
if !joystik.IsGamepad() {
p := 0
for joy := glfw.Joystick(0); joy < glfw.JoystickLast; joy++ {
if !joy.IsGamepad() {
continue
}
pad := glfw.Joystick.GetGamepadState(joystik)
pad := joy.GetGamepadState()
if pad == nil {
continue
}
Expand Down Expand Up @@ -118,6 +118,7 @@ func pollJoypads(state States, analogState AnalogStates) (States, AnalogStates)
state[p][lr.DeviceIDJoypadUp] = 1
}
}
p++
}

return state, analogState
Expand Down

0 comments on commit 5749239

Please sign in to comment.