SDL_HasJoystick(3)

๐Ÿ’– SDL_HasJoystick(3) ๐Ÿ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we answer the question every gamer girl has asked at least once: is literally anything plugged in rn?? ๐ŸŽฎโœจ


๐ŸŒธ NAME ๐ŸŒธ

SDL_HasJoystick โ€” tells you whether a joystick is currently connected. that's it. that's the whole job. queen of minding her own business ๐Ÿ’…


โœจ SYNOPSIS โœจ

#include <SDL3/SDL_joystick.h>

bool SDL_HasJoystick(void);

no args, no drama, just vibes ๐Ÿซถ


๐Ÿฆ‹ RETURN VALUE ๐Ÿฆ‹

  • true โ€” yasss, a joystick is connected ๐ŸŽ‰
  • false โ€” nope, nothing's there, it's giving empty USB port ๐Ÿ˜ญ

๐Ÿงš THREAD SAFETY ๐Ÿงš

ngl this one is iconic โ€” it is safe to call this function from any thread. go wild, no cap. ๐Ÿ”ฅ


โญ AVAILABILITY โญ

this function has been available since SDL 3.2.0. so if you're on something older, bestie... it's not gonna be there ๐Ÿ™ˆ


๐Ÿ’œ SEE ALSO ๐Ÿ’œ


okay that's the page!! ๐Ÿ’– this was Simple Directmedia Layer, rocking SDL 3.4.18, and yes the date/title tag at the bottom still says SDL_HasJoystick(3) because tradition is tradition ๐ŸŽ€ slay, bye, go plug something in โœจ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from