SDL_JoyBallEvent(3)

πŸ’– SDL_JoyBallEvent(3) πŸ’–

okay bestie, welcome to the SDL API Reference β€” today's main character is SDL_JoyBallEvent, and she is literally the joystick trackball motion event structure. yes, trackball. we're going vintage. πŸ•ΉοΈβœ¨


πŸŽ€ NAME πŸŽ€

SDL_JoyBallEvent β€” joystick trackball motion event structure


πŸ¦‹ STRUCTURE DEFINITION πŸ¦‹

here's the whole fit, no edits, exactly as she comes:

typedef struct{
  Uint8 type;
  Uint8 which;
  Uint8 ball;
  Sint16 xrel, yrel;
} SDL_JoyBallEvent;

✨ STRUCTURE DATA ✨

the fields, and what each one is giving:

  • type β€” SDL_JOYBALLMOTION πŸ’… that's the whole personality of this struct ngl
  • which β€” joystick device index πŸ‘‘ (which stick is talking to you)
  • ball β€” joystick trackball index πŸ“ (which ball on that stick, specifically)
  • xrel, yrel β€” the relative motion in the X/Y direction 🌈 (how far it moved, not where it is)

🌸 DESCRIPTION 🌸

so, SDL_JoyBallEvent is a member of the SDL_Event union, and she shows up whenever an event of type SDL_JOYBALLMOTION gets reported. that's her whole reason for existing. iconic behavior fr fr.

a SDL_JOYBALLMOTION event happens when a user moves a trackball on the joystick. πŸ•ΉοΈπŸ’« the field which is the index of the joystick that reported the event, and ball is the index of the trackball β€” for a more detailed explanation, go peek at the Joystick section, iykyk.

bestie, listen: trackballs only return relative motion. not absolute position, relative. it's the change in position on the ball since it was last polled (aka the last cycle of the event loop), and it lives in xrel and yrel. periodt. πŸ’…

πŸ’œ SEE ALSO πŸ’œ

  • SDL_Event
  • Joystick Functions
  • SDL_JoystickEventState
  • SDL_JoystickGetBall

mwah πŸ’‹ this page came from the SDL API Reference, dated Tue 11 Sep 2001, 22:59 β€” yes, an actual vintage. thank you for coming to my TED talk, go move a trackball or something. πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from