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 C main's argc; the number of elements in argv. yes bestie, the same one. the classic.
  • argv β€” the standard ANSI C main's argv; 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 crumbs
  • SDL_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