SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS(3)

πŸ’– SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we talk about a lil hint that decides whether your Linux joystick's "hat" inputs get treated as cute lil digital 8-way hats or as the analog divas they might actually be 🎩✨


✨ NAME ✨

SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS β€” a variable that controls whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats, without checking whether they might actually be analog. no vibe check, no second thoughts, just hats 🎩


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_hints.h>

#define SDL_HINT_JOYSTICK_LINUX_DIGITAL_HATS "SDL_JOYSTICK_LINUX_DIGITAL_HATS"

like yes, the macro and the string are literally the same thing, she's consistent, we love that for her πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works is, you set the variable to one of these two values and it changes the whole personality of your hat axes:

  • "0" β€” only map hat axis inputs to digital hat outputs if the input axes actually appear to be digital. this is the default, she's cautious, she checks first, she's not gonna assume 🫢
  • "1" β€” always handle the input axes numbered ABS_HAT0X to ABS_HAT3Y as digital hats. no questions asked. full send. πŸ”₯
⚠️ important bestie: this hint should be set before a controller is opened. setting it after is giving "changing your outfit in the middle of the photoshoot", it's too late, the vibe is already locked in 😭

πŸ‘‘ AVAILABILITY πŸ‘‘

this hint has been around since SDL 3.2.0. she's not new here, she's an icon, she's been serving since 3.2.0 ⭐


mwah, that's the whole page, hope it slayed for you πŸ’–

this lil writeup lives in the Simple Directmedia Layer docs, and the version we're bopping to is SDL 3.4.18 πŸŽ€ byeee, go set your hints before you open that controller fr fr πŸ¦‹

πŸ“¦ where this page comes from