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
| int main(int argc, char *argv[])
{
int continuer =1;
Point monPoint;
SDL_Event event2;
SDL_Surface *affichePoint = NULL;
SDL_Surface *screen = NULL;
SDL_Init(SDL_INIT_EVERYTHING);
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
SDL_WM_SetCaption( "Bouge le point", NULL );
affichePoint = SDL_LoadBMP( "dot.bmp" );
while (continuer)
{
while( SDL_PollEvent( &event2 ) )
{
SDL_FillRect( screen, &screen->clip_rect, SDL_MapRGB( screen->format, 255, 255, 255 ) );
monPoint.handle_input(event2,affichePoint, screen);
//On remplit l'ecran de blanc
//On affiche le point sur l'ecran
//monPoint.show(affichePoint, screen);
if( event2.type == SDL_QUIT )
{
//On quitte the programme
continuer = 0;
}
}
}
//Libèration des surfaces
SDL_FreeSurface( affichePoint );
//On quitte SDL
SDL_Quit();
return EXIT_SUCCESS;
} |
Partager