Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
The joystick events contain a joystick instance ID, which is a signed…
… value, with -1 being invalid.
  • Loading branch information
slouken committed Mar 6, 2013
1 parent 249bd54 commit ad0f387
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions include/SDL_events.h
Expand Up @@ -244,7 +244,7 @@ typedef struct SDL_JoyAxisEvent
{
Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
Uint8 padding2;
Expand All @@ -259,8 +259,8 @@ typedef struct SDL_JoyAxisEvent
typedef struct SDL_JoyBallEvent
{
Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */
Uint8 padding1;
Uint8 padding2;
Expand All @@ -275,8 +275,8 @@ typedef struct SDL_JoyBallEvent
typedef struct SDL_JoyHatEvent
{
Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value.
* \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
Expand All @@ -295,8 +295,8 @@ typedef struct SDL_JoyHatEvent
typedef struct SDL_JoyButtonEvent
{
Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Expand All @@ -310,7 +310,7 @@ typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp;
Uint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;


Expand All @@ -320,8 +320,8 @@ typedef struct SDL_JoyDeviceEvent
typedef struct SDL_ControllerAxisEvent
{
Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
Uint8 padding1;
Uint8 padding2;
Expand All @@ -337,8 +337,8 @@ typedef struct SDL_ControllerAxisEvent
typedef struct SDL_ControllerButtonEvent
{
Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp;
Uint32 which; /**< The joystick instance id */
Uint32 timestamp;
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Expand All @@ -353,7 +353,7 @@ typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp;
Uint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;


Expand Down
4 changes: 2 additions & 2 deletions include/SDL_joystick.h
Expand Up @@ -67,7 +67,7 @@ typedef struct {
Uint8 data[16];
} SDL_JoystickGUID;

typedef Uint32 SDL_JoystickID;
typedef Sint32 SDL_JoystickID;


/* Function prototypes */
Expand Down Expand Up @@ -126,7 +126,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick * joystick);

/**
* Get the instance ID of an opened joystick.
* Get the instance ID of an opened joystick or -1 if the joystick is invalid.
*/
extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick * joystick);

Expand Down
4 changes: 2 additions & 2 deletions src/joystick/windows/SDL_dxjoystick.c
Expand Up @@ -67,7 +67,7 @@ static SDL_bool coinitialized = SDL_FALSE;
static LPDIRECTINPUT8 dinput = NULL;
static SDL_bool s_bDeviceAdded = SDL_FALSE;
static SDL_bool s_bDeviceRemoved = SDL_FALSE;
static int s_nInstanceID = -1;
static SDL_JoystickID s_nInstanceID = -1;
static GUID *s_pKnownJoystickGUIDs = NULL;
static SDL_cond *s_condJoystickThread = NULL;
static SDL_mutex *s_mutexJoyStickEnum = NULL;
Expand All @@ -85,7 +85,7 @@ struct JoyStick_DeviceData_
DIDEVICEINSTANCE dxdevice;
char *joystickname;
Uint8 send_add_event;
int nInstanceID;
SDL_JoystickID nInstanceID;
SDL_bool bXInputDevice;
Uint8 XInputUserId;
struct JoyStick_DeviceData_ *pNext;
Expand Down

0 comments on commit ad0f387

Please sign in to comment.