SDL_JoyButtonEvent(3)

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

๐Ÿ’– SDL_JoyButtonEvent(3) ๐Ÿ’–

okay bestie, welcome to the SDL API Reference โ€” this is the page for SDL_JoyButtonEvent, and yes it's exactly as iconic as it sounds ๐ŸŽฎโœจ


๐ŸŒˆ NAME ๐ŸŒˆ

SDL_JoyButtonEvent โ€” the joystick button event structure, aka the lil guy that slides into your event queue when someone smashes a button on their controller ๐Ÿ’…


๐ŸŽ€ STRUCTURE DEFINITION ๐ŸŽ€

here's the whole vibe, verbatim, no cap:

typedef struct{
  Uint8 type;
  Uint8 which;
  Uint8 button;
  Uint8 state;
} SDL_JoyButtonEvent;

โœจ STRUCTURE DATA โœจ

four fields, four moods, let's go:

  • type โ€” SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP ๐Ÿซถ
  • which โ€” the joystick device index, like which controller is talking to you rn
  • button โ€” the joystick button index, i.e. WHICH button
  • state โ€” SDL_PRESSED or SDL_RELEASED ๐Ÿ‘‘

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

so, SDL_JoyButtonEvent is a member of the SDL_Event union (it's giving family reunion, everybody's in there), and it shows up whenever an event of type SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP gets reported ๐ŸŒธ

an SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP event happens wheneveeer a user presses or releases a button on a joystick. like, any time. that's the whole trigger. periodt ๐Ÿ’…

  • the field which is the index of the joystick that reported the event ๐Ÿ‘‘
  • the field button is the index of the button (for a more detailed explaination, go peek at the Joystick section) ๐Ÿ”
  • state is the current state of the button, which is either SDL_PRESSED or SDL_RELEASED โœจ

๐ŸŒŸ SEE ALSO ๐ŸŒŸ

go read these next, bestie, they're all in the group chat:

  • SDL_Event
  • Joystick Functions
  • SDL_JoystickEventState
  • SDL_JoystickGetButton

fr fr, that's the whole page. no missing fields, no skipped flags, we keep every detail around here ๐Ÿ’ฏ

and that's a wrap on our lil SDL moment โ€” this one's from the SDL docs dated Tue 11 Sep 2001, 22:59, and yeah, iconic date, iconic page. mwah ๐Ÿฉท๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from