SDL_HasGamepad(3)
๐ SDL_HasGamepad(3) ๐
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_HasGamepad. it's giving "quick vibe check for your controller" and honestly? iconic. ๐ฎโจ
๐ธ NAME ๐ธ
SDL_HasGamepad โ return whether a gamepad is currently connected.
like, that's it. that's the whole job. is there a gamepad? yes or no. no drama, no cap. ๐ซถ
โจ SYNOPSIS โจ
#include <SDL3/SDL_gamepad.h>
bool SDL_HasGamepad(void);
she takes no arguments at all. zero. nada. just vibes. ๐
๐ฆ RETURN VALUE ๐ฆ
Returns true if a gamepad is connected, false otherwise.
that's the tea. true = your controller is out here living its best life and plugged in. false = nobody's home, the couch is empty, we're gaming with keyboard like it's 2009. ๐ญ
๐ THREAD SAFETY ๐
It is safe to call this function from any thread.
fr fr. any thread, any time, no gatekeeping, no "sorry bestie this is main-thread only". she's thread-safe and she knows it. ๐
โญ AVAILABILITY โญ
This function is available since SDL 3.2.0.
so if you're on anything older than that... bestie. please. upgrade. ๐
๐ SEE ALSO ๐
SDL_GetGamepads(3)โ the one you want when you need the whole list and not just a yes/no. she's the extroverted sibling. ๐
โ ๏ธ real talk: this page only tells you whether a gamepad is connected. it does not tell you which one, how many, or whether it's emotionally available. for that, go read SDL_GetGamepads(3). iykyk. ๐
and that's the whole page, bestie!! brought to you by the lovely people at Simple Directmedia Layer, straight from SDL 3.4.18. mwah, go check if your controller's connected, ily, bye!! ๐๐๐ฆโจ
๐ฆ 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