summaryrefslogtreecommitdiff
path: root/include/SDL_joystick.h
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2018-08-09 16:00:17 -0700
committerSam Lantinga <slouken@libsdl.org>2018-08-09 16:00:17 -0700
commit6fc6bfca0277f18d61a4ef071151ed41401c70f6 (patch)
tree0cf1a7fce1d1e005bb903e6858e013f13bebeb88 /include/SDL_joystick.h
parent6c65dfa2ec6649b125881ce422506fcb38af8c5b (diff)
downloadsdl-6fc6bfca0277f18d61a4ef071151ed41401c70f6.tar.gz
Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
Diffstat (limited to 'include/SDL_joystick.h')
-rw-r--r--include/SDL_joystick.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/SDL_joystick.h b/include/SDL_joystick.h
index f67772d71..8303c5e86 100644
--- a/include/SDL_joystick.h
+++ b/include/SDL_joystick.h
@@ -97,10 +97,10 @@ typedef enum
typedef enum
{
SDL_JOYSTICK_POWER_UNKNOWN = -1,
- SDL_JOYSTICK_POWER_EMPTY,
- SDL_JOYSTICK_POWER_LOW,
- SDL_JOYSTICK_POWER_MEDIUM,
- SDL_JOYSTICK_POWER_FULL,
+ SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */
+ SDL_JOYSTICK_POWER_LOW, /* <= 20% */
+ SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */
+ SDL_JOYSTICK_POWER_FULL, /* <= 100% */
SDL_JOYSTICK_POWER_WIRED,
SDL_JOYSTICK_POWER_MAX
} SDL_JoystickPowerLevel;
@@ -362,6 +362,19 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick,
int button);
/**
+ * Trigger a rumble effect
+ * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
+ *
+ * \param joystick The joystick to vibrate
+ * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF
+ * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF
+ * \param duration_ms The duration of the rumble effect, in milliseconds
+ *
+ * \return 0, or -1 if rumble isn't supported on this joystick
+ */
+extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
+
+/**
* Close a joystick previously opened with SDL_JoystickOpen().
*/
extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick * joystick);