Use all pair and even buttons of the joysticks as buttons 0 and 1 (one of the buttons of my controller broke)

This commit is contained in:
Ivan Izaguirre 2020-10-05 22:17:19 +02:00
parent 4fca7dc828
commit e18b44c88d
1 changed files with 3 additions and 3 deletions

View File

@ -71,12 +71,12 @@ func (j *sdlJoysticks) putAxisEvent(e *sdl.JoyAxisEvent) {
}
func (j *sdlJoysticks) putButtonEvent(e *sdl.JoyButtonEvent) {
if e.Which >= 2 || e.Button >= 2 {
// Process only the first two buttons of the first two joysticks
if e.Which >= 2 {
// Process only the buttons of the first two joysticks
return
}
j.button[uint8(e.Which)*2+e.Button] = (e.State != 0)
j.button[uint8(e.Which)*2+(e.Button%2)] = (e.State != 0)
}
func mouseToJoyFull(x int32, w int32) uint8 {