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 39 40 41 42 43
| int main(int argc,char *argv[])
{
/* initialize SDL */
SDL_Init(SDL_INIT_VIDEO);
/* set the title bar */
SDL_WM_SetCaption("SDL Test", "SDL Test");
/* create window */
SDL_Surface* screen = SDL_SetVideoMode(640, 480, 0, 0);
//charge une image bitmap
SDL_Surface* image = SDL_LoadBMP("sdl_logo.bmp");
SDL_Event event;
int game_loop = 0;
while (game_loop == 0)
{
if(SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
game_loop = 1;
break;
}
}
SDL_BlitSurface(image, NULL, screen, NULL);
SDL_Flip(screen);
}
SDL_FreeSurface(screen);
SDL_Quit();
return 0;
} |
Partager