SDL_CameraDeviceEvent(3type)

πŸ’– SDL_CameraDeviceEvent πŸ’–

okay bestie, we're in the SDL3 datatypes era and today's main character is SDL_CameraDeviceEvent, from SDL_CameraDeviceEvent(3type). it's the camera device event structure, and you'll catch it living its life under event.cdevice.*. πŸŽ€


✨ NAME ✨

SDL_CameraDeviceEvent β€” the camera device event structure, aka event.cdevice.* πŸŽ₯✨


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_events.h>

typedef struct SDL_CameraDeviceEvent
{
    SDL_EventType type; /**< SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, SDL_EVENT_CAMERA_DEVICE_DENIED */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_CameraID which;       /**< SDL_CameraID for the device being added or removed or changing */
} SDL_CameraDeviceEvent;

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically this is the struct you get handed when the camera situation changes, and you need to know about it. it's giving "the group chat has an update" energy, except the group chat is SDL and the update is a camera. πŸ’…

let's break down the members, because every single one matters:

  • type β€” an SDL_EventType, and it's gonna be one of these four icons: SDL_EVENT_CAMERA_DEVICE_ADDED, SDL_EVENT_CAMERA_DEVICE_REMOVED, SDL_EVENT_CAMERA_DEVICE_APPROVED, or SDL_EVENT_CAMERA_DEVICE_DENIED. which one you got tells you the whole vibe of the situation. πŸ‘€
  • reserved β€” a Uint32. it's just sitting there. hands off, bestie, it's not for you. πŸ™ˆ
  • timestamp β€” a Uint64, measured in nanoseconds, and it's populated using SDL_GetTicksNS(). so when did this happen? it tells you, in the tiniest units of time known to girlkind. ⏱️✨
  • which β€” an SDL_CameraID for the device that's being added, or removed, or changing. this is the "who is this about" field, and it's never not important. πŸ”₯

⭐ AVAILABILITY ⭐

this struct has been around since SDL 3.2.0. so if you're on anything older, sorry babe, it's not there yet. 😭


and that's the whole page, no notes. mwah. 🫢

this little love letter to cameras came to you from the good people of Simple Directmedia Layer, and it's serving SDL 3.4.18. go forth and handle your events, queen. πŸ’–πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from