SDL_PlayHapticRumble(3)

✨ SDL_PlayHapticRumble ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_PlayHapticRumble(3), and lemme tell you this one is literally the "make your controller go brrrr" function πŸ’…


πŸ’– NAME πŸ’–

SDL_PlayHapticRumble β€” run a simple rumble effect on a haptic device.

like. it shakes. on purpose. iconic.


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_haptic.h>

bool SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length);

🌸 FUNCTION PARAMETERS 🌸

  • haptic β€” the haptic device you wanna play the rumble effect on. this is your lil gadget. your vibe machine. 🫢
  • strength β€” how hard the rumble goes, given as a 0-1 float value. lowkey a whisper, highkey a whole earthquake, you decide. 🌈
  • length β€” how long the rumble plays, in milliseconds. yes it's a Uint32. yes it's in ms. no we are not doing seconds today. ⏱️

⭐ RETURN VALUE ⭐

returns true on success or false on failure β€” and if it flops, pls call SDL_GetError() for more information, she will tell you what went wrong 😭


πŸ‘‘ AVAILABILITY πŸ‘‘

this function is available since SDL 3.2.0. so if you're on something older... girl. upgrade. 🧚


πŸ”₯ SEE ALSO πŸ”₯


⚠️ real talk: you gotta set this up before you play it, and you gotta stop it when you're done. start it, play it, stop it. that's the whole arc. no skipping steps bestie πŸ’€

and that's the whole page, periodt πŸ’– this came to you from the Simple Directmedia Layer girlies, SDL 3.4.18, and yes we're still out here writing SDL_PlayHapticRumble(3) like it's our main character moment πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from