internal/gamepaddb: enable mappings for iOS

Updates #1557
Closes #1722
This commit is contained in:
Hajime Hoshi 2022-01-09 17:56:54 +09:00
parent 8334ca9a18
commit edff1f0dd9
2 changed files with 5 additions and 6 deletions

View File

@ -499,12 +499,6 @@ func Update(mapping []byte) (bool, error) {
return false, nil
}
// TODO: Implement this (#1722)
if currentPlatform == platformIOS {
// Note: NOT returning an error, as mappings also do not matter right now.
return false, nil
}
mappingsM.Lock()
defer mappingsM.Unlock()

View File

@ -452,6 +452,7 @@ func (i *Input) updateGamepads() {
Name: string(name),
ButtonNum: int(property.nButtons),
AxisNum: int(property.nAxes),
HatNum: int(property.nHats),
}
var state C.struct_ControllerState
@ -476,6 +477,10 @@ func (i *Input) updateGamepads() {
gamepad.Axes[j] = float32(state.axes[j])
}
if gamepad.HatNum > 0 {
gamepad.Hats[0] = int(state.hat)
}
i.gamepads = append(i.gamepads, gamepad)
}
}