diff options
author | Ryan C. Gordon <icculus@icculus.org> | 2015-11-14 12:35:45 -0500 |
---|---|---|
committer | Ryan C. Gordon <icculus@icculus.org> | 2015-11-14 12:35:45 -0500 |
commit | dec3cc9a8ccd3630b4384d32277613b3ae70b41e (patch) | |
tree | f9681d9a162a85bcfe071408f4216b3cca5a4937 /test/testgamecontroller.c | |
parent | 714c88bde1c2ab0c0104006c2ae43d70c4cef314 (diff) | |
download | sdl-dec3cc9a8ccd3630b4384d32277613b3ae70b41e.tar.gz |
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
Diffstat (limited to 'test/testgamecontroller.c')
-rw-r--r-- | test/testgamecontroller.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c index a825e0373..9af9653cc 100644 --- a/test/testgamecontroller.c +++ b/test/testgamecontroller.c @@ -291,6 +291,11 @@ main(int argc, char *argv[]) guid, sizeof (guid)); SDL_Log("Attempting to open device %i, guid %s\n", device, guid); gamecontroller = SDL_GameControllerOpen(device); + + if (gamecontroller != NULL) { + SDL_assert(SDL_GameControllerFromInstanceID(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller))) == gamecontroller); + } + while (keepGoing) { if (gamecontroller == NULL) { if (!reportederror) { @@ -316,6 +321,9 @@ main(int argc, char *argv[]) keepGoing = SDL_FALSE; } else if (event.type == SDL_CONTROLLERDEVICEADDED) { gamecontroller = SDL_GameControllerOpen(event.cdevice.which); + if (gamecontroller != NULL) { + SDL_assert(SDL_GameControllerFromInstanceID(SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller))) == gamecontroller); + } break; } } |