Skip to content
Snippets Groups Projects
Commit 3a83b377 authored by Montjoie Henri's avatar Montjoie Henri
Browse files

nettoyage+preparation gestion des PV

parent 4ede0cc6
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -644,10 +644,9 @@ int affichage_carte()
{
int i,j,y=0;
int x=0;
int nombre_classes=nbClasses();
int perso_select=1;
SDL_Event event;
SDL_Surface* ecran=SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE)+LARGEUR_BORDURE, HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);;
SDL_Surface* classes[nombre_classes];
SDL_Surface* cases[HAUTEUR_CARTE][LARGEUR_CARTE];
SDL_Surface* persos[NB_PERSO*NB_JOUEURS];
SDL_Surface* Case_brillante=NULL;
......@@ -657,15 +656,16 @@ int affichage_carte()
SDL_Rect Position_Case_brillante;
SDL_Rect Position_Guerrier_select;
SDL_Surface* PV = NULL;
SDL_Surface* texte = NULL;
SDL_Surface* nom_joueur = NULL;
SDL_Surface* bouton1 = NULL;
SDL_Surface* bouton2 = NULL;
SDL_Rect pos_PV;
SDL_Rect pos_texte;
SDL_Rect pos_nom_joueur;
SDL_Rect pos_bouton1;
SDL_Rect pos_bouton2;
TTF_Font *police = NULL;
TTF_Font *vieille_police = NULL;
SDL_Color couleurNoire = {0, 0, 0};
SDL_Color couleurBlanche = {255, 255, 255};
......@@ -673,13 +673,14 @@ int affichage_carte()
SDL_Color couleurDoree = {190, 190, 120};
vieille_police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",30);
police=TTF_OpenFont("../resources/fonts/arial.ttf",27);
texte= TTF_RenderText_Shaded(vieille_police, "Joueur actuel :", couleurBlanche,couleurNoire);
nom_joueur= TTF_RenderText_Shaded(vieille_police, nom_1, couleurBlanche, couleurNoire);
bouton1= TTF_RenderText_Shaded(vieille_police, "Perso suivant", couleurDoree, couleurBleue);
bouton2= TTF_RenderText_Shaded(vieille_police, "Joueur suivant", couleurDoree, couleurBleue);
/*char* buffer_PV;
sprintf(buffer_PV, "%d/%d", obtenirPVPersonnage(perso_select),obtenirPVMaxPersonnage(perso_select));
PV=TTF_RenderText_Shaded(vieille_police, buffer_PV, couleurBlanche, couleurNoire);*/
pos_texte.x=ecran->w-(LARGEUR_BORDURE+texte->w)/2;
pos_texte.y=20;
......@@ -689,6 +690,8 @@ int affichage_carte()
pos_bouton2.y=ecran->h-bouton2->h-40;
pos_bouton1.x=ecran->w-(LARGEUR_BORDURE+bouton1->w)/2;
pos_bouton1.y=pos_bouton2.y-(2*bouton2->h);
/*pos_PV.x=ecran->w-(LARGEUR_BORDURE+PV->w)/2;
pos_PV.y=pos_nom_joueur.y+(2*nom_joueur->h);*/
for(i=0; i<LARGEUR_CARTE; i++)
{
......@@ -703,16 +706,6 @@ int affichage_carte()
SDL_SetColorKey(cases[j][i], SDL_SRCCOLORKEY, SDL_MapRGB(cases[j][i]->format, 0, 0, 255));
}
}
for(i=0; i<nombre_classes; i++)
{
classes[i]=SDL_LoadBMP(obtenirSkinsClasses()[i]);
if (!classes[i])
{
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
SDL_SetColorKey(classes[i], SDL_SRCCOLORKEY, SDL_MapRGB(classes[i]->format, 0, 0, 255));
}
for(i=0; i<NB_JOUEURS*NB_PERSO; i++)
{
......@@ -768,6 +761,7 @@ int affichage_carte()
}
if(event.button.y>pos_bouton2.y&&event.button.y<pos_bouton2.y+bouton2->h){
//nextJoueur();
//nom_joueur= TTF_RenderText_Shaded(vieille_police, obtenirNomJoueur(), couleurBlanche, couleurNoire);
}
if(event.button.x<LARGEUR_CARTE*LARGEUR_CASE){
//deplacement_personnage(event.button.x,event.button.y);
......@@ -822,7 +816,7 @@ int affichage_carte()
}
/*SDL_BlitSurface(Guerrier_select,NULL,ecran,&Position_Guerrier_select);*/
SDL_BlitSurface(Case_brillante,NULL,ecran,&Position_Case_brillante);
//SDL_BlitSurface(PV,NULL,ecran,&pos_PV);
SDL_BlitSurface(texte,NULL,ecran,&pos_texte);
SDL_BlitSurface(nom_joueur,NULL,ecran,&pos_nom_joueur);
SDL_BlitSurface(bouton1,NULL,ecran,&pos_bouton1);
......@@ -831,7 +825,22 @@ int affichage_carte()
SDL_Flip(ecran);
}
//free les surfaces*/
for(i=0;i<HAUTEUR_CARTE;i++){
for(j=0;j<LARGEUR_CARTE;j++){
SDL_FreeSurface(cases[i][j]);
}
}
for(i=0;i<NB_PERSO*NB_JOUEURS;i++){
SDL_FreeSurface(persos[i]);
}
SDL_FreeSurface(Case_brillante);
SDL_FreeSurface(Guerrier_select);
SDL_FreeSurface(texte);
SDL_FreeSurface(nom_joueur);
SDL_FreeSurface(bouton1);
SDL_FreeSurface(bouton2);
TTF_CloseFont(vieille_police);
etat=FERMER;
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment