SDL interprets this as "map -1 to 1, map 0 to -1", so we should do the same.
This fix contains two parts:
* Fix the intended output range.
* Also fix the formula to map a range to a range.
The fix does not change behavior if a "-a" mapping isn't used, as in any other case max-min == 1 or max+min == 0.
Fixes#2334
Before this fix, the button and axis IDs are from the OS. These
didn't match with the SDL game controller databaes unfortunately.
This fix changes the assignments of the buttons and the axes to match
with the database.
Closes#2312
* IDs should have been decoded to a byte slice before checking the
value.
* Ebitengine doesn't treat HID devices on Android so far, so checking
whether the device was HID or not didn't make sense.
Updates #2309
The tool is already referenced in go.mod, so it is trivial to just go run it -
that way, go generate can use it without the user explicitly installing it first.
This is basically a revert of 93a156a718.
This implements parsing the SDL gamepad mappings by Ebiten instead
of GLFW, so that Ebiten can handle parsing errors completely.
Closes#1802
This change introduces the standard gamepad layout. This changes adds
these APIs:
* func HasGamepadStandardLayoutMapping
* func IsGamepadStandardButtonPressed
* func GamepadStandardAxisValue
* type StandardGamepadButton
* type StandardGamepadAxis
The standard gamepad layout is based on the web standard. See
https://www.w3.org/TR/gamepad/#remapping.
On desktops, the SDL's gamecontrllerdb.txt is used. If the gamepad is
listed in the text file, the mapping works. GLFW's mapping featrue is
not used.
On browsers, the property of a gamepad 'mapping' is used. When the
mapping value is 'standard', the gamepad is recognized to have the
standard mapping.
On mobiles, the implementation is still WIP.
Updates #1557