Include File(s): SDL.h
The functions in this category are used to set up SDL for use and generally have global effects in your program.
To begin using SDL in your program SDL_Init() must be called before most other SDL functions. The role of SDL_Init() is to properly initialize the SDL library and start each of the various subsystems requested as part of the call.
- {i} The File I/O and Threading subsystems are initialized by default. To initialize other subsystems you must specifically call them. Multiple subsystems may be OR'd together.
- Example:
- <syntaxhighlight lang="c"> SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); </syntaxhighlight>
- This initializes the 2 default subsystems plus the Video, Audio, and Event Handling subsystems.
- The Event Handling subsystem is initialized implicitly by the Video subsystem.
SDL_Quit() should be called before an SDL application exits to safely shut down all subsystems, including the default ones.
- It is not necessary to specify individual subsystems when using SDL_Quit() as it will automatically shut down all active subsystems.
<>
CategoryCategory