SDL_GetGamepads(3)
๐ SDL_GetGamepads ๐
okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, this one's SDL_GetGamepads(3) and she's literally so useful ๐ฎโจ
๐ธ NAME ๐ธ
SDL_GetGamepads โ get a list of currently connected gamepads.
like, all of them. every single controller plugged in / paired / vibing nearby. it's giving census day for gamepads ๐ซถ
โจ SYNOPSIS โจ
#include <SDL3/SDL_gamepad.h>
SDL_JoystickID * SDL_GetGamepads(int *count);
๐ FUNCTION PARAMETERS ๐
countโ a pointer that gets filled in with the number of gamepads returned. it may beNULLif you truly don't care how many there are, no pressure bestie ๐
๐ฆ RETURN VALUE ๐ฆ
returns a 0 terminated array of joystick instance IDs, or NULL on failure. if it's NULL, go call SDL_GetError() for the tea โ โ she'll tell you what went wrong.
important!! when you're done with that array, free it with SDL_free(). don't just leave it hanging, that's not the vibe, that's a leak ๐ญ
๐ THREAD SAFETY ๐
it is safe to call this function from any thread. yes, any. go wild, main character energy, no locks required ๐ฅ
โญ AVAILABILITY โญ
this function is available since SDL 3.2.0. if you're on something older, she simply doesn't exist yet, sorry babe ๐
๐ SEE ALSO ๐
and that's the whole page, bestie, you ate that ๐
signing off with the receipts: this one comes from Simple Directmedia Layer, version SDL 3.4.18, and it's the SDL_GetGamepads(3) page. go forth and enumerate those controllers ๐๐ง
๐ฆ 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