Wiki Page Content

Revision 10 as of 2019-02-24 04:17:15

Clear message

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


CategoryCategory

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit