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 44 45 46 47 48 49 50 51 52 53
| #include "sdl.h"
#include "stdlib.h"
#include "stdio.h"
#include "sdl_image.h"
int main(int argc, char* args[])
{
SDL_Surface *fenetre = NULL, *image = NULL, *image2 = NULL;
SDL_Rect positionFond, positionImg2;
bool exec = true;
positionFond.x = 0;
positionFond.y = 0;
positionImg2.x = 255;
positionImg2.y = 255;
SDL_Init(SDL_INIT_VIDEO);
SDL_WM_SetIcon(IMG_Load("..//images//Icone.bmp"), NULL);
SDL_WM_SetCaption("Jeu d'alignement", NULL);
fenetre = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE);
image = IMG_Load("..//images//fond.bmp");
SDL_BlitSurface(image, NULL, fenetre, &positionFond);
image2 = IMG_Load("..//images//sourir.png");
//SDL_SetColorKey(image2, SDL_SRCCOLORKEY, SDL_MapRGB(image2->format, 255, 255, 255));
SDL_BlitSurface(image2, NULL, fenetre, &positionImg2);
SDL_Flip(fenetre);
SDL_Event event;
while (exec)
{
SDL_WaitEvent(&event);
if ((event.type == SDL_KEYDOWN) || (event.type == SDL_QUIT))
{
exec = false; break;
}
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE: exec = false; break;
}
}
SDL_FreeSurface(image);
SDL_FreeSurface(image2);
SDL_Quit();
return EXIT_SUCCESS;
} |
Partager