SDL_MouseMotionEvent(3type)
π SDL_MouseMotionEvent β like, the mouse moved, bestie π
okay so welcome to the SDL_MouseMotionEvent page, from the SDL3 DATATYPES corner of the Simple Directmedia Layer manual π¦. This is the struct that shows up as event.motion.* when your mouse is out here living its main character life across the screen. Every twitch, every glide, every lil wiggle. We're obsessed. β¨
πΈ NAME πΈ
SDL_MouseMotionEvent β the Mouse motion event structure, aka event.motion.* ππ«
β¨ SYNOPSIS β¨
Include it like the good little coder you are:
#include <SDL3/SDL_events.h>
And here's the whole struct, every single field, no cap β I'm giving it to you verbatim because facts are facts π :
typedef struct SDL_MouseMotionEvent
{
SDL_EventType type; /**< SDL_EVENT_MOUSE_MOTION */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
SDL_WindowID windowID; /**< The window with mouse focus, if any */
SDL_MouseID which; /**< The mouse instance id in relative mode, SDL_TOUCH_MOUSEID for touch events, SDL_PEN_MOUSEID for pen events, or 0 */
SDL_MouseButtonFlags state; /**< The current button state */
float x; /**< X coordinate, relative to window */
float y; /**< Y coordinate, relative to window */
float xrel; /**< The relative motion in the X direction */
float yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
π what every field is giving π
typeβ it'sSDL_EVENT_MOUSE_MOTION, that's the vibe check this struct always passes π«Άreservedβ not yours to touch, bestie, hands off πtimestampβ in nanoseconds, filled in usingSDL_GetTicksNS(), so it's giving very precise β±οΈβ¨windowIDβ the window that has mouse focus, if any (keyword: if any)whichβ the mouse instance id in relative mode, orSDL_TOUCH_MOUSEIDfor touch events, orSDL_PEN_MOUSEIDfor pen events, or0. so many options, so iconic πstateβ the current button state, literally just what buttons are doing rnxβ X coordinate, relative to window πyβ Y coordinate, relative to window πxrelβ the relative motion in the X direction, the how far did it slide energyyrelβ the relative motion in the Y direction, same but vertical, periodt
π AVAILABILITY π
This struct has been available since SDL 3.2.0 β so if you're on anything older, it's not you, it's the version π
heads up bestie: don't go renaming or merging these fields,xandxrelare NOT the same thing and the compiler will absolutely catch you lacking π
okay that's the whole page, you ate it, go make something cute with your mouse events ππ
later, bestie β this was the Simple Directmedia Layer manual, SDL 3.4.18, and the page is SDL_MouseMotionEvent(3type) πβ¨π¦
π¦ 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