SDL_EGLIntArrayCallback(3type)
π SDL_EGLIntArrayCallback π
okay bestie, welcome to the SDL3 DATATYPES corner of the man pages β this one is SDL_EGLIntArrayCallback(3type), and it's genuinely such a neat little type. it's a callback type for EGL surface/context attribute initialization. yes, it's giving very niche. yes, we're obsessed anyway. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_video.h>
typedef SDL_EGLint *(SDLCALL *SDL_EGLIntArrayCallback)(void *userdata, SDL_EGLDisplay display, SDL_EGLConfig config);
that's the whole signature, no cap. π
πΈ DESCRIPTION πΈ
so here's the vibe: this gets called when SDL is trying to create an EGL surface, and it exists so that your app can sneak extra attributes into its eglCreateWindowSurface() or eglCreateContext calls. like, "hey SDL, lemme add a couple things before you go". iconic behavior honestly. β¨
and for convenience β because SDL loves you β the EGLDisplay and EGLConfig you should use are handed straight to the callback. no hunting, no guessing, they just show up. π«Ά
now, the important part, so listen up:
- your callback should return a pointer to an EGL attribute array that's terminated with
EGL_NONE. that terminator is non-negotiable, it's the whole personality of the array. - if this function returns
NULL, theSDL_CreateWindowprocess will fail gracefully β so it's not a catastrophe, but it is a no. - the returned pointer should be allocated with
SDL_malloc()and it will be passed toSDL_free(). so SDL is doing the cleanup for you, bestie. you just have to allocate it the right way. π - the arrays returned by each callback will be appended to the existing attribute arrays defined by SDL. so you're not replacing anything, you're adding to the pile. more is more. π
π¦ FUNCTION PARAMETERS π¦
userdataβ an app-controlled pointer that is passed to the callback. it's yours, do whatever, SDL's just the messenger. πdisplayβ the EGL display to be used. β¨configβ the EGL config to be used. π
π RETURN VALUE π
returns a newly-allocated array of attributes, terminated with EGL_NONE. don't forget the terminator, fr fr. π
β AVAILABILITY β
this datatype has been available since SDL 3.2.0. so if you're on something older... girl. π
π SEE ALSO π
go read that one next, it's the whole friend group. π«Ά
mwah π that's the page! brought to you by Simple Directmedia Layer, version SDL 3.4.18 β stay slaying out there, and may all your attribute arrays end in EGL_NONE. π
β¨π
π¦ 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