Specifications
Start
Initial SDL
Subsystem
Setup Video
Mode
Update Image
on Screen
Shut Down SDL
End
Figure 23. SDL usage of displaying on the screen
Figure 238 shows the flow chat of SDL displaying image on the screen,
it has four steps which were described as below:
Initial SDL subsystem
SDL composes of eight subsystems - Audio, CDROM, Event Handling,
File I/O, Joystick Handling, Threading, Timers and Video. Before you can
use any of these subsystems they must be initialized by calling SDL_init.
The following C code shows the initialization of SDL video subsystem.
if ((SDL_Init (SDL_INIT_VIDEO) == -1)) {
printf ("Could not initialize SDL: %s.\n", SDL_GetError ());
exit (-1);
}
The parameter specifies are:
SDL_INIT_VIDEO Initializes the video subsystem.
SDL_INIT_TIMER Initializes the timer subsystem.
SDL_INIT_AUDIO Initializes the audio subsystem.
SDL_INIT_CDROM Initializes the cdrom subsystem.
SDL_INIT_JOYSTICK Initializes the joystick subsystem
SDL_INIT_EVERYTHING Initialize all of the above.
SDL_INIT_NOPARACHUTE Prevents SDL from catching fatal signals.
42