summaryrefslogtreecommitdiff
path: root/test/testgamecontroller.c
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2019-11-22 13:12:12 -0800
committerSam Lantinga <slouken@libsdl.org>2019-11-22 13:12:12 -0800
commitf40ac34ae03a268462e5972c9e7880efbbec14a9 (patch)
tree34374153741d3da5c237925cf3c2ccdb9e14f9d9 /test/testgamecontroller.c
parente092e1c3ffd9338b4039a542104495154991a883 (diff)
downloadsdl-f40ac34ae03a268462e5972c9e7880efbbec14a9.tar.gz
Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached.
Diffstat (limited to 'test/testgamecontroller.c')
-rw-r--r--test/testgamecontroller.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/testgamecontroller.c b/test/testgamecontroller.c
index 8b7f48873..1bcf44086 100644
--- a/test/testgamecontroller.c
+++ b/test/testgamecontroller.c
@@ -292,7 +292,26 @@ main(int argc, char *argv[])
{
nController++;
name = SDL_GameControllerNameForIndex(i);
- description = "Controller";
+ switch (SDL_GameControllerTypeForIndex(i)) {
+ case SDL_CONTROLLER_TYPE_XBOX360:
+ description = "XBox 360 Controller";
+ break;
+ case SDL_CONTROLLER_TYPE_XBOXONE:
+ description = "XBox One Controller";
+ break;
+ case SDL_CONTROLLER_TYPE_PS3:
+ description = "PS3 Controller";
+ break;
+ case SDL_CONTROLLER_TYPE_PS4:
+ description = "PS4 Controller";
+ break;
+ case SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO:
+ description = "Nintendo Switch Pro Controller";
+ break;
+ default:
+ description = "Game Controller";
+ break;
+ }
} else {
name = SDL_JoystickNameForIndex(i);
description = "Joystick";