#pragma section-numbers off #pragma camelcase off || DRAFT|| ##*^*^*^*^*See http://wiki.libsdl.org/moin.cgi/SGFunctions for details on editing this page*^*^*^*^* = SDL_GameControllerMapping = Use this function to get the current mapping of a Game Controller. <> == Syntax == {{{#!highlight cpp char* SDL_GameControllerMapping(SDL_GameController* gamecontroller) }}} == Function Parameters == ||'''gamecontroller'''||the game controller you want to get the current mapping for|| == Return Value == Returns a string that has the controller's mapping or NULL if no mapping is available; call [[SDL_GetError]]() for more information. == Code Examples == {{{#!highlight cpp #include "SDL.h" /* ... */ SDL_GameController *ctrl; int i; SDL_Init(SDL_INIT_GAMECONTROLLER); for (i = 0; i < SDL_NumJoysticks(); ++i) { if (SDL_IsGameController(i)) { char *mapping; SDL_Log("Index \'%i\' is a compatible controller, named \'%s\'", i, SDL_GameControllerNameForIndex(i)); ctrl = SDL_GameControllerOpen(i); mapping = SDL_GameControllerMapping(ctrl); SDL_Log("Controller %i is mapped as \"%s\".", i, mapping); SDL_free(mapping); } else { SDL_Log("Index \'%i\' is not a compatible controller.", i); } } }}} == Remarks == The returned string must be freed with SDL_free(). More information about the mapping can be found on the page for [[SDL_GameControllerAddMapping]](). == Version == This function is available since SDL 2.0.0. == Related Functions == .[[SDL_GameControllerAddMapping]] .[[SDL_GameControllerMappingForGUID]] ##Remove this section if empty ---- [[CategoryAPI]], [[CategoryGameController]] ##See the Style Guide for instructions on editing the footer.