sdlSetGamepadLed function

bool sdlSetGamepadLed(
  1. Pointer<SdlGamepad> gamepad,
  2. int red,
  3. int green,
  4. int blue,
)

Update a gamepad's LED color.

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

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

\param gamepad the gamepad 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_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue)

Implementation

bool sdlSetGamepadLed(
    Pointer<SdlGamepad> gamepad, int red, int green, int blue) {
  final sdlSetGamepadLedLookupFunction = libSdl3.lookupFunction<
      Uint8 Function(
          Pointer<SdlGamepad> gamepad, Uint8 red, Uint8 green, Uint8 blue),
      int Function(Pointer<SdlGamepad> gamepad, int red, int green,
          int blue)>('SDL_SetGamepadLED');
  return sdlSetGamepadLedLookupFunction(gamepad, red, green, blue) == 1;
}