SDL_QuitSubSystem
Name
SDL_QuitSubSystem -- Shut down requested initialized subsystems
Synopsis
#include <SDL.h> void SDL_QuitSubSystem (Uint32 flags);
Description
SDL_QuitSubSystem shuts down one or more SDL subsystems, specified by flags, earlier started by SDL_Init or SDL_InitSubSystem.
You might want to do this to save memory if your program only needs a certain subsystem some of the time.
This function uses the same SDL_INIT_* values as SDL_Init, except that SDL_INIT_NOPARACHUTE and SDL_INIT_EVENTTHREAD do nothing.
Return Value
Returns nothing.
Note: If you start a subsystem using a call to that subsystem's init function (for example SDL_VideoInit) instead of SDL_Init or SDL_InitSubSystem, SDL_QuitSubSystem and SDL_WasInit will not work. You will need to use that subsystem's quit function (SDL_VideoQuit) directly instead.
Note: You still need to call SDL_Quit even if you close all open subsystems with SDL_QuitSubSystem.
Example
1 #include <SDL.h>
2
3 /* ... */
4
5 int main(int argc, char **argv) {
6 int sdl_initialized = 0;
7 sdl_initialized = !SDL_Init(0);
8
9 /* ... console stuff ... */
10
11 if (sdl_initialized && SDL_InitSubSystem(SDL_INIT_VIDEO)) {
12 display_graph();
13 SDL_QuitSubSystem(SDL_INIT_VIDEO);
14 }
15
16 /* ... more console stuff ... */
17
18 if (sdl_initialized) SDL_Quit();
19 return 0;
20 }
See Also
SDL_Init, SDL_InitSubSystem, SDL_Quit
