diff options
author | Sam Lantinga <slouken@libsdl.org> | 2016-11-10 17:19:34 -0800 |
---|---|---|
committer | Sam Lantinga <slouken@libsdl.org> | 2016-11-10 17:19:34 -0800 |
commit | f2796ce1d73274ba8cafe4fefa1c408f0ca8801d (patch) | |
tree | 0cead7a83312452a9358660f94337867c2171a54 /include/SDL_joystick.h | |
parent | a07b1d5bfd3758f9635a4b14b916eff5e320c2b6 (diff) | |
download | sdl-f2796ce1d73274ba8cafe4fefa1c408f0ca8801d.tar.gz |
Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller.
Diffstat (limited to 'include/SDL_joystick.h')
-rw-r--r-- | include/SDL_joystick.h | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h index f5dbc9487..6bc40403b 100644 --- a/include/SDL_joystick.h +++ b/include/SDL_joystick.h @@ -96,6 +96,33 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** * Open a joystick for use. * The index passed as an argument refers to the N'th joystick on the system. * This index is not the value which will identify this joystick in future @@ -118,14 +145,27 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); /** - * Return the GUID for the joystick at this index + * Return the GUID for this opened joystick */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); /** - * Return the GUID for this opened joystick + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick); /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes @@ -134,7 +174,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** - * convert a string into a joystick formatted guid + * Convert a string into a joystick guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); |