Added SDL_JoystickHasLED

Currently, this is only supported by the PS4 HIDAPI driver.
This commit is contained in:
Sam Lantinga
2020-11-05 11:07:54 -08:00
parent 83cddd2ebc
commit e555d45331
27 changed files with 278 additions and 75 deletions

View File

@@ -102,7 +102,7 @@ typedef struct {
int player_index;
Uint16 rumble_left;
Uint16 rumble_right;
Uint8 color_set;
SDL_bool color_set;
Uint8 led_red;
Uint8 led_green;
Uint8 led_blue;
@@ -365,12 +365,18 @@ HIDAPI_DriverPS4_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystic
return 0;
}
static SDL_bool
HIDAPI_DriverPS4_HasJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystick)
{
return SDL_TRUE;
}
static int
HIDAPI_DriverPS4_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
SDL_DriverPS4_Context *ctx = (SDL_DriverPS4_Context *)device->context;
ctx->color_set = 1;
ctx->color_set = SDL_TRUE;
ctx->led_red = red;
ctx->led_green = green;
ctx->led_blue = blue;
@@ -564,6 +570,7 @@ SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS4 =
HIDAPI_DriverPS4_UpdateDevice,
HIDAPI_DriverPS4_OpenJoystick,
HIDAPI_DriverPS4_RumbleJoystick,
HIDAPI_DriverPS4_HasJoystickLED,
HIDAPI_DriverPS4_SetJoystickLED,
HIDAPI_DriverPS4_CloseJoystick,
HIDAPI_DriverPS4_FreeDevice,