SDL_RumbleJoystick(3)

πŸ’– SDL_RumbleJoystick(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_RumbleJoystick β€” yes, the one that makes your controller go brrrrr πŸŽ€


✨ NAME ✨

SDL_RumbleJoystick β€” Start a rumble effect. that's it, that's the whole vibe πŸ¦‹


✨ SYNOPSIS ✨

#include <SDL3/SDL_joystick.h>

bool SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);

like, look at that signature. so clean. so slay. πŸ’…


✨ DESCRIPTION ✨

okay so here's the tea, and it's important tea: every single call to this function cancels whatever rumble effect was already going on. no layering, no stacking, no "let me add one more on top". it's giving one-at-a-time energy, and honestly? valid. πŸ’œ

and if you call it with 0 intensity? that stops any rumbling. periodt. zero means silence, the motors go to sleep, the whole vibe resets. 😴

⚠️ also listen β€” this function requires you to process SDL events or call SDL_UpdateJoysticks() to update rumble state. the rumble does NOT just update itself behind your back, bestie. you gotta feed it. you gotta do the work. no cap. πŸ”₯

✨ FUNCTION PARAMETERS ✨

  • joystick β€” the joystick to vibrate. the chosen one. the device that's about to feel something. 🫢
  • low_frequency_rumble β€” the intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF. that's the deep, rumbly, chest-hitting one. 0xFFFF is max drama. πŸ’€
  • high_frequency_rumble β€” the intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF. the buzzy little one. also maxes out at 0xFFFF, both of them matching is a whole mood. ⭐
  • duration_ms β€” the duration of the rumble effect, in milliseconds. how long the brrrrr lasts before it's done. ⏱️

✨ RETURN VALUE ✨

returns true, or false if rumble isn't supported on this joystick. 😭 so yeah β€” always check. not every controller has the range, and that's okay, we don't shame. but false means no brrrrr for you, sorry girlie. πŸ’”


✨ THREAD SAFETY ✨

It is safe to call this function from any thread. yes literally any thread. go wild, bestie, the vibes are thread-safe. 🌈


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. so if you're on something older... girl. upgrade. πŸ‘‘


and that's the whole page, you ate it, you understood it, you're basically a rumble expert now πŸ’–

this has been your girl signing off on behalf of Simple Directmedia Layer, version SDL 3.4.18, dated with the classic SDL_RumbleJoystick(3) energy β€” go make something shake πŸŽ€βœ¨

πŸ“¦ where this page comes from