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, from0to0xFFFF. that's the deep, rumbly, chest-hitting one. 0xFFFF is max drama. πhigh_frequency_rumbleβ the intensity of the high frequency (right) rumble motor, from0to0xFFFF. the buzzy little one. also maxes out at0xFFFF, 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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms