sdlSetJoystickLed function

bool sdlSetJoystickLed(
  1. Pointer<SdlJoystick> joystick,
  2. int red,
  3. int green,
  4. int blue,
)

Update a joystick's LED color.

An example of a joystick LED is the light on the back of a PlayStation 4's DualShock 4 controller.

For joysticks with a single color LED, the maximum of the RGB values will be used as the LED brightness.

\param joystick the joystick to update. \param red the intensity of the red LED. \param green the intensity of the green LED. \param blue the intensity of the blue LED. \returns true on success or false on failure; call SDL_GetError() for more information.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)

Implementation

bool sdlSetJoystickLed(
    Pointer<SdlJoystick> joystick, int red, int green, int blue) {
  final sdlSetJoystickLedLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlJoystick> joystick, Uint8 red, Uint8 green, Uint8 blue),
      int Function(Pointer<SdlJoystick> joystick, int red, int green,
          int blue)>('SDL_SetJoystickLED');
  return sdlSetJoystickLedLookupFunction(joystick, red, green, blue) == 1;
}