SDL Wiki

SDL_MouseMotionTransformCallback

A callback used to transform mouse motion delta from raw values.

Header File

Defined in <SDL3/SDL_mouse.h>

Syntax

typedef void (SDLCALL *SDL_MouseMotionTransformCallback)( void *userdata, Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, float *x, float *y);

#define SDL_BUTTON_LEFT     1
#define SDL_BUTTON_MIDDLE   2
#define SDL_BUTTON_RIGHT    3
#define SDL_BUTTON_X1       4
#define SDL_BUTTON_X2       5

#define SDL_BUTTON_MASK(X)  (1u << ((X)-1))
#define SDL_BUTTON_LMASK    SDL_BUTTON_MASK(SDL_BUTTON_LEFT)
#define SDL_BUTTON_MMASK    SDL_BUTTON_MASK(SDL_BUTTON_MIDDLE)
#define SDL_BUTTON_RMASK    SDL_BUTTON_MASK(SDL_BUTTON_RIGHT)
#define SDL_BUTTON_X1MASK   SDL_BUTTON_MASK(SDL_BUTTON_X1)
#define SDL_BUTTON_X2MASK   SDL_BUTTON_MASK(SDL_BUTTON_X2)

Function Parameters

userdata what was passed as userdata to SDL_SetRelativeMouseTransform().
timestamp the associated time at which this mouse motion event was received.
window the associated window to which this mouse motion event was addressed.
mouseID the associated mouse from which this mouse motion event was emitted.
x pointer to a variable that will be treated as the resulting x-axis motion.
y pointer to a variable that will be treated as the resulting y-axis motion.

Remarks

This is called during SDL's handling of platform mouse events to scale the values of the resulting motion delta.

Thread Safety

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. Care should be taken with proper synchronization practices when adding other side effects beyond mutation of the x and y values.

Version

This datatype is available since SDL 3.2.6.

See Also


CategoryAPI, CategoryAPIDatatype, CategoryMouse


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.