DRAFT |
GameController and Joystick Mapping
Include File(s): SDL_gamecontroller.h
Introduction
This category contains functions for handling game controllers and for mapping joysticks to game controller semantics. This is built on top of the existing joystick API.
SDL_GameController is an abstraction for gamepads ("controllers") similar to the xbox360-pad: They have a DPAD, two analog sticks, 4 buttons on the right (often called A, B, X, Y), shoulder buttons (two of which might be axes) and 3 buttons in the middle (Start, Back and usually some kind of logo-button).
This includes devices that have a similar layout, like the Playstation DualShock Controller, but different button names; SDL_GameController uses the naming-conventions of xbox360/XInput for all supported devices, so you'll know that SDL_CONTROLLER_AXIS_LEFTX is always the X-Axis of the left Analog Stick, or SDL_CONTROLLER_BUTTON_B is always the rightmost buttons of the 4 buttons on the right, for example. This makes providing consistent input bindings (for this kind of device) to your users easy, like "press B to jump, move around with the left analog stick" - with SDL_Joystick (and the underlying APIs like DirectInput) it's impossible to know which SDL (or DirectInput) axis or button corresponds to which physical axis/button on the device.
If you are running your game from Steam, the game controller mapping is automatically provided for your game.
Enumerations
Functions
- SDL_GameControllerAddMapping
- SDL_GameControllerAddMappingsFromFile
- SDL_GameControllerAddMappingsFromRW
- SDL_GameControllerClose
- SDL_GameControllerEventState
- SDL_GameControllerFromInstanceID
- SDL_GameControllerGetAttached
- SDL_GameControllerGetAxis
- SDL_GameControllerGetAxisFromString
- SDL_GameControllerGetBindForAxis
- SDL_GameControllerGetBindForButton
- SDL_GameControllerGetButton
- SDL_GameControllerGetButtonFromString
- SDL_GameControllerGetJoystick
- SDL_GameControllerGetStringForAxis
- SDL_GameControllerGetStringForButton
- SDL_GameControllerMapping
- SDL_GameControllerMappingForGUID
- SDL_GameControllerName
- SDL_GameControllerNameForIndex
- SDL_GameControllerOpen
- SDL_GameControllerUpdate
- SDL_IsGameController