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_LastController,
  k_eControllertype_GenericKeyboard = 400,
  k_eControllertype_GenericMouse = 800
}
 

Functions

static SDL_bool BIsSteamController (EControllerType eType)
 
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 72 of file controller_type.h.

Referenced by GuessControllerType().

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_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_LastController, // Don't add game controllers below this enumeration - this enumeration can change value
61 
62  // Keyboards and Mice
EControllerType

Function Documentation

◆ BIsSteamController()

◆ GuessControllerType()

static EControllerType GuessControllerType ( int  nVID,
int  nPID 
)
inlinestatic

Definition at line 410 of file controller_type.h.

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().

411 {
412  unsigned int unDeviceID = MAKE_CONTROLLER_ID( nVID, nPID );
413  int iIndex;
414  for ( iIndex = 0; iIndex < sizeof( arrControllers ) / sizeof( arrControllers[0] ); ++iIndex )
415  {
416  if ( unDeviceID == arrControllers[ iIndex ].m_unDeviceID )
417  {
418  return arrControllers[ iIndex ].m_eControllerType;
419  }
420  }
421 #undef MAKE_CONTROLLER_ID
422 
424 }
EControllerType m_eControllerType
static const ControllerDescription_t arrControllers[]
#define MAKE_CONTROLLER_ID(nVID, nPID)

Variable Documentation

◆ arrControllers

const ControllerDescription_t arrControllers[]
static

Definition at line 79 of file controller_type.h.

Referenced by GuessControllerType().