Added effects support for virtual controllers

This commit is contained in:
Sam Lantinga 2022-05-16 07:21:28 -07:00
parent b3a18706ee
commit f0bc5c9cbf
3 changed files with 73 additions and 1 deletions

View file

@ -352,6 +352,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
* The structure that defines an extended virtual joystick description
*
* The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
* All other elements of this structure are optional and can be left 0.
*
* \sa SDL_JoystickAttachVirtualEx
*/
@ -373,6 +374,11 @@ typedef struct SDL_VirtualJoystickDesc
void *userdata; /**< User data pointer passed to callbacks */
void (*Update)(void *userdata); /**< Called when the joystick state should be updated */
void (*SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
int (*Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_JoystickRumble() */
int (*RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_JoystickRumbleTriggers() */
int (*SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_JoystickSetLED() */
int (*SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_JoystickSendEffect() */
} SDL_VirtualJoystickDesc;