1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include "SDL/SDL.h"
void returnBackground(int x, int y,SDL_Surface *source, SDL_Surface *destination){
SDL_Rect rect;
rect.x = x;
rect.y = y;
SDL_BlitSurface(source, NULL, destination, &rect);
}
int main(int argc, char* args[]){
SDL_Surface *screen = NULL;
SDL_Surface *background = NULL;
bool gameRunning = true;
SDL_Event event;
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode(1366,768,16,SDL_SWSURFACE);
background = SDL_LoadBMP("windows.bmp");
while(gameRunning == true){
if (SDL_PollEvent(&event)){
if (event.type ==SDL_QUIT){
gameRunning = false;
}
}
}
returnBackground(0,0,background,screen);
SDL_Flip(screen);
SDL_Quit();
return 0;
}
|