SDL_GetHaptics(3)

πŸ’– SDL_GetHaptics πŸ’–

okay bestie, welcome to the SDL3 manual page for SDL_GetHaptics(3) β€” yes it's a real section of the SDL3 functions, and yes it's as cute as it sounds πŸŽ€

🌸 NAME 🌸

SDL_GetHaptics β€” get a list of currently connected haptic devices.

like, every rumble-y, buzz-y, shake-y controller that's plugged in right now?? this is the function that tells you about them. periodt. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_haptic.h>

SDL_HapticID * SDL_GetHaptics(int *count);

🫢 FUNCTION PARAMETERS 🫢

  • count β€” a pointer that gets filled in with the number of haptic devices returned. it may be NULL. no thoughts, head empty, totally optional, she's flexible like that 😌

πŸ¦‹ RETURN VALUE πŸ¦‹

returns a 0 terminated array of haptic device instance IDs, or NULL on failure 😭 β€” and if it fails, bestie, call SDL_GetError() for more info, she'll tell you what went wrong fr fr.

⚠️ and listen: that array needs to be freed with SDL_free() when you're done with it. don't just leave it lying around, that's not the vibe. free your memory, queen πŸ‘‘

🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0 ⭐ (so if you're on something older… it's giving ancient, i'm so sorry πŸ’€)

πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_OpenHaptic(3) β€” the natural next step, you found the devices, now go open one 🧚

mwah that's the whole page, you ate that πŸ’œ this came to you from Simple Directmedia Layer, version SDL 3.4.18, and it's SDL_GetHaptics(3) signing off β€” stay haptic, stay hydrated πŸ“βœ¨

πŸ“¦ where this page comes from