SDL_JoyAxisEvent(3type)
π SDL_JoyAxisEvent β the joystick-axis-motion-event-struct of it all π
okay so bestie, we're in the SDL3 DATATYPES corner of the manual, and this page is called SDL_JoyAxisEvent (that's the SDL_JoyAxisEvent(3type) page, mwah). It's giving joystick axis motion event structure, and yes the fields all live under event.jaxis.*. Sit with me, this is gonna be cute AND thorough. π
β¨ NAME β¨
SDL_JoyAxisEvent β joystick axis motion event structure (the event.jaxis.* family, periodt) πΉοΈ
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_events.h>
typedef struct SDL_JoyAxisEvent
{
SDL_EventType type; /**< SDL_EVENT_JOYSTICK_AXIS_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */
Uint8 padding1;
Uint8 padding2;
Uint8 padding3;
Sint16 value; /**< The axis value (range: -32768 to 32767) */
Uint16 padding4;
} SDL_JoyAxisEvent;
Like, look at her. She's a struct. She's built different. Let's do a lil vibe check on every single field because we do not skip details in this house: π
typeβ anSDL_EventType, and the comment says it'sSDL_EVENT_JOYSTICK_AXIS_MOTION. That's the whole point of this event, no cap.reservedβ aUint32. It's just vibing there, reserved and mysterious. Do not touch, bestie.timestampβ aUint64, measured in nanoseconds, populated usingSDL_GetTicksNS(). So when did this happen? Nanosecond receipts. π«Άwhichβ anSDL_JoystickID, and it's the joystick instance id. Which joystick are we even talking about? This one. Iconic.axisβ aUint8, the joystick axis index. Which axis moved? This tells you.padding1,padding2,padding3β three littleUint8besties holding space so everything lines up. They're not for you, they're for the layout. πvalueβ aSint16, the axis value, and the range is-32768to32767. Yes, that's the full range. Not me memorizing those numbers... okay maybe me.padding4β aUint16padding cutie at the end, keeping the struct's silhouette immaculate. β¨
π AVAILABILITY π
This struct has been available since SDL 3.2.0. So if you're on something older, sorry babe, she's not there yet. π
And that's the whole page, bestie. Every field, every padding byte, every range, all accounted for. Go forth and handle your joystick axis motion events with main character energy. π
Sign-off time, fr fr: this page came to you from Simple Directmedia Layer, sitting pretty at SDL 3.4.18, and it is, of course, the SDL_JoyAxisEvent(3type) page. π¦ Slay, and read your headers. π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms