SDL_PinchFingerEvent(3type)
π SDL_PinchFingerEvent π
okay bestie, gather round, because today we're talking about SDL_PinchFingerEvent β it's a whole datatype situation from the SDL3 manuals, and it's literally the struct that powers your two-finger pinch zoom. no cap.
β¨ NAME β¨
SDL_PinchFingerEvent β the pinch event structure, aka everything hiding under event.pinch.* π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_events.h>
typedef struct SDL_PinchFingerEvent
{
SDL_EventType type; /**< ::SDL_EVENT_PINCH_BEGIN or ::SDL_EVENT_PINCH_UPDATE or ::SDL_EVENT_PINCH_END */
Uint32 reserved;
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
float scale; /**< The scale change since the last SDL_EVENT_PINCH_UPDATE. Scale < 1 is "zoom out". Scale > 1 is "zoom in". */
SDL_WindowID windowID; /**< The window underneath the finger, if any */
} SDL_PinchFingerEvent;
π DESCRIPTION π
so here's the tea, bestie. this struct is what you get handed when someone does a pinch gesture on a touchscreen and SDL is like "bestie, they're pinching, here's the receipts." β¨
let's break down every single field because we do NOT skip details in this house:
typeβ anSDL_EventTypethat tells you which part of the pinch saga you're in. it's one of::SDL_EVENT_PINCH_BEGIN,::SDL_EVENT_PINCH_UPDATE, or::SDL_EVENT_PINCH_END. the whole trilogy, beginning to end, main character energy fr fr. πreservedβ aUint32justβ¦ sitting there. minding its own business. don't touch it, it's not for you. πtimestampβ aUint64in nanoseconds, and it gets populated usingSDL_GetTicksNS(). yes, nanoseconds. we're precise in this household. β±οΈscaleβ afloatand honestly the star of the show. it's the scale change since the lastSDL_EVENT_PINCH_UPDATE. so like:Scale < 1is "zoom out" (pinching in, shrinking), andScale > 1is "zoom in" (fingers spreading, growing). lowkey the most important number in here. π₯windowIDβ anSDL_WindowIDfor the window underneath the finger, if any. "if any"!! so sometimes it's just not there, and that's valid. π¦
β SEE ALSO β
hmm, the original didn't hand us a SEE ALSO section, so we're keeping it exactly as-is β which is to say, nothing. periodt. π
okay that's the whole page!! this datatype lives in the SDL3 DATATYPES manual, and it's from Simple Directmedia Layer, version SDL 3.4.18 β so go forth, handle your pinch events, and slay. πβ¨π«Ά
π bye bestie, you ate π
π¦ 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