SDL_GETJOYSTICKPRODUCTVERSIONFORID(3)

πŸ’– SDL_GetJoystickProductVersionForID(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we are about to get extremely into joystick product versions. yes this is real. yes you need it. let's go πŸŽ€


✨ NAME ✨

SDL_GetJoystickProductVersionForID β€” get the product version of a joystick, if available πŸ‘€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_joystick.h>

Uint16 SDL_GetJoystickProductVersionForID(SDL_JoystickID instance_id);

like, that's it. one function. one arg. one Uint16 coming back at you πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: this one can be called before any joysticks are opened. no need to open a thing first, no warm-up, no nothing. you just call it and it answers. iconic behaviour fr fr πŸ‘‘

but β€” and listen β€” if the product version isn't available, this function returns 0. that's the vibe check you gotta remember. no version? you get a zero. not an error, not a crash, just a lil 0 🫢


πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • instance_id β€” the joystick instance ID. that's the whole thing. just hand it the ID and let it cook ✨

πŸ“ RETURN VALUE πŸ“

it returns the product version of the selected joystick. slay.

and if you call it with an invalid instance_id? it returns 0. so basically 0 is the universal "bestie I got nothing for you" answer here πŸ’€


🌈 THREAD SAFETY 🌈

it is safe to call this function from any thread. any of them. all of them. go feral, the thread police are not coming 🧚


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. if you're on something older... girl, upgrade πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're all part of the same friend group 🫢


and that's the whole page, no cap. brought to you by Simple Directmedia Layer, running SDL 3.4.18, dated and everything β€” mwah, love that for us πŸ’–πŸŒΈβœ¨

πŸ“¦ where this page comes from