Specifications

SDL_INIT_EVENTTHREAD Initializes the event thread.
Table 4. SDL_Init flags
Setup Video Mode
Use SDL_SetVideoMode to set up a video mode with the specified
width, height and bits-per-pixel. The following C code shows the usage of
SDL_SetVideoMode, which would return a pointer of SDL_Surface
structure, the image can then be filled into the pointer pscreen->pixels.
The parameter are width, height, bpp and flags, the width and height
parameters are the specific of the video, the bpp parameter is the number of
bits per pixel, so a bpp of 24 uses the packed representation of 3 bytes/pixel.,
and the flags parameters are show in Table 5.
pscreen =
SDL_SetVideoMode (image_width, image_height, 24 ,
SDL_SWSURFACE);
if (pscreen == NULL) {
printf ("Couldn't set %d*%dx%d video mode: %s\n",
image_width, image_height, bpp * 8,
SDL_GetError ());
exit (1);
}
SDL_SWSURFACE Create the video surface in system memory
SDL_HWSURFACE Create the video surface in video memory
SDL_ASYNCBLIT Enables the use of asynchronous updates of the display
surface.
SDL_ANYFORMAT Normally, if a video surface of the requested bits-per-pixel
(bpp) is not available, SDL will emulate one with a shadow
surface. Passing SDL_ANYFORMAT prevents this and
causes SDL to use the video surface, regardless of its pixel
depth.
etc … etc …
Table 5. The SDL_SetVideoMode flags parameters
Update Image on Screen
Use SDL_UpdateRect to makes sure the given area is updated on the
given screen. The rectangle must be confined within the screen boundaries.
The SDL_UpdateRect parameters are pscreen, x, y, w, h, if x, y, w and h
are all 0, SDL_UpdateRect will update the entire screen. The C code shows
43