SDL_MOUSEMOTIONTRANSFORMCALLBACK(3type)
π SDL_MouseMotionTransformCallback π
okay bestie, so this one lives in the SDL3 DATATYPES crew (that's the manual collection it's filed under, not that anyone asked, but now you know β¨), and it's basically the glow-up filter for your mouse motion. Let's get into it.
β¨ NAME β¨
SDL_MouseMotionTransformCallback β a callback used to transform mouse motion delta from raw values. it's giving "make the numbers prettier on the way in" π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_mouse.h>
typedef void (SDLCALL *SDL_MouseMotionTransformCallback)( void *userdata, Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, float *x, float *y);
like, copy that exactly, don't get creative with it π
πΈ DESCRIPTION πΈ
so this callback gets called while SDL is handling platform mouse events, and its whole job is to scale the values of the resulting motion delta. raw in, transformed out. it's the middle-manager of mouse movement, but in a cute way π
π«Ά FUNCTION PARAMETERS π«Ά
userdataβ whatever you passed asuserdatatoSDL_SetRelativeMouseTransform(). your little backpack of stuff you dragged along for the ride πtimestampβ the associated time at which this mouse motion event was received. when it happened, basically β°windowβ the associated window to which this mouse motion event was addressed. which window was getting the attention πmouseIDβ the associated mouse from which this mouse motion event was emitted. which mouse, because yes, there can be more than one πxβ pointer to a variable that will be treated as the resulting x-axis motion. a pointer, so you can actually change it βοΈyβ pointer to a variable that will be treated as the resulting y-axis motion. same deal, vertical flavor βοΈ
π THREAD SAFETY π
okay bestie, listen, this part is not a vibe, this part is real.
This callback is called by SDL's internal mouse input processing procedure, which may be a thread separate from the main event loop that is run at realtime priority. Stalling this thread with too much work in the callback can therefore potentially freeze the entire system.
π¨ no cap: do NOT do heavy lifting in here. Stalling this thread can freeze the entire system. fr fr.
Care should be taken with proper synchronization practices when adding other side effects beyond mutation of the x and y values. mutation of x and y is the assignment, everything else needs lock discipline π
π AVAILABILITY π
This datatype is available since SDL 3.4.0. so if you're on anything older, bestie, it's not there, sorry π
π SEE ALSO π
SDL_SetRelativeMouseTransform(3)β the thing that hooks this callback up. iykyk π
and that's the whole page, you ate it, periodt π β¨
this lil datatype page came to you from Simple Directmedia Layer, running SDL 3.4.18 β mwah, sending you and your mouse deltas all my love π«Άππ¦
π¦ 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