SDL_JoystickGetButton(3)

๐Ÿ“ฆ version 1.2.15, in debian bookworm, nixos 26.05, nixpkgs unstable, ubuntu jammy

๐Ÿ’– SDL_JoystickGetButton ๐Ÿ’–

okay bestie, quick lil intro before we get into it: this page lives in the SDL API Reference manual, and it's about checking whether a button on a joystick is, like, being pressed right now. that's the whole vibe. ๐ŸŽฎโœจ


๐ŸŒธ NAME ๐ŸŒธ

SDL_JoystickGetButton โ€” get the current state of a given button on a given joystick ๐Ÿ’…

โœจ SYNOPSIS โœจ

#include "SDL.h"

Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);

like yes, that's the whole thing, she's short and she knows it ๐ŸŽ€

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so SDL_JoystickGetButton returns the current state of the given button on the given joystick.

that's it. that's the function. no cap. you hand her a joystick and a button, she tells you what's up with that button at this exact moment. iconic behaviour honestly ๐Ÿ‘‘

๐ŸŒˆ RETURN VALUE ๐ŸŒˆ

  • 1 if the button is pressed ๐Ÿ’–
  • otherwise, 0 ๐Ÿ˜ญ

literally a binary moment. pressed or not pressed, no in-between, no "kinda", no "it depends". slay.

๐Ÿ’œ SEE ALSO ๐Ÿ’œ

  • SDL_JoystickNumButtons โ€” for when you need to know how many buttons you're even allowed to ask about ๐Ÿซถ

and that's the tea, bestie!! this page came from the SDL manual, dated Tue 11 Sep 2001, 23:00 โ€” yeah she's an elder but she's still serving โœจ go press some buttons, you got this ๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from