Wiki Page Content

Differences between revisions 5 and 6
Revision 5 as of 2013-02-27 06:27:00
Size: 1546
Editor: Sam Lantinga
Comment:
Revision 6 as of 2013-09-14 19:01:07
Size: 1595
Editor: Sean Colombo
Comment: SDL_GameControllerClose takes an IntPtr to the device, not the controller index.
Deletions are marked like this. Additions are marked like this.
Line 33: Line 33:
            SDL_GameControllerClose(i);             SDL_GameControllerClose(controller);
Line 52: Line 52:
[[CategoryAPI]], [[CategoryGameController]] [[CategoryAPI]], [[CategoryGameController]], [[CategoryInput]]
Line 54: Line 54:
----
CategoryInput

DRAFT

SDL_GameControllerClose

Use this function to close a game controller previously opened with SDL_GameControllerOpen().

Syntax

void SDL_GameControllerClose(SDL_GameController * gamecontroller);

Function Parameters

gamecontroller

a game controller identifier previously returned by SDL_GameControllerOpen()

Code Examples

/* Attempt to open every controller. */
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
    if (SDL_IsGameController(i)) {
        SDL_GameController *controller = SDL_GameControllerOpen(i);
        if (controller) {
            SDL_GameControllerClose(controller);
        } else {
            fprintf(stderr, "Could not open gamecontroller %i: %s\n", i, SDL_GetError());
        }
    }
}

Remarks

You can add useful comments here


CategoryAPI, CategoryGameController, CategoryInput


CategoryInput

None: SDL_GameControllerClose (last edited 2013-10-26 16:55:13 by PhilippWiesemann)

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