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 nglwhichβ 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 inxrelandyrel. periodt. π
π SEE ALSO π
SDL_Event- Joystick Functions
SDL_JoystickEventStateSDL_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
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms