SDL_GetNumJoystickBalls(3)

πŸ’– SDL_GetNumJoystickBalls(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where we count trackballs like it's a personality quiz πŸŽ€


✨ NAME ✨

SDL_GetNumJoystickBalls β€” get the number of trackballs on a joystick. yes literally, that's the whole gig, and it's iconic for it πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_joystick.h>

int SDL_GetNumJoystickBalls(SDL_Joystick *joystick);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk: joystick trackballs are lowkey mysterious. they only have relative motion events attached to them, and their state cannot be polled. so like, no asking "hey ball, where you at right now?" β€” that's just not a thing, bestie 😭

also, important vibe check: most joysticks do not have trackballs. so if this function hands you a 0, that's not a bug, that's just the average joystick living its truth πŸ™ˆ


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • joystick β€” an SDL_Joystick structure containing joystick information. give it your joystick, it'll do the counting, no notes πŸ’œ

⭐ RETURN VALUE ⭐

returns the number of trackballs on success, or -1 on failure. and if it fails? call SDL_GetError() for more information, because the error message is where the tea is β˜•


πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this function from any thread. yes bestie, any thread, no drama, no locks, we love a low-maintenance icon πŸ‘‘


🌈 AVAILABILITY 🌈

this function has been available since SDL 3.2.0. so if you're on something older… no it isn't, sorry 🫢


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, fr fr πŸ’– this came to you courtesy of Simple Directmedia Layer, rocking SDL 3.4.18 β€” go forth and count those balls, bestie, and remember: zero is a valid answer and you're still slaying βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from