fahdovski
Messages postés4Date d'inscriptionvendredi 7 mars 2008StatutMembreDernière intervention 4 avril 2008
-
8 mars 2008 à 16:05
manrugby
Messages postés2Date d'inscriptionlundi 21 juillet 2008StatutMembreDernière intervention22 juillet 2008
-
22 juil. 2008 à 17:24
IL Y'A EXECUTION MAIS LE PC PLANTE IL DEVIENT TRES LENT, MAIS POURQUOI??????
jE TRAVAILLE SUR CODE::BLOCKS SOUS LINUX
AVANT CA MARCHAIS IMPEC QUESQUI C'EST PASSE DANS L'ORDI???
if (SDL_INIT_VIDEO==-1)
return (EXIT_FAILURE);
//CREE L'ECRAN
ecran= SDL_SetVideoMode(800,600,32,SDL_HWSURFACE | SDL_DOUBLEBUF);
//ECRIRE DU TEXTE SUR LA FENETRE
SDL_WM_SetCaption("TeTrIs",NULL);
//LOADIND PICTURES
background= IMG_Load("/home/fahd/Pictures/Setsuna.npg");
SDL_BlitSurface(background,NULL,ecran,&posbackground);
image=IMG_Load("/home/fahd/Documents/SDL TUTO/tux.bmp");
SDL_SetColorKey(image,SDL_SRCCOLORKEY, SDL_MapRGB(image->format, 255, 255, 255));
SDL_BlitSurface(image,NULL,ecran,&posimage);
SDL_Flip(ecran);
while(go==1)
{ SDL_WaitEvent(&event);
switch(event.type)
{
case (SDL_QUIT): go=0;break;
case (SDLK_ESCAPE):go=0;break;
{
case (SDL_BUTTON_LEFT):
posimage.y=event.button.y;break;
posimage.x=event.button.x; break;
}
case (SDL_KEYDOWN):
switch(event.key.keysym.sym)
{
case SDLK_UP: posimage.y-=5;break;
case SDLK_DOWN: posimage.y+=5;break;
case SDLK_RIGHT: posimage.x+=5;break;
case SDLK_LEFT: posimage.x-=5;break;
case SDLK_ESCAPE: go=0;break;
}
}
SDL_ConvertSurface(ecran, background, 0);
SDL_BlitSurface(image,NULL,ecran,&posimage);
SDL_Flip(ecran);