SDL_GamepadAxisEvent(3type)

๐Ÿ’– NAME ๐Ÿ’–

okay so bestie, welcome to the SDL3 DATATYPES section of the manual, and today's main character is SDL_GamepadAxisEvent โ€” the gamepad axis motion event structure, aka everything hiding under event.gaxis.*. ๐ŸŽฎโœจ

Like. When your controller's stick goes wiggle, this is the struct that shows up at the function. It's giving "your thumb moved and the whole system needs to know." ๐Ÿ’…


โœจ SYNOPSIS โœจ

grab your include, babe:

#include <SDL3/SDL_events.h>

typedef struct SDL_GamepadAxisEvent
{
    SDL_EventType type; /**< SDL_EVENT_GAMEPAD_AXIS_MOTION */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_JoystickID which; /**< The joystick instance id */
    Uint8 axis;         /**< The gamepad axis (SDL_GamepadAxis) */
    Uint8 padding1;
    Uint8 padding2;
    Uint8 padding3;
    Sint16 value;       /**< The axis value (range: -32768 to 32767) */
    Uint16 padding4;
} SDL_GamepadAxisEvent;

๐Ÿฆ‹ let's break down the fit (the struct, bestie) ๐Ÿฆ‹

Every single member, no gatekeeping:

  • SDL_EventType type โ€” this is the event type field, and for this struct it's SDL_EVENT_GAMEPAD_AXIS_MOTION. that's the whole vibe check right there.
  • Uint32 reserved โ€” reserved. don't touch it, don't look at it, it's not for you. ๐Ÿ™ˆ
  • Uint64 timestamp โ€” in nanoseconds, populated using SDL_GetTicksNS(). so like, when did this happen, down to the nanosecond. icon behavior honestly.
  • SDL_JoystickID which โ€” the joystick instance id. which controller said that. ๐Ÿ‘‘
  • Uint8 axis โ€” the gamepad axis, of type SDL_GamepadAxis. which stick, which trigger, you know the drill.
  • Uint8 padding1, Uint8 padding2, Uint8 padding3 โ€” padding. three of them. they are padding. that's the whole job. โœจ
  • Sint16 value โ€” the axis value, with range: -32768 to 32767. that's the actual movement, the numbers, the drama.
  • Uint16 padding4 โ€” one more padding. a little encore. ๐ŸŽ€
no cap: the padding1โ€“padding4 fields and reserved are just there โ€” don't go reading meaning into them, they're not the moment.

๐ŸŒธ AVAILABILITY ๐ŸŒธ

This struct is available since SDL 3.2.0. so if you're on something older... bestie. ๐Ÿ˜ญ upgrade.


๐Ÿซถ that's the whole page ๐Ÿซถ

and that's it, that's the struct, you ate. ๐Ÿ’…

mwah โ€” brought to you by Simple Directmedia Layer, version SDL 3.4.18. go make something iconic with it. ๐ŸŒˆโญ๐Ÿ’œ

๐Ÿ“ฆ where this page comes from