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 β€” an SDL_EventType, and the comment says it's SDL_EVENT_JOYSTICK_AXIS_MOTION. That's the whole point of this event, no cap.
  • reserved β€” a Uint32. It's just vibing there, reserved and mysterious. Do not touch, bestie.
  • timestamp β€” a Uint64, measured in nanoseconds, populated using SDL_GetTicksNS(). So when did this happen? Nanosecond receipts. 🫢
  • which β€” an SDL_JoystickID, and it's the joystick instance id. Which joystick are we even talking about? This one. Iconic.
  • axis β€” a Uint8, the joystick axis index. Which axis moved? This tells you.
  • padding1, padding2, padding3 β€” three little Uint8 besties holding space so everything lines up. They're not for you, they're for the layout. πŸ’€
  • value β€” a Sint16, the axis value, and the range is -32768 to 32767. Yes, that's the full range. Not me memorizing those numbers... okay maybe me.
  • padding4 β€” a Uint16 padding 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