SDL_GetJoyst...sInitialState(3)

✨ NAME ✨

SDL_GetJoystickAxisInitialState β€” bestie, this is how you get the initial state of an axis control on a joystick πŸ’–

(and yes, this is from the SDL3 FUNCTIONS manual, we're fancy here)


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_joystick.h>

bool SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the state you get back is a value ranging from -32768 to 32767. that's the whole vibe, full range, no cap πŸŽ€

and the axis indices? they start at index 0. zero-based, like a normal person. periodt.


πŸ’… FUNCTION PARAMETERS πŸ’…

  • joystick β€” an SDL_Joystick structure containing joystick information. it's giving "the whole joystick, ma'am" πŸ‘‘
  • axis β€” the axis to query; the axis indices start at index 0. yes, again, 0. starting from zero, iconic behavior ⭐
  • state β€” upon return, the initial value is supplied here. it's an out-param bestie, so it gets filled in for you 🫢

πŸ”₯ RETURN VALUE πŸ”₯

Returns true if this axis has any initial value, or false if not. that's it, that's the tea β˜•


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. go off, multithreaded queen πŸ‘‘


🌈 AVAILABILITY 🌈

This function is available since SDL 3.2.0. so if you're on something older... it's not there, sorry bestie 😭


Simple Directmedia Layer ✨ SDL 3.4.18 β€” mwah, that's a wrap, go read your joystick axes and slay πŸ’œπŸŽ€

πŸ“¦ where this page comes from