SDL_SetGamepadLED(3)

πŸ’– SDL_SetGamepadLED πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we make your controller glow ✨

🌸 NAME 🌸

SDL_SetGamepadLED β€” the glow-up button. it updates a gamepad's LED color πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_gamepad.h>

bool SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, picture a joystick LED β€” the classic example is that lil light on the back of a PlayStation 4's DualShock 4 controller πŸ‘‘ iconic behavior honestly.

and here's the tea for gamepads with a single color LED: the maximum of the RGB values gets used as the LED brightness. so whichever of your three numbers is the biggest? yeah, that one's running the show πŸ’€


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • gamepad β€” the gamepad we're updating, obviously. the main character 🫢
  • red β€” the intensity of the red LED πŸ”₯
  • green β€” the intensity of the green LED 🌈
  • blue β€” the intensity of the blue LED πŸ’œ

⭐ RETURN VALUE ⭐

returns true on success, or false on failure 😭 β€” and if it flops, call SDL_GetError() for more info. always check, bestie, no cap.


πŸ’… THREAD SAFETY πŸ’…

it is safe to call this function from any thread. yes, ANY. go wild, she's chill like that ✨


πŸ‘‘ AVAILABILITY πŸ‘‘

this function has been serving since SDL 3.2.0. periodt.


and that's the whole page, babe πŸ’– brought to you by Simple Directmedia Layer, running version SDL 3.4.18 β€” mwah, go light up something pretty πŸ¦‹πŸŒΈπŸŽ€

πŸ“¦ where this page comes from