SDL 2.0
controller_type.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ControllerDescription_t
 

Macros

#define inline   SDL_INLINE
 
#define MAKE_CONTROLLER_ID(nVID, nPID)   (unsigned int)( nVID << 16 | nPID )
 

Enumerations

enum  EControllerType {
  k_eControllerType_None = -1 ,
  k_eControllerType_Unknown = 0 ,
  k_eControllerType_UnknownSteamController = 1 ,
  k_eControllerType_SteamController = 2 ,
  k_eControllerType_SteamControllerV2 = 3 ,
  k_eControllerType_UnknownNonSteamController = 30 ,
  k_eControllerType_XBox360Controller = 31 ,
  k_eControllerType_XBoxOneController = 32 ,
  k_eControllerType_PS3Controller = 33 ,
  k_eControllerType_PS4Controller = 34 ,
  k_eControllerType_WiiController = 35 ,
  k_eControllerType_AppleController = 36 ,
  k_eControllerType_AndroidController = 37 ,
  k_eControllerType_SwitchProController = 38 ,
  k_eControllerType_SwitchJoyConLeft = 39 ,
  k_eControllerType_SwitchJoyConRight = 40 ,
  k_eControllerType_SwitchJoyConPair = 41 ,
  k_eControllerType_SwitchInputOnlyController = 42 ,
  k_eControllerType_MobileTouch = 43 ,
  k_eControllerType_XInputSwitchController = 44 ,
  k_eControllerType_LastController ,
  k_eControllertype_GenericKeyboard = 400 ,
  k_eControllertype_GenericMouse = 800
}
 

Functions

static EControllerType GuessControllerType (int nVID, int nPID)
 

Variables

static const ControllerDescription_t arrControllers []
 

Macro Definition Documentation

◆ inline

#define inline   SDL_INLINE

Definition at line 28 of file controller_type.h.

◆ MAKE_CONTROLLER_ID

#define MAKE_CONTROLLER_ID (   nVID,
  nPID 
)    (unsigned int)( nVID << 16 | nPID )

Definition at line 68 of file controller_type.h.

Enumeration Type Documentation

◆ EControllerType

Enumerator
k_eControllerType_None 
k_eControllerType_Unknown 
k_eControllerType_UnknownSteamController 
k_eControllerType_SteamController 
k_eControllerType_SteamControllerV2 
k_eControllerType_UnknownNonSteamController 
k_eControllerType_XBox360Controller 
k_eControllerType_XBoxOneController 
k_eControllerType_PS3Controller 
k_eControllerType_PS4Controller 
k_eControllerType_WiiController 
k_eControllerType_AppleController 
k_eControllerType_AndroidController 
k_eControllerType_SwitchProController 
k_eControllerType_SwitchJoyConLeft 
k_eControllerType_SwitchJoyConRight 
k_eControllerType_SwitchJoyConPair 
k_eControllerType_SwitchInputOnlyController 
k_eControllerType_MobileTouch 
k_eControllerType_XInputSwitchController 
k_eControllerType_LastController 
k_eControllertype_GenericKeyboard 
k_eControllertype_GenericMouse 

Definition at line 35 of file controller_type.h.

36{
39
40 // Steam Controllers
44
45 // Other Controllers
60 k_eControllerType_XInputSwitchController = 44, // Client-side only, used to mark Switch-compatible controllers as not supporting Switch controller protocol
61 k_eControllerType_LastController, // Don't add game controllers below this enumeration - this enumeration can change value
62
63 // Keyboards and Mice
EControllerType
@ k_eControllerType_MobileTouch
@ k_eControllerType_AndroidController
@ k_eControllerType_SteamController
@ k_eControllerType_SwitchJoyConLeft
@ k_eControllerType_XInputSwitchController
@ k_eControllerType_AppleController
@ k_eControllerType_PS3Controller
@ k_eControllerType_Unknown
@ k_eControllerType_LastController
@ k_eControllerType_SteamControllerV2
@ k_eControllertype_GenericKeyboard
@ k_eControllertype_GenericMouse
@ k_eControllerType_WiiController
@ k_eControllerType_SwitchProController
@ k_eControllerType_PS4Controller
@ k_eControllerType_XBox360Controller
@ k_eControllerType_SwitchJoyConRight
@ k_eControllerType_XBoxOneController
@ k_eControllerType_UnknownSteamController
@ k_eControllerType_SwitchJoyConPair
@ k_eControllerType_UnknownNonSteamController
@ k_eControllerType_SwitchInputOnlyController
@ k_eControllerType_None

Function Documentation

◆ GuessControllerType()

static EControllerType GuessControllerType ( int  nVID,
int  nPID 
)
inlinestatic

Definition at line 427 of file controller_type.h.

428{
429 unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID );
430 int iIndex;
431 for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex )
432 {
433 if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID )
434 {
435 return arrControllers[ iIndex ].m_eControllerType;
436 }
437 }
438
440
441}
#define MAKE_CONTROLLER_ID(nVID, nPID)
static const ControllerDescription_t arrControllers[]
EControllerType m_eControllerType

References arrControllers, k_eControllerType_UnknownNonSteamController, ControllerDescription_t::m_eControllerType, and MAKE_CONTROLLER_ID.

Referenced by SDL_GetJoystickGUIDType(), SDL_IsJoystickNintendoSwitchPro(), SDL_IsJoystickPS4(), SDL_IsJoystickSteamController(), SDL_IsJoystickXbox360(), and SDL_IsJoystickXboxOne().

Variable Documentation

◆ arrControllers

const ControllerDescription_t arrControllers[]
static

Definition at line 75 of file controller_type.h.

Referenced by GuessControllerType().