summaryrefslogtreecommitdiff
path: root/include/SDL_joystick.h
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2017-01-27 05:59:58 -0800
committerSam Lantinga <slouken@libsdl.org>2017-01-27 05:59:58 -0800
commitde3eae576b1a9ffd5915e6019bd4ea93c59d96dc (patch)
tree020b08a1a0ad1eba2f2a75636c7b596c5d1f7a6d /include/SDL_joystick.h
parentb96cc710bea07905345b77dbc64a9e3dc57eb1ae (diff)
downloadsdl-de3eae576b1a9ffd5915e6019bd4ea93c59d96dc.tar.gz
Added an API to get the type of a connected joystick
Diffstat (limited to 'include/SDL_joystick.h')
-rw-r--r--include/SDL_joystick.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h
index a15fbb539..d40432e22 100644
--- a/include/SDL_joystick.h
+++ b/include/SDL_joystick.h
@@ -75,6 +75,19 @@ typedef Sint32 SDL_JoystickID;
typedef enum
{
+ SDL_JOYSTICK_TYPE_UNKNOWN,
+ SDL_JOYSTICK_TYPE_GAMECONTROLLER,
+ SDL_JOYSTICK_TYPE_WHEEL,
+ SDL_JOYSTICK_TYPE_ARCADE_STICK,
+ SDL_JOYSTICK_TYPE_FLIGHT_STICK,
+ SDL_JOYSTICK_TYPE_DANCE_PAD,
+ SDL_JOYSTICK_TYPE_GUITAR,
+ SDL_JOYSTICK_TYPE_DRUM_KIT,
+ SDL_JOYSTICK_TYPE_ARCADE_PAD,
+} SDL_JoystickType;
+
+typedef enum
+{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
SDL_JOYSTICK_POWER_EMPTY,
SDL_JOYSTICK_POWER_LOW,
@@ -125,6 +138,12 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index);
/**
+ * Get the type of a joystick, if available.
+ * This can be called before any joysticks are opened.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(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
@@ -170,6 +189,11 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick);
extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick);
/**
+ * Get the type of an opened joystick.
+ */
+extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick);
+
+/**
* Return a string representation for this guid. pszGUID must point to at least 33 bytes
* (32 for the string plus a NULL terminator).
*/