SDL_GetJoysticks(3)

โœจ NAME โœจ

SDL_GetJoysticks โ€” bestie, this one gets you a list of every joystick that's currently connected ๐Ÿ’–

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

#include <SDL3/SDL_joystick.h>

SDL_JoystickID * SDL_GetJoysticks(int *count);

๐ŸŒธ FUNCTION PARAMETERS ๐ŸŒธ

  • count โ€” a pointer that gets filled in with how many joysticks got returned. It's giving "optional", because it may be NULL. No pressure, no notes ๐Ÿ’…

๐Ÿฆ‹ RETURN VALUE ๐Ÿฆ‹

Returns a 0 terminated array of joystick instance IDs โ€” slay. But if it fails it returns NULL instead ๐Ÿ˜ญ, and in that case you gotta call SDL_GetError() for more info, fr fr.

Heads up bestie: when you're done with it, free it with SDL_free(). Don't just leave it lying around like an unread group chat ๐Ÿ™ˆ

๐Ÿ’œ THREAD SAFETY ๐Ÿ’œ

It is safe to call this function from any thread. Main character energy on every thread, no cap ๐Ÿ‘‘

โญ AVAILABILITY โญ

This function is available since SDL 3.2.0. So if you're on anything older... it's not giving, sorry ๐Ÿซถ

๐ŸŒˆ SEE ALSO ๐ŸŒˆ


okay that's the whole page, go forth and enumerate your controllers, bestie ๐ŸŽฎโœจ

written under the Simple Directmedia Layer banner, SDL 3.4.18 era, and yes this manual page is literally called SDL_GetJoysticks(3) โ€” iykyk ๐Ÿ’–

๐Ÿ“ฆ where this page comes from