Added support for the touchpad on PS4 and PS5 controllers

This commit is contained in:
Sam Lantinga
2020-11-13 18:01:29 -08:00
parent 78422fa3c8
commit 9f51fad361
13 changed files with 434 additions and 61 deletions

View File

@@ -39,6 +39,20 @@ typedef struct _SDL_JoystickAxisInfo
SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */
} SDL_JoystickAxisInfo;
typedef struct _SDL_JoystickTouchpadFingerInfo
{
Uint8 state;
float x;
float y;
float pressure;
} SDL_JoystickTouchpadFingerInfo;
typedef struct _SDL_JoystickTouchpadInfo
{
int nfingers;
SDL_JoystickTouchpadFingerInfo *fingers;
} SDL_JoystickTouchpadInfo;
struct _SDL_Joystick
{
SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */
@@ -60,6 +74,9 @@ struct _SDL_Joystick
int nbuttons; /* Number of buttons on the joystick */
Uint8 *buttons; /* Current button states */
int ntouchpads; /* Number of touchpads on the joystick */
SDL_JoystickTouchpadInfo *touchpads; /* Current touchpad states */
Uint16 low_frequency_rumble;
Uint16 high_frequency_rumble;
Uint32 rumble_expiration;