SDL_MouseButtonEvent(3)
β¨ SDL_MouseButtonEvent β¨
okay bestie, welcome to the SDL_MouseButtonEvent(3) page from the SDL API Reference π this one's all about the lil struct that tells you when someone clicked a mouse button, no cap π±οΈβ¨
πΈ NAME πΈ
SDL_MouseButtonEvent β the mouse button event structure, aka the glow-up notification you get when a click happens π
π STRUCTURE DEFINITION π
here's the whole fit, literally:
typedef struct{
Uint8 type;
Uint8 button;
Uint8 state;
Uint16 x, y;
} SDL_MouseButtonEvent;
that's it. five fields. iconic. π
π¦ STRUCTURE DATA π¦
okay so let's go field by field, main character by main character:
typeβ eitherSDL_MOUSEBUTTONDOWNorSDL_MOUSEBUTTONUPπ«Ά this is the vibe check on whether it's a press or a release.buttonβ the mouse button index, and the classics areSDL_BUTTON_LEFT,SDL_BUTTON_MIDDLE, andSDL_BUTTON_RIGHTπ±οΈstateβSDL_PRESSEDorSDL_RELEASEDπx, yβ the X/Y coordinates of the mouse at press/release time π fr fr, it snaps the exact spot.
π DESCRIPTION π
so SDL_MouseButtonEvent is a member of the SDL_Event union, and it's the one that shows up when an event of type SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP gets reported β¨
when a mouse button press or release is detected, the number of the button pressed goes into button β that's a range from 1 to 255, and lowkey, 1 is usually the left button and 2 the right π then the position of the mouse when this event occured gets stored in the x and the y fields π like, it's giving coordinates, periodt.
and just like SDL_KeyboardEvent, the info on whether the event was a press or a release is stored in both the type and state fields π which, yeah, is redundant but honestly it should be obvious bestie π
π₯ SEE ALSO π₯
SDL_EventSDL_MouseMotionEvent
go read those next, iykyk π§π
k that's the whole page, love u, go click some stuff π and just so u know, this masterpiece is brought to you by SDL, dated Tue 11 Sep 2001, 22:59 β vintage but slaying π bye bestie!! ππΈπ¦
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms