SDL_GameController API

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

For those that don’t have the update yet or don’t want to spend time
looking at the relevant files, can somebody post a quick summary of
how this API works? Like what functions are there and such. Nothing
detailed, just to get a quick overview to start getting an idea of how
to use it.

2012/12/10 Alfred Reynolds :> Hey list,

    We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

    As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Is there a possibility of getting this as an add-on lib for SDL 1.2
games? (Even if it doesn’t provide all the hot-plug support). Mainly
it’s nice to have something that actually DOES the mapping of buttons!!

Also, how are you going to distribute gamepad binding updates??On 12/10/2012 01:42 PM, Alfred Reynolds wrote:

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.

  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


Edward Rudd
OutOfOrder.cc
Skype: outoforder_cc
317-674-3296

2012/12/10 Edward Rudd :

Also, how are you going to distribute gamepad binding updates??

Probably though library updates, though I guess that being able to
provide one’s own mapping files in addition could be helpful too. Just
make the format simple enough… this looks like the kind of thing
that could be done with simple INI-like files (though honestly I don’t
know exactly what’s stored so I could be wrong).

Right, via library updates. There is a hinting API that will let you provide your own mappings at runtime if you want more/different from the canned set.

  • Alfred> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Monday, December 10, 2012 12:17 PM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

2012/12/10 Edward Rudd :

Also, how are you going to distribute gamepad binding updates??

Probably though library updates, though I guess that being able to
provide one’s own mapping files in addition could be helpful too. Just
make the format simple enough… this looks like the kind of thing
that could be done with simple INI-like files (though honestly I don’t
know exactly what’s stored so I could be wrong).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

The API mimics the joystick one, with the expect open/close calls, the get button/axis and matching events for each of these. If you use the joystick API this should be a drop in replacement after name changes for the functions/events.

The SDL_gamecontroller.h header can be read here:
http://hg.libsdl.org/SDL/file/1b5280cd5885/include/SDL_gamecontroller.h

  • Alfred> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Monday, December 10, 2012 11:24 AM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

For those that don’t have the update yet or don’t want to spend time
looking at the relevant files, can somebody post a quick summary of
how this API works? Like what functions are there and such. Nothing
detailed, just to get a quick overview to start getting an idea of how
to use it.

2012/12/10 Alfred Reynolds :

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

    As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Now is a great time to migrate to SDL2! :stuck_out_tongue:

–ryan.On 12/10/12 3:07 PM, Edward Rudd wrote:

Is there a possibility of getting this as an add-on lib for SDL 1.2
games? (Even if it doesn’t provide all the hot-plug support). Mainly
it’s nice to have something that actually DOES the mapping of buttons!!

I imagine SDL_GameControllerGetBindForButton is the function used to
retrieve what’s the real mapping for a given role? Because I can see
this API being mostly useful for assigning default mappings (all
games should support customizable controls, no exception).

2012/12/10 Alfred Reynolds :> The API mimics the joystick one, with the expect open/close calls, the get button/axis and matching events for each of these. If you use the joystick API this should be a drop in replacement after name changes for the functions/events.

The SDL_gamecontroller.h header can be read here:
http://hg.libsdl.org/SDL/file/1b5280cd5885/include/SDL_gamecontroller.h

  • Alfred

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Monday, December 10, 2012 11:24 AM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

For those that don’t have the update yet or don’t want to spend time
looking at the relevant files, can somebody post a quick summary of
how this API works? Like what functions are there and such. Nothing
detailed, just to get a quick overview to start getting an idea of how
to use it.

2012/12/10 Alfred Reynolds :

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

    As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

A normal game should allow the user to map from SDL_CONTROLLER_BUTTON/AXIS to different in game actions, don’t map using this raw joystick binding data.

This API is to allow games to escape the controller API if they need to for specific reasons (like a flight sim game that wants to party on all the buttons on flight sticks) or for Steam to collect raw binding data from users (something a game needn’t do).> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Tuesday, December 11, 2012 5:28 PM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

I imagine SDL_GameControllerGetBindForButton is the function used to
retrieve what’s the real mapping for a given role? Because I can see
this API being mostly useful for assigning default mappings (all
games should support customizable controls, no exception).

2012/12/10 Alfred Reynolds :

The API mimics the joystick one, with the expect open/close calls, the get button/axis and matching events for each of these. If you use the joystick API this should be a drop in replacement after name changes for the functions/events.

The SDL_gamecontroller.h header can be read here:
http://hg.libsdl.org/SDL/file/1b5280cd5885/include/SDL_gamecontroller.h

  • Alfred

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Monday, December 10, 2012 11:24 AM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

For those that don’t have the update yet or don’t want to spend time
looking at the relevant files, can somebody post a quick summary of
how this API works? Like what functions are there and such. Nothing
detailed, just to get a quick overview to start getting an idea of how
to use it.

2012/12/10 Alfred Reynolds :

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

    As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

As I said, the main reason a game may want to use this API for is to
assign default mappings. If the player doesn’t change them, then the
mappings for these bindings are what will end up being used.

2012/12/11 Alfred Reynolds :> A normal game should allow the user to map from SDL_CONTROLLER_BUTTON/AXIS to different in game actions, don’t map using this raw joystick binding data.

This API is to allow games to escape the controller API if they need to for specific reasons (like a flight sim game that wants to party on all the buttons on flight sticks) or for Steam to collect raw binding data from users (something a game needn’t do).

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Tuesday, December 11, 2012 5:28 PM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

I imagine SDL_GameControllerGetBindForButton is the function used to
retrieve what’s the real mapping for a given role? Because I can see
this API being mostly useful for assigning default mappings (all
games should support customizable controls, no exception).

2012/12/10 Alfred Reynolds :

The API mimics the joystick one, with the expect open/close calls, the get button/axis and matching events for each of these. If you use the joystick API this should be a drop in replacement after name changes for the functions/events.

The SDL_gamecontroller.h header can be read here:
http://hg.libsdl.org/SDL/file/1b5280cd5885/include/SDL_gamecontroller.h

  • Alfred

-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On Behalf Of Sik the hedgehog
Sent: Monday, December 10, 2012 11:24 AM
To: SDL Development List
Subject: Re: [SDL] SDL_GameController API

For those that don’t have the update yet or don’t want to spend time
looking at the relevant files, can somebody post a quick summary of
how this API works? Like what functions are there and such. Nothing
detailed, just to get a quick overview to start getting an idea of how
to use it.

2012/12/10 Alfred Reynolds :

Hey list,
We have added a new API to SDL, SDL_GameController. This subsystem wraps the joystick API and provides an idealized game controller output for a wide range of joystick devices. The goal of the GameController API is to let games consume simple controller input events (button A presses, left stick X moved) for a wide range of hardware. We currently support a reasonably large range of controllers on Windows and OS X, we will be growing the supported list over time (with the help of the Big Picture mode in Steam to provide mappings).

    As a part of the joystick support we have also added support for hot-plugging of joysticks and we make use of XInput where available on Windows. If your game is designed to work with game controllers then this is the API for you, it removes the need for large mapping tables on each OS for the different physical mappings joysticks present to SDL.
  • Alfred

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org