12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include <iostream>
- #include <SDL/SDL.h>
- #include "retourner.h"
- int main ( int argc, char** argv )
- {
-
-
- if ( SDL_Init( SDL_INIT_VIDEO ) < 0)
- {
- std::cout << "Impossible d'initialiser la SDL: " << SDL_GetError() << std::endl;
- return 1;
- }
-
- atexit(SDL_Quit);
-
- SDL_WM_SetCaption("Application SDL", 0);
-
-
- SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16,
- SDL_HWSURFACE|SDL_DOUBLEBUF);
- if ( !screen )
- {
- std::cout << "Unable to set 640x480 video: " << SDL_GetError() << std::endl;
- return 1;
- }
-
- SDL_Surface* originale = SDL_LoadBMP("cb.bmp");
- SDL_Surface* copie = retournement(originale,78);
- SDL_Rect posOrig={20,20,0,0};
-
- SDL_Surface* poubelle(0);
-
- bool done = false;
- while (!done)
- {
-
- SDL_Event event;
- while (SDL_PollEvent(&event))
- {
- switch (event.type)
- {
- case SDL_QUIT:
- done = true;
- break;
- case SDL_KEYDOWN:
- if (event.key.keysym.sym == SDLK_ESCAPE)
- done = true;
- break;
- }
- }
-
- poubelle = originale;
- originale = retournement(originale,1);
- SDL_FreeSurface(poubelle);
- posOrig.x=320-originale->w/2;
- posOrig.y=240-originale->h/2;
-
- SDL_FillRect(screen, 0, SDL_MapRGB(screen->format, 0, 255, 255));
- SDL_BlitSurface(originale,0,screen,&posOrig);
-
- SDL_Flip(screen);
-
- SDL_Delay(200);
- }
-
- SDL_FreeSurface(screen);
- SDL_FreeSurface(originale);
- SDL_FreeSurface(copie);
- std::cout << "Aucune erreur détectée." << std::endl;
- return 0;
- }
|