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