SDL_GetNumJoystickHats(3)

πŸ’– SDL_GetNumJoystickHats(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual β€” this one's a lil baby function but it's lowkey essential, so let's get into it πŸŽ€


✨ NAME ✨

SDL_GetNumJoystickHats β€” get the number of POV hats on a joystick. that's it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_joystick.h>

int SDL_GetNumJoystickHats(SDL_Joystick *joystick);

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • joystick β€” an SDL_Joystick structure containing joystick information. that's your lil handheld buddy's info card, hand it over and we'll count the hats πŸ’œ

⭐ RETURN VALUE ⭐

Returns the number of POV hats on success, or -1 on failure 😭 and if it fails you gotta call SDL_GetError() for more info β€” like, it WILL tell you what went wrong, just ask fr fr.


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. no cap, go wild, no locks needed, she's chill like that 🫢


🌈 AVAILABILITY 🌈

This function has been available since SDL 3.2.0. so if you're on something older... bestie. upgrade πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

the whole count-your-controller-parts squad, iconic honestly πŸ’–


πŸŽ€ friendly reminder: -1 is a failure, not a vibe. always check your return values, iykyk.

and that's the page!! brought to you by Simple Directmedia Layer, SDL 3.4.18, periodt πŸ’…βœ¨ mwah, go count some hats bestie πŸ“πŸ§š

πŸ“¦ where this page comes from