SDL_GamepadHasButton(3)

🌸 SDL_GamepadHasButton 🌸

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, today's main character is SDL_GamepadHasButton β€” she just wants to know one thing: does ur gamepad have this button or not πŸ’…


✨ NAME ✨

SDL_GamepadHasButton β€” literally just asking whether a gamepad has a given button. that's it. that's the whole job πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_gamepad.h>

bool SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea, and it's important tea: this function merely reports whether the gamepad's mapping defined this button. that is all the information SDL has about the physical device. like, SDL can't peek inside ur controller and count the little plastic buttons, she only knows what the mapping told her. so don't come for her if the vibes are off, she's working with what she's got 😭


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • gamepad β€” a gamepad. yes queen, just a gamepad 🫢
  • button β€” a button enum value (an SDL_GamepadButton value).

⭐ RETURN VALUE ⭐

returns true if the gamepad has this button, false otherwise. binary. iconic. periodt πŸ’…


🌈 THREAD SAFETY 🌈

it is safe to call this function from any thread. no cap, she's not gonna ghost you halfway through, call her from wherever fr fr 🧚


πŸ‘‘ AVAILABILITY πŸ‘‘

this function is available since SDL 3.2.0. if ur on anything older, she simply did not exist yet, sorry bestie πŸ™ˆ


πŸ“ SEE ALSO πŸ“

  • SDL_GamepadHasAxis(3) β€” same energy, different body part. go read her too, she's also slaying πŸ’œ

lowkey reminder: the mapping is the whole source of truth here. no mapping, no button. that's the vibe check πŸ”₯

Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_GamepadHasButton(3) β€” mwah, that's the whole page, thanks for coming to my ted talk, love u, bye bestie πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from