SDL_MouseWheelEvent(3type)
π SDL_MouseWheelEvent π
okay bestie, so this page lives in the SDL3 DATATYPES corner of the manual and it's all about SDL_MouseWheelEvent β literally the struct that carries your scroll wheel vibes, aka everything in event.wheel.*. π±οΈβ¨
πΈ NAME πΈ
SDL_MouseWheelEvent β the mouse wheel event structure, no cap, it's giving event.wheel.*
β¨ SYNOPSIS β¨
#include <SDL3/SDL_events.h>
typedef struct SDL_MouseWheelEvent
{
SDL_EventType type; /**< SDL_EVENT_MOUSE_WHEEL */
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 or 0 */
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
SDL_MouseWheelDirection direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
float mouse_x; /**< X coordinate, relative to window */
float mouse_y; /**< Y coordinate, relative to window */
Sint32 integer_x; /**< The amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12) */
Sint32 integer_y; /**< The amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12) */
} SDL_MouseWheelEvent;
π¦ DESCRIPTION π¦
so like. let me break down every single field because you deserve to know exactly what you're working with, and also because skipping fields is a crime I simply will not commit. π«Ά
typeβ it's anSDL_EventType, and for this struct it'sSDL_EVENT_MOUSE_WHEEL. that's the whole personality.reservedβ aUint32just chillin'. hands off, bestie.timestampβ aUint64measured in nanoseconds, populated usingSDL_GetTicksNS(). time is fake but this number is very real.windowIDβ anSDL_WindowID: the window that has mouse focus, if any. sometimes there's just... no window. we've all been there. πwhichβ anSDL_MouseID: the mouse instance id in relative mode, or0. yes, zero. iconic behavior honestly.xβ afloat, the amount scrolled horizontally. positive to the right, negative to the left. directions! we love a coordinate with opinions.yβ afloat, the amount scrolled vertically. positive away from the user, negative toward the user. it's the y axis doing its little thing.directionβ anSDL_MouseWheelDirection, set to one of theSDL_MOUSEWHEEL_*defines. and here's the tea: when it'sFLIPPEDthe values in X and Y will be opposite β so multiply by-1to change them back. do not skip this, I'm begging. πmouse_xβ afloat, the X coordinate, relative to the window.mouse_yβ afloat, the Y coordinate, relative to the window.integer_xβ aSint32, the amount scrolled horizontally, accumulated to whole scroll "ticks" (added in 3.2.12). ticks!! like a clock but for scrolling.integer_yβ aSint32, the amount scrolled vertically, accumulated to whole scroll "ticks" (added in 3.2.12). matching set, obviously.
π‘ gentle reminder:xandyare the smoothfloatvibes, andinteger_x/integer_yare the accumulated whole-"tick" versions. both are here. both matter. don't make me choose favorites.
π AVAILABILITY π
this struct has been available since SDL 3.2.0. periodt. β¨
and that's the whole page, bestie β written by the Simple Directmedia Layer girlies, from SDL 3.4.18. now go forth and scroll responsibly. π ππ¦
π¦ 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