SDL_AppInit_func(3type)
β¨ SDL_AppInit_func(3type) β¨
okay bestie, welcome to the SDL3 DATATYPES corner of the man pages π this one's about SDL_AppInit_func β a function pointer typedef, no cap. it's giving "little type, big responsibilities" π
πΈ NAME πΈ
SDL_AppInit_func β the function pointer typedef for SDL_AppInit. yeah. that's the whole vibe. it's the shape your init function has to have π
π¦ SYNOPSIS π¦
#include <SDL3/SDL_init.h>
typedef SDL_AppResult (SDLCALL *SDL_AppInit_func)(void **appstate, int argc, char *argv[]);
look at her. iconic signature. copy it exactly, don't freestyle β¨
π DESCRIPTION π
so here's the tea π β these are used by SDL_EnterAppMainCallbacks. that mechanism lowkey operates behind the scenes for apps that are using the optional main callbacks. it's the backstage crew of your app, fr fr π§
and here's the plot twist: if you're an app that wants this, you should just implement SDL_AppInit directly. don't go touching the typedef like it's a DIY project. periodt π
π FUNCTION PARAMETERS π
appstateβ a place where the app can optionally store a pointer for future use. like a little pocket π«Ά stash whatever you want in there for later, or don't, your call.argcβ the standard ANSI Cmain'sargc; the number of elements inargv. yes bestie, the same one. the classic.argvβ the standard ANSI Cmain'sargv; an array of command line arguments. your app's lil receipts of what the user typed π
π RETURN VALUE π
it returns an SDL_AppResult, and here's your menu of options:
SDL_APP_FAILUREβ terminate with an error π it's giving "we're cooked"SDL_APP_SUCCESSβ terminate with success β¨ ate and left no crumbsSDL_APP_CONTINUEβ continue π₯ the show goes on
β AVAILABILITY β
this datatype has been available since SDL 3.2.0. so if you're on anything older... bestie. upgrade π
π«Ά quick reminder: every flag, value and signature above is verbatim from the original page β the vibe is mine, the facts are SDL's.
and that's the page, gorgeous π this was Simple Directmedia Layer's SDL_AppInit_func(3type), from SDL 3.4.18 β tysm for reading, go write some slay callbacks, mwah ππβ¨
π¦ 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