SDL_GetJoystickProperties(3)

โœจ SDL_GetJoystickProperties โœจ

okay so bestie, welcome to the SDL3 FUNCTIONS section of the manual, and lemme tell you about SDL_GetJoystickProperties โ€” the little function that hands you the whole vibe check on a joystick ๐ŸŽฎ๐Ÿ’–


๐ŸŽ€ NAME ๐ŸŽ€

SDL_GetJoystickProperties โ€” get the properties associated with a joystick.

like, the receipts. the lore. the whole tea on what your controller can actually do ๐Ÿ”ฅ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <SDL3/SDL_joystick.h>

SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick *joystick);

๐Ÿ’… DESCRIPTION ๐Ÿ’…

SDL is out here giving you the following read-only properties, and honestly? iconic of it. here's the full lineup, no gatekeeping ๐Ÿซถ

  • SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN โ€” true if this joystick has an LED that has adjustable brightness โœจ like it can dim or glow up, main character energy
  • SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN โ€” true if this joystick has an LED that has adjustable color ๐ŸŒˆ full rainbow mode, we love to see it
  • SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN โ€” true if this joystick has a player LED ๐Ÿ‘‘ you know, the little "player 1" light that tells everyone who's the protagonist
  • SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN โ€” true if this joystick has left/right rumble ๐Ÿ’€ shake shake shake, it's giving haptics
  • SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN โ€” true if this joystick has simple trigger rumble ๐Ÿ”ฅ just the triggers buzzing, keeping it simple fr fr
heads up bestie: these are read-only properties. you're reading them, not setting them. don't try to change them, that's not the move ๐Ÿ’€

๐Ÿฆ‹ FUNCTION PARAMETERS ๐Ÿฆ‹

  • joystick โ€” the SDL_Joystick obtained from SDL_OpenJoystick(). yes, the actual one you already opened, not a random one you found on the street ๐Ÿ™ˆ

โญ RETURN VALUE โญ

Returns a valid property ID on success, or 0 on failure ๐Ÿ˜ญ and when it fails? call SDL_GetError() for more information โ€” that's your group chat asking "what happened" and getting the actual answer.


๐Ÿ’œ THREAD SAFETY ๐Ÿ’œ

It is safe to call this function from any thread. no cap. go wild, thread it from everywhere, it does not care ๐Ÿ’…


๐ŸŒŸ AVAILABILITY ๐ŸŒŸ

This function is available since SDL 3.2.0. so if you're on something olderโ€ฆ babe, upgrade ๐Ÿงš


and that's the whole page, you ate it ๐Ÿ’–

signing off from Simple Directmedia Layer, running SDL 3.4.18, page SDL_GetJoystickProperties(3) โ€” stay slaying, bestie ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from