SDL_InitSubSystem
Name
SDL_InitSubSystem -- initialize one or more SDL subsystems
Synopsis
#include "SDL.h" int SDL_InitSubSystem (Uint32 flags)
Description
SDL_InitSubSystem initializes one or more SDL subsystems as specified by flags.
This function uses the same SDL_INIT_* values as SDL_Init, except that SDL_INIT_NOPARACHUTE does nothing.
Return Value
Returns 0 if successful, -1 otherwise.
If this function fails, there will usually be an error message available through SDL_GetError().
Note: You still need to call SDL_Init before calling this function.
Example
1 #include <SDL.h>
2 #include <stdio.h>
3
4 int main(int argc, char **argv) {
5 /* Use SDL for timers... */
6 if (SDL_Init(SDL_INIT_TIMER) != 0) {
7 fprintf(stderr, "\nUnable to initialize SDL: %s\n", SDL_GetError());
8 return 1;
9 }
10
11 /* If available, use SDL for video, else fallback to text... */
12 if (SDL_InitSubSystem(SDL_INIT_VIDEO) == 0) {
13 /* SDL video available */
14
15 /* ... */
16
17 }
18 else {
19 /* fallback to text */
20
21 /* ... */
22
23 }
24
25 SDL_Quit();
26 return 0;
27 }
See Also
SDL_Init, SDL_WasInit, SDL_QuitSubSystem
