Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2013-10-27 22:24:48
Size: 1499
Comment: Changed signature format, see SGFunctions page.
Revision 3 as of 2015-04-26 18:53:58
Size: 1499
Comment: Sorted releated functions, see SGFunctions.
Deletions are marked like this. Additions are marked like this.
Line 48: Line 48:
 .[[SDL_GameControllerNameForIndex]]
Line 49: Line 50:
 .[[SDL_GameControllerNameForIndex]]

DRAFT

SDL_GameControllerName

Use this function to get the implementation dependent name for an opened game controller.

Syntax

const char* SDL_GameControllerName(SDL_GameController* gamecontroller)

Function Parameters

gamecontroller

a game controller identifier previously returned by SDL_GameControllerOpen()

Return Value

Returns the implementation dependent name for the game controller, or NULL if there is no name or the identifier passed is invalid.

Code Examples

SDL_GameController *controller = NULL;
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
    controller = SDL_GameControllerOpen(i);
    if (controller) {
        break;
    }
}

if (controller) {
    printf("Found a valid controller, named: %s\n", SDL_GameControllerName(controller));
}

Remarks

This is the same name as returned by SDL_GameControllerNameForIndex, but it takes a controller identifier instead of the (unstable) device index.


CategoryAPI, CategoryGameController

None: SDL_GameControllerName (last edited 2016-04-10 22:25:53 by PhilippWiesemann)

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