diff options
author | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-01-31 18:38:35 +0800 |
commit | 2ec55fd974a63b705a4777c256d2222c874fa043 (patch) | |
tree | 48f1fea59ee9fc713a28a9aac3f05b98dc5ae66f /Source/3rdParty/SDL2/include/SDL_joystick.h | |
parent | c581dfbf1e849f393861d15e82aa6446c0c1c310 (diff) |
*SDL project
Diffstat (limited to 'Source/3rdParty/SDL2/include/SDL_joystick.h')
-rw-r--r-- | Source/3rdParty/SDL2/include/SDL_joystick.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Source/3rdParty/SDL2/include/SDL_joystick.h b/Source/3rdParty/SDL2/include/SDL_joystick.h index f67772d..6e05a9c 100644 --- a/Source/3rdParty/SDL2/include/SDL_joystick.h +++ b/Source/3rdParty/SDL2/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; @@ -133,6 +133,12 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); /** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + +/** * Return the GUID for the joystick at this index * This can be called before any joysticks are opened. */ @@ -195,6 +201,13 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); /** + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); + +/** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); @@ -362,6 +375,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); |