SDL_JoyHatEvent(3)
β¨ SDL_JoyHatEvent β¨
okay bestie, this is a page from the SDL API Reference β it's SDL_JoyHatEvent(3), and it's literally the manual for the little struct that tells you when someone yanks a hat around on a joystick. yes. a hat. on a joystick. we love a retro peripheral moment π©π
π NAME π
SDL_JoyHatEvent β the joystick hat position change event structure. that's it, that's the whole name, she's straightforward and we respect her π«Ά
π§ STRUCTURE DEFINITION π§
here's the whole fit, no cap:
typedef struct{
Uint8 type;
Uint8 which;
Uint8 hat;
Uint8 value;
} SDL_JoyHatEvent;
four Uint8s and a dream π
πΈ STRUCTURE DATA πΈ
typeβ it'sSDL_JOYπwhichβ the joystick device index (which joystick is doing all this)hatβ the joystick hat index (which hat on that joystick)valueβ the hat position
π DESCRIPTION π
so SDL_JoyHatEvent is a member of the SDL_Event union, and it's the one that shows up when an event of type SDL_JOYHATMOTION gets reported. main character energy fr fr β¨
an SDL_JOYHATMOTION event happens whenevs a user moves a hat on the joystick. the field which is the index of the joystick that reported the event, and hat is the index of the hat (for a way more detailed explanation, go peek at the Joystick section β iykyk). and value is the current position of the hat.
now value is a logically OR'd combination of these following values, and honestly their meanings should be pretty obvious π:
SDL_HAT_CENTEREDSDL_HAT_UPSDL_HAT_RIGHTSDL_HAT_DOWNSDL_HAT_LEFT
and these defines are also provided (the diagonal girlies π):
SDL_HAT_RIGHTUPSDL_HAT_RIGHTDOWNSDL_HAT_LEFTUPSDL_HAT_LEFTDOWN
π SEE ALSO π
SDL_Event- Joystick Functions
SDL_JoystickEventStateSDL_JoystickGetHat
and that's the whole page, bestie β go read up on your hats, periodt πβ¨
this was SDL, and the page is dated Tue 11 Sep 2001, 22:59 β a true vintage icon, we stan a timestamp ππ¦
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms