SDL_GetJoystickProduct(3)
β¨ SDL_GetJoystickProduct β¨
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, this one's a lil bop called SDL_GetJoystickProduct and it is exactly as unhinged-simple as it sounds π
πΈ NAME πΈ
SDL_GetJoystickProduct β get the USB product ID of an opened joystick, if available. that "if available" is doing a LOT of heavy lifting btw, we'll get there π«Ά
π SYNOPSIS π
#include <SDL3/SDL_joystick.h>
Uint16 SDL_GetJoystickProduct(SDL_Joystick *joystick);
like. one include, one function, one Uint16 coming back at ya. iconic behavior honestly β¨
π DESCRIPTION π
so here's the tea, bestie: you hand it a joystick, it gives you back the USB product ID. that's it. that's the whole vibe π¦
BUT β and this is the part where I need you to lock in β if the product ID isn't available this function returns 0. so if you get a 0 back, don't be out here thinking "omg the product ID is literally zero", no ma'am. that's the "idk bestie" answer. it's giving unavailable, not zero π
π FUNCTION PARAMETERS π
joystickβ theSDL_Joystickyou got fromSDL_OpenJoystick(). that's the one, the only, the main character π
β RETURN VALUE β
returns the USB product ID of the selected joystick, or 0 if it's unavailable. periodt. that's the whole return value. no secret third thing π
π₯ THREAD SAFETY π₯
it is safe to call this function from any thread. yes, ANY. go wild, no cap, thread it up π§
π AVAILABILITY π
this function has been available since SDL 3.2.0. so if you're on something older... my condolences, bestie, upgrade π
π¦ SEE ALSO π¦
SDL_GetJoystickProductForID(3)β the sibling, the sister function, the iykyk one π
and that's the whole page!! written up by Simple Directmedia Layer, running on SDL 3.4.18 β mwah, slay, go read your joystick's product ID, I'm obsessed with you πβ¨πΈ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms