mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-01 01:17:40 +00:00
Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached.
This commit is contained in:
parent
c0650aca21
commit
b5aff9d7c3
11 changed files with 227 additions and 145 deletions
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue