SDL_GetGamepadVendorForID(3)

๐Ÿ’– SDL_GetGamepadVendorForID ๐Ÿ’–

okay bestie, so this one lives in the SDL3 FUNCTIONS family and it's literally the glow-up you call when you wanna know who made this gamepad โ€” specifically its USB vendor ID. no cap.


โœจ NAME โœจ

SDL_GetGamepadVendorForID โ€” get the USB vendor ID of a gamepad, if it's available ๐ŸŽฎ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <SDL3/SDL_gamepad.h>

Uint16 SDL_GetGamepadVendorForID(SDL_JoystickID instance_id);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

the tea is: you can call this before any gamepads are even opened. like, no setup era required, she's ready whenever you are ๐Ÿ’…

but if the vendor ID just isn't available? she returns 0. that's it, that's the vibe.


๐ŸŽ€ FUNCTION PARAMETERS ๐ŸŽ€

  • instance_id โ€” the joystick instance ID. that's the little number that tells her which gamepad you're asking about, bestie.

โญ RETURN VALUE โญ

she hands you back the USB vendor ID of the selected gamepad ๐Ÿซถ

and if you call her on an invalid index? zero. 0. nothing. so if you get a 0, that's your sign something's off, not me being dramatic ๐Ÿ˜ญ


๐ŸŒˆ THREAD SAFETY ๐ŸŒˆ

it is safe to call this function from any thread. periodt. go off, multithreaded queen ๐Ÿ‘‘


๐Ÿ’œ AVAILABILITY ๐Ÿ’œ

this function is available since SDL 3.2.0 โœจ so if you're on something older, that's a no from her.


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ


okay that's the whole page, mwah ๐Ÿ’‹ this one's brought to you by Simple Directmedia Layer, version SDL 3.4.18 โ€” go get that vendor ID, bestie, ily ๐Ÿงš๐Ÿ’–

๐Ÿ“ฆ where this page comes from