Init, errors & main callbacksSDL 3.2
SDL_InitSubSystem
Starts more subsystems after SDL is already running, e.g. audio only when the game reaches its menu.
Signature
bool SDL_InitSubSystem(SDL_InitFlags flags);
How it works
It takes the same flags as SDL_Init and works the same way: SDL_Init simply calls it. Use it to delay a slow subsystem, or one the user may never need. SDL_QuitSubSystem stops it again early; otherwise SDL_Quit stops everything.
Parameters
flagsSDL_InitFlags
The subsystems to start, e.g. SDL_INIT_AUDIO.
Return value
true on success, false on failure (see SDL_GetError).
Example
example.cpp
1SDL_Init(SDL_INIT_VIDEO); // window first, fast start
2// ... later, entering the options menu:
3if (!SDL_InitSubSystem(SDL_INIT_AUDIO))
4 SDL_Log("no audio: %s", SDL_GetError());