SDL_PinchFingerEvent(3type)

πŸ“¦
version 3.4.18 Β· 5 versions
, in fedora 43, fedora 44

πŸ’… 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 β€” an SDL_EventType that 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 β€” a Uint32 just… sitting there. minding its own business. don't touch it, it's not for you. πŸ™ˆ
  • timestamp β€” a Uint64 in nanoseconds, and it gets populated using SDL_GetTicksNS(). yes, nanoseconds. we're precise in this household. ⏱️
  • scale β€” a float and honestly the star of the show. it's the scale change since the last SDL_EVENT_PINCH_UPDATE. so like: Scale < 1 is "zoom out" (pinching in, shrinking), and Scale > 1 is "zoom in" (fingers spreading, growing). lowkey the most important number in here. πŸ”₯
  • windowID β€” an SDL_WindowID for 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