/* * Main.cpp * * Created on: 13.08.2010 * Author: christoph */ #include #include #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 int main (int argc, char *argv[]) { SDL_Surface *screen, *background; SDL_Rect rectBackground; SDL_Event event; bool quit = false; // initialize video system if (SDL_Init(SDL_INIT_EVERYTHING) < 0) { printf("Unable to initalize SDL. Quitting\n"); return -1; } // create window screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_HWSURFACE | SDL_DOUBLEBUF); background = SDL_LoadBMP("bg.bmp"); background = SDL_DisplayFormat(background); if(background == NULL) { printf("Failed to load background\n"); } printf("The background was loaded bliting....\n"); while (quit==false) { while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: quit = true; break; } } SDL_BlitSurface(background, NULL, screen, &rectBackground); SDL_Flip(screen); } SDL_FreeSurface(background); SDL_Quit(); return 0; }