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'sSDL_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 usingSDL_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 typeSDL_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:-32768to32767. that's the actual movement, the numbers, the drama.Uint16 padding4โ one more padding. a little encore. ๐
no cap: thepadding1โpadding4fields andreservedare 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
- 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