SDL_DisplayEvent(3type)

πŸ’– SDL_DisplayEvent πŸ’–

okay bestie, welcome to the SDL_DisplayEvent page from the SDL3 DATATYPES era of the manual β€” it's giving "your screen just did a thing and we need to tell you about it" and honestly? iconic. ✨

🌸 NAME 🌸

SDL_DisplayEvent β€” display state change event data, aka the whole event.display.* situation πŸ–₯οΈπŸ’«


πŸŽ€ SYNOPSIS πŸŽ€

first things first, you gotta pull in the header:

#include <SDL3/SDL_events.h>

then boom, here's the struct, copied exactly, no notes:

typedef struct SDL_DisplayEvent
{
    SDL_EventType type; /**< SDL_EVENT_DISPLAY_* */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
    SDL_DisplayID displayID;/**< The associated display */
    Sint32 data1;       /**< event dependent data */
    Sint32 data2;       /**< event dependent data */
} SDL_DisplayEvent;

πŸ¦‹ the members, one by one πŸ¦‹

  • type β€” an SDL_EventType, and it's always one of the SDL_EVENT_DISPLAY_* squad. this is your vibe check on which display thing happened. πŸ‘‘
  • reserved β€” a Uint32 just... sitting there. reserved. mind your business, don't touch it, it's not for us. πŸ™ˆ
  • timestamp β€” a Uint64, measured in nanoseconds, and it gets filled in using SDL_GetTicksNS(). so like, when did this happen, down to the nanosecond, no cap. ⏱️
  • displayID β€” an SDL_DisplayID, aka the associated display. the specific screen that's going through it. πŸ–₯️
  • data1 β€” a Sint32 of event dependent data. whatever the event needs it to be, bestie. it depends. πŸ’…
  • data2 β€” also a Sint32, also event dependent data. the sequel. the second half of the story. πŸ“
ngl, data1 and data2 are event dependent, which is the polite way of saying "read the docs for the specific SDL_EVENT_DISPLAY_* you got, because these two change their whole personality based on context." don't assume, don't guess. 🫢

✨ AVAILABILITY ✨

this struct has been serving since SDL 3.2.0. it's available, it's here, it's ready for you. 🌈


and that's the whole page, no filler, all facts preserved, we ate and left no crumbs. πŸ’œ

this page came to you straight from Simple Directmedia Layer β€” SDL 3.4.18 β€” SDL_DisplayEvent(3type). mwah, take care of your displays, bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from