SDL_INIT_INTERFACE(3)
π SDL_INIT_INTERFACE π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_INIT_INTERFACE β a macro that initializes an SDL interface β¨
πΈ NAME πΈ
SDL_INIT_INTERFACE β a macro to initialize an SDL interface, no cap π«Ά
β¨ SYNOPSIS β¨
#include <SDL3/SDL_stdinc.h>
#define SDL_INIT_INTERFACE(iface) \
do { \
SDL_zerop(iface); \
(iface)->version = sizeof(*(iface)); \
} while (0)
π DESCRIPTION π
So this macro initializes an SDL interface structure, and the vibe check here is: you gotta call it before you start filling out the fields with your own implementation. Like, set it up first, then decorate. It's giving "prepare the canvas before the masterpiece" π
You can use it like this:
SDL_IOStreamInterface iface;
SDL_INIT_INTERFACE(&iface);
// Fill in the interface function pointers with your implementation
iface.seek = ...
stream = SDL_OpenIO(&iface, NULL);
And if you're a designated-initializers girlie (respect, honestly), you can just use the size of the interface as the version, like:
SDL_IOStreamInterface iface = {
.version = sizeof(iface),
.seek = ...
};
stream = SDL_OpenIO(&iface, NULL);
Both routes, same destination. Pick your fighter π
π§΅ THREAD SAFETY π§΅
It is safe to call this macro from any thread. Multithreaded and unbothered, periodt π
π AVAILABILITY π
This macro is available since SDL 3.2.0 β
π¦ SEE ALSO π¦
and that's the whole page, bestie!! this lil icon came to you courtesy of Simple Directmedia Layer, rockin' SDL 3.4.18 β mwah, go init those interfaces ππβ¨π«Ά
π¦ 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