SDL_JoyButtonEvent(3type)
โจ SDL_JoyButtonEvent โจ
okay bestie, welcome to the SDL_JoyButtonEvent page ๐ this is a SDL3 DATATYPES situation, and it's literally the joystick button event structure โ you'll find it chilling under event.jbutton.* ๐ฎ
๐ธ NAME ๐ธ
SDL_JoyButtonEvent โ the joystick button event structure (aka event.jbutton.*) ๐
๐ฆ SYNOPSIS ๐ฆ
#include <SDL3/SDL_events.h>
typedef struct SDL_JoyButtonEvent
{
SDL_EventType type; /**< SDL_EVENT_JOYSTICK_BUTTON_DOWN or SDL_EVENT_JOYSTICK_BUTTON_UP */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */
bool down; /**< true if the button is pressed */
Uint8 padding1;
Uint8 padding2;
} SDL_JoyButtonEvent;
๐ DESCRIPTION ๐
so like, picture this: somebody smashes a button on their joystick and SDL is like "noted ๐" and hands you one of these bad boys. no cap, that's the whole vibe.
let's do a little field-by-field vibe check, shall we? ๐ง
typeโ anSDL_EventType, and it's eitherSDL_EVENT_JOYSTICK_BUTTON_DOWNorSDL_EVENT_JOYSTICK_BUTTON_UP. that's it, those are the only two options, periodt ๐reservedโ aUint32just sitting there. reserved. do not perceive it ๐timestampโ aUint64, measured in nanoseconds, populated usingSDL_GetTicksNS(). so you know exactly when the button got pressed, down to the nanosecond, main character energy fr fr โฑ๏ธwhichโ anSDL_JoystickID, the joystick instance id. which joystick was it? this field knows ๐ฅbuttonโ aUint8, the joystick button index. which button? this field knows too ๐downโ abool,trueif the button is pressed. iconic behaviour honestly ๐padding1โ aUint8. padding. yes bestie, the name is the whole description ๐padding2โ aUint8. padding's sequel. the way that struct alignment needs it... iykyk โจ
lowkey important:reserved,padding1andpadding2are not for you. they exist so the struct lines up nicely. leave them alone bestie ๐ซถ
๐ AVAILABILITY ๐
this struct has been around since SDL 3.2.0 โ so if you're on 3.2.0 or later, she's available and she's serving ๐ซถ
and that's the whole page, you ate that ๐ go forth and handle your joystick buttons with confidence, bestie. no notes. ๐
this lil' datatype page comes from Simple Directmedia Layer, version SDL 3.4.18 โ mwah, slay, bye ๐โจ
๐ฆ 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