Size: 1853
Comment: Removed second category line.
|
Size: 1876
Comment: Changed signature in syntax section, see SGFunctions page.
|
Deletions are marked like this. | Additions are marked like this. |
Line 17: | Line 17: |
string map = SDL_GameControllerMapping(ctrl) | char* SDL_GameControllerMapping(SDL_GameController* gamecontroller) |
DRAFT |
SDL_GameControllerMapping
Use this function to get the current mapping of a Game Controller.
Contents
Syntax
char* SDL_GameControllerMapping(SDL_GameController* gamecontroller)
Function Parameters
SDL_GameController |
The game controller you want to get the current mapping for. |
Return Value
Returns a string that has the controller's mapping. More information about the mapping can be found on SDL_GameControllerAddMapping; call SDL_GetError() for more information.
Code Examples
#include <cstdio> // the printf function
. . .
SDL_GameController *ctrl
for(int i = 0; i < SDL_NumJoysticks(); i++)
{
if (SDL_IsGameController(i))
{
printf("Index \'%i\' is a compatible controller, named \'%s\'\n", i, SDL_GameControllerNameForIndex(i));
ctrl = SDL_GameControllerOpen(i);
printf("Controller %i is mapped as \"%s\".\n", i, SDL_GameControllerMapping(ctrl);
}
else
{
printf("Index \'%i\' is not a compatible controller.", i);
}
}
Remarks
You can add useful comments here