SDL_GUID(3type)

✨ SDL_GUID β€” the 128-bit glow-up ✨

okay so bestie, welcome to the SDL3 DATATYPES corner of the manual, page SDL_GUID(3type). this one's short but it's iconic, trust. πŸ’–


🌸 NAME 🌸

SDL_GUID β€” an SDL_GUID is a 128-bit identifier for an input device that identifies that device across runs of SDL programs on the same platform. fr fr, it's the device's little permanent name tag. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_guid.h>

typedef struct SDL_GUID {
    Uint8 data[16];
} SDL_GUID;

look at her. sixteen lil bytes. Uint8 data[16] and that's the whole entire struct. no cap. πŸ‘‘


πŸ’… DESCRIPTION πŸ’…

so here's the vibe. if the device gets detached and then re-attached to a different port, or if the base system gets rebooted, the device should still report the same GUID. like, she remembers who she is. main character energy, honestly. 🌟

GUIDs are as precise as possible, but β€” and this is the important part, don't skip it β€” they are not guaranteed to distinguish physically distinct but equivalent devices. for example, two game controllers from the same vendor with the same product ID and revision may have the same GUID. so yeah, twins can absolutely have the same ID. 😭

also GUIDs may be platform-dependent β€” meaning the same device may report different GUIDs on different operating systems. so don't go carrying that value across platforms and expecting it to still hit, bestie. 🫢

🌈 AVAILABILITY 🌈

this struct has been available since SDL 3.2.0. so if you're on something older... girl. πŸ™ˆ


that's the whole page, you ate it up. πŸ’œ

Simple Directmedia Layer β€’ SDL 3.4.18 β€’ page SDL_GUID(3type) β€” mwah, ily, go write some device-matching code, bestie πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from