Re: Improvements to the GameController API

Sam Lantinga <[email protected]> Tue, 27 Dec 2016 19:27:15 -0800
Newsgroups gmane.comp.lib.sdl
Message-ID <CACC3sbEHKMQruErqPPx_hwJXnJcBjs=C90e=6C3fwQaD7w1kaw@mail.gmail.com>
You're welcome! :)

On Tue, Dec 27, 2016 at 5:52 AM, Ed Phillips <[email protected]> wrote:

> Thanks, Sam!
>
> -- Ed
>
> On Dec 27, 2016, at 4:53 AM, Sam Lantinga <[email protected]> wrote:
>
> I've implemented support for inverted axes and independently binding
> separated halves of axes:
> https://hg.libsdl.org/SDL/rev/5ea5f198879f
>
> The syntax for binding half of a game controller axis is:
> -leftx
> +leftx
>
> The syntax for binding half of a joystick axis is:
> +a0
> -a0
>
> The syntax for inverting an axis is:
> a0~
>
> The controllermap test program has been updated to generate the new syntax
> controller config if it detects the appropriate binding types, and allows
> you to map a D-Pad as a thumbstick and vice versa.
>
> Please let me know if there are any problems with this!
>
> On Thu, Dec 1, 2016 at 1:17 PM, RodrigoCard <[email protected]> wrote:
>
>>
>>
>>
>> Sentmoraap wrote:
>>
>> Hello,
>>
>> the gamepad API is far better than a "i have X buttons and Y axes" API
>> and a gamepad-specific API for having good default mappings and consistent
>> mappings from one gamepad to another and from one OS to another.
>>
>> Some issues has already been addressed:
>> http://sdl.5483.n7.nabble.com/Extending-GameController-mappi
>> ng-syntax-td38149.html
>> https://bugzilla.libsdl.org/show_bug.cgi?id=2181
>> https://github.com/cxong/SDL_JoystickButtonNames
>>
>> There is already someone assigned to this bugzilla, but I am willing to
>> contribute if there are improvements which everyone agrees to.
>> I also would like to have more informations on some design decisions.
>>
>>
>> The current syntax does not allow mapping half an axis. On some
>> controller the D-Pad is exposed as 2 axes, and the triggers are halves of
>> the same axis.
>> Sometimes you also need to invert an axis.
>> There is a proposal to have a0+, a0- for halves and a0i (or !a0, ~a0) for
>> an inverted axis.
>> This issue is addressed in the first two links.
>> There is someone assigned, but I have not seen anything new since
>> november 2013.
>>
>> They also discuss about dead zones. I am not sure if handling deadzones
>> fits with the purpose of SDL2 GameController. The game could handle this.
>>
>> We have some mappings defined in SDL_gamecontrollerdb.h, and the project
>> SDL2 game controller. Do we need SDL_gamecontrollerdb.h, can't we just use
>> a text file, provided with the game, which will be easily updatable by the
>> user ?
>>
>> For now the controllers are identified by GUID, which is an OS-dependent
>> number. So we have to provide mappings for every supported platform. The
>> GUID contains the vendor id and the device id. We could provide mappings
>> with the vendor id and the device id instead, assuming the OSes sees the
>> buttons and the axes in the same order. We just have to take into account
>> OS differences (d-pad as axes on Linux etc...). We could provide
>> platform-specific mappings only when it's needed.
>>
>> Linux has an API which provides mappings in a way similar to SDL2 Gamepad.
>> https://www.kernel.org/doc/Documentation/input/gamepad.txt
>> We could use it to provide default mappings when it's not provided by the
>> database. We have to recognize if the mappings complies with the new API.
>> If all buttons and axes used are contiguous, it's likely that the driver
>> did not map events according to the gamepad layout.
>>
>> About the labels. For now we can show the Xbox equivalent, show generic
>> button names, or both. We could add a field "labels:something", which could
>> be generic, xbox, playstation, etc.... This field will just be ignored by
>> the current version. We could just have a fixed set or another database
>> containing the name and color of buttons.
>>
>> Thoughts on those ?
>>
>> Regards.
>>
>>
>>
>> pretty sure SDL_GameController syntax needs some additions,
>> flipping the axes is the most important of them.
>>
>> Steelseries MFI controllers seems to have an inverted Y axis on Mac.
>> Fully Mapping to the GameController API is not possible with these
>> controller because of this.
>>
>>
>> Also the Button Names seems to be a neat idea, anyone working on this?
>>
>>
>> ------------------------------
>>
>> Rodrigo Cardoso Rocha
>> @RodrigoRodrigoR - twitter.com/RodrigoRodrigoR
>> Chibata Creations - chibatacreations.com
>>
>> _______________________________________________
>> SDL mailing list
>> [email protected]
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>
>>
> _______________________________________________
> SDL mailing list
> [email protected]
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>
> _______________________________________________
> SDL mailing list
> [email protected]
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org