SDL_SETRELATIVEMOUSETRANSFORM(3)
π SDL_SetRelativeMouseTransform(3) π
okay bestie, so we're in the SDL3 FUNCTIONS section of the manual and today's main character is SDL_SetRelativeMouseTransform πβ¨ she's a little niche but she ATE.
πΈ NAME πΈ
SDL_SetRelativeMouseTransform β set a user-defined function by which to transform relative mouse inputs. like, you hand SDL a lil callback and it runs your mouse movement through it before it reaches you. custom mouse math, no cap π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_mouse.h>
bool SDL_SetRelativeMouseTransform(SDL_MouseMotionTransformCallback callback, void *userdata);
π¦ DESCRIPTION π¦
okay so this one overrides the relative system scale and relative speed scale hints. yes, those hints. she said "I'll take it from here" π
and listen β you should be calling this prior to enabling relative mouse mode. if you don't, it fails. periodt. that's not a suggestion, that's the rules π
π FUNCTION PARAMETERS π
callbackβ a callback used to transform relative mouse motion, orNULLfor default behavior. yeah,NULLis valid, that's the "never mind, do it the normal way" option π«Άuserdataβ a pointer that will be passed tocallback. your lil bundle of personal data, hand-delivered straight to your function. iconic behavior honestly π
β RETURN VALUE β
Returns true on success or false on failure. and if it's a false? call SDL_GetError() for more information, because she WILL tell you what went wrong, just ask her nicely π
π THREAD SAFETY π
This function should only be called on the main thread. main character energy only, no side-quest threads allowed π
π AVAILABILITY π
This function is available since SDL 3.4.0. so if you're on something older... bestie, upgrade, it's giving ancient π
lowkey reminder: this overrides the relative system scale and relative speed scale hints, and it fails if you call it after enabling relative mouse mode. do it in the right order and you're slaying β¨
Simple Directmedia Layer π«Ά SDL 3.4.18 π¦ and yeah, this whole vibe was SDL_SetRelativeMouseTransform(3), that's the page, that's the girl, mwah πππ
π¦ 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