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 54 55 56 57 58 59 60 61 62 63 64 65 66
|
/* On passe le tableau d´images a cette fonction, le tableau est donc bien initialise */
void affichage(espece **mer,humain *pecheur, SDL_Surface** images)
{
int i;
int j;
int k=0;
int abscisse=0;
int ordonnee=0;
SDL_Surface* imageDeFond;
SDL_Rect positionFond;
positionFond.x=0;
positionFond.y=0;
SDL_BlitSurface(images[FOND], NULL, ecran, &positionFond);
SDL_Surface* poisson;
SDL_Rect position;
for(i=0;i<TAILLE_MER;i++)
{
for(j=0;j<TAILLE_MER;j++)
{
position.x = 20 + abscisse;
position.y = 5 + ordonnee;
if(i==(*pecheur).abscisse && j==(*pecheur).ordonnee)
{
SDL_BlitSurface(images[PECH], NULL, ecran, &position);
}
else if(mer[i][j].type==TYPE_MER)
{
SDL_BlitSurface(images[MER], NULL, ecran, &position);
}
else if(mer[i][j].type==TYPE_PLANCTON)
{
SDL_BlitSurface(images[PLANCTON], NULL, ecran, &position);
}
else if(mer[i][j].type==TYPE_CORAIL)
{
SDL_BlitSurface(images[CORAIL], NULL, ecran, &position);
}
else if(mer[i][j].type==TYPE_BAR)
{
SDL_BlitSurface(images[BAR], NULL, ecran, &position);
}
else if(mer[i][j].type==TYPE_THON)
{
SDL_BlitSurface(images[THON], NULL, ecran, &position);
}
k++;
abscisse=abscisse+24;
}
abscisse=0;
ordonnee=ordonnee+24;
}
SDL_Flip(ecran);
} |
Partager