=====SDL===== This is my write-up on my working with SDL, from the SDL book __Focus on SDL__. The first program in the book just checks to see if SDL initialized properly: fosdl1_1.cpp 1 #include "SDL/SDL.h" 2 #include 3 4 int main(int argc, char* argv[]) 5 { 6 if (SDL_Init(SDL_INIT_VIDEO) == -1) 7 { 8 fprintf(stderr, "Could not initialize SDL!\n"); 9 } 10 else 11 { 12 fprintf(stdout, "SDL initialized properly!\n"); 13 SDL_Quit(); 14 } 15 return 0; 16 } The next program is a small SDL-based application, a screen pops up when it is run: fosdl1_2.cpp 1 #include "SDL/SDL.h" 2 #include 3 #include 4 5 SDL_Surface* g_pMainSurface = NULL; 6 SDL_Event g_Event; 7 8 int main(int argc, char* argv[]) 9 { 10 if (SDL_Init(SDL_INIT_VIDEO) == -1) 11 { 12 fprintf(stderr, "Could not initialize SDL!\n"); 13 exit(1); 14 } 15 else 16 { 17 fprintf(stdout, "SDL initialized properly!\n"); 18 atexit(SDL_Quit); 19 } 20 21 g_pMainSurface = SDL_SetVideoMode( 640,480, 0, SDL_ANYFORMAT); 22 23 if(!g_pMainSurface) 24 { 25 fprintf(stderr, "Could not create main surface!\n"); 26 exit(1); 27 } 28 29 for(;;) 30 { 31 if(SDL_WaitEvent(&g_Event) == 0) 32 { 33 fprintf(stderr, "Error while waiting for an event!\n"); 34 exit(1); 35 } 36 37 //check the type of event 38 if(g_Event.type == SDL_QUIT) 39 { 40 fprintf(stdout, "Quit event has occured.\n"); 41 break; 42 } 43 } 44 45 fprintf(stdout, "Terminating program normally.\n"); 46 47 return(0); 48 } But wait! There's more... Coming Soon!