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

ajout du bouton lancer la partie

parent e3f06975
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -232,7 +232,6 @@ int affichage_ecran_accueil() ...@@ -232,7 +232,6 @@ int affichage_ecran_accueil()
SDL_Surface* ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF); SDL_Surface* ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_WM_SetCaption("Elder Internal Ignition",NULL); SDL_WM_SetCaption("Elder Internal Ignition",NULL);
SDL_Event event; SDL_Event event;
SDL_Surface* rectangle = NULL;
SDL_Surface* logo = NULL; SDL_Surface* logo = NULL;
SDL_Surface* texte = NULL; SDL_Surface* texte = NULL;
TTF_Font *police = NULL; TTF_Font *police = NULL;
...@@ -245,7 +244,6 @@ int affichage_ecran_accueil() ...@@ -245,7 +244,6 @@ int affichage_ecran_accueil()
texte = TTF_RenderText_Shaded(police, "Entrez dans le Royaume !", couleurDoree,couleurBleue); texte = TTF_RenderText_Shaded(police, "Entrez dans le Royaume !", couleurDoree,couleurBleue);
pos_texte.x=(ecran->w-texte->w)/2; pos_texte.x=(ecran->w-texte->w)/2;
pos_texte.y=ecran->h-200; pos_texte.y=ecran->h-200;
rectangle=SDL_CreateRGBSurface(SDL_HWSURFACE,texte->w,texte->h,0,0,0,255,0);
logo = SDL_LoadBMP("../resources/Skins/logo.bmp"); logo = SDL_LoadBMP("../resources/Skins/logo.bmp");
if (!logo) if (!logo)
...@@ -258,7 +256,6 @@ int affichage_ecran_accueil() ...@@ -258,7 +256,6 @@ int affichage_ecran_accueil()
SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0)); SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0));
SDL_BlitSurface(logo,NULL,ecran,&pos_logo); SDL_BlitSurface(logo,NULL,ecran,&pos_logo);
SDL_BlitSurface(texte,NULL,ecran,&pos_texte); SDL_BlitSurface(texte,NULL,ecran,&pos_texte);
SDL_BlitSurface(rectangle,NULL,ecran,&pos_texte);
SDL_Flip(ecran); SDL_Flip(ecran);
while(etat==LANCEMENT) while(etat==LANCEMENT)
...@@ -278,13 +275,11 @@ int affichage_ecran_accueil() ...@@ -278,13 +275,11 @@ int affichage_ecran_accueil()
} }
SDL_BlitSurface(logo,NULL,ecran,&pos_logo); SDL_BlitSurface(logo,NULL,ecran,&pos_logo);
SDL_BlitSurface(texte,NULL,ecran,&pos_texte); SDL_BlitSurface(texte,NULL,ecran,&pos_texte);
SDL_BlitSurface(rectangle,NULL,ecran,&pos_texte);
SDL_Flip(ecran); SDL_Flip(ecran);
} }
TTF_CloseFont(police); TTF_CloseFont(police);
SDL_FreeSurface(ecran); SDL_FreeSurface(ecran);
SDL_FreeSurface(logo); SDL_FreeSurface(logo);
SDL_FreeSurface(rectangle);
SDL_FreeSurface(texte); SDL_FreeSurface(texte);
return 0; return 0;
} }
...@@ -300,6 +295,7 @@ int affichage_menu_configuration() ...@@ -300,6 +295,7 @@ int affichage_menu_configuration()
SDL_Surface* ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF); SDL_Surface* ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_WM_SetCaption("Elder Internal Ignition",NULL); SDL_WM_SetCaption("Elder Internal Ignition",NULL);
SDL_Event event; SDL_Event event;
SDL_Surface* lancer_partie = NULL;
SDL_Surface* map_choisie = NULL; SDL_Surface* map_choisie = NULL;
SDL_Surface* texte = NULL; SDL_Surface* texte = NULL;
SDL_Surface* texte2 = NULL; SDL_Surface* texte2 = NULL;
...@@ -310,6 +306,7 @@ int affichage_menu_configuration() ...@@ -310,6 +306,7 @@ int affichage_menu_configuration()
SDL_Surface* images_persos[NB_PERSO][NB_JOUEURS]={{NULL}}; SDL_Surface* images_persos[NB_PERSO][NB_JOUEURS]={{NULL}};
SDL_Rect positions_images[NB_PERSO][NB_JOUEURS]; SDL_Rect positions_images[NB_PERSO][NB_JOUEURS];
SDL_Rect posTextes[NB_JOUEURS*NB_PERSO]; SDL_Rect posTextes[NB_JOUEURS*NB_PERSO];
SDL_Rect pos_bouton;
SDL_Rect pos_texte; SDL_Rect pos_texte;
SDL_Rect pos_texte2; SDL_Rect pos_texte2;
SDL_Rect pos_texte3; SDL_Rect pos_texte3;
...@@ -319,13 +316,18 @@ int affichage_menu_configuration() ...@@ -319,13 +316,18 @@ int affichage_menu_configuration()
TTF_Font *petite_police = NULL; TTF_Font *petite_police = NULL;
SDL_Color couleurNoire = {0, 0, 0}; SDL_Color couleurNoire = {0, 0, 0};
SDL_Color couleurBlanche = {255, 255, 255}; SDL_Color couleurBlanche = {255, 255, 255};
SDL_Color couleurBleue = {10, 30, 80};
SDL_Color couleurDoree = {190, 190, 120};
int i,j,p,k,c; int i,j,p,k,c;
SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0)); SDL_FillRect(ecran,NULL,SDL_MapRGB(ecran->format,0,0,0));
police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",44); police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",46);
petite_police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",32); petite_police=TTF_OpenFont("../resources/fonts/OLDENGL.ttf",32);
lancer_partie= TTF_RenderText_Shaded(police, "Lancer la partie", couleurDoree, couleurBleue);
pos_bouton.y=ecran->h-lancer_partie->h-25;
pos_bouton.x=(ecran->w-lancer_partie->w)/2;
texte= TTF_RenderText_Shaded(police, nom_1, couleurBlanche,couleurNoire); texte= TTF_RenderText_Shaded(police, nom_1, couleurBlanche,couleurNoire);
texte2= TTF_RenderText_Shaded(police, nom_2, couleurBlanche, couleurNoire); texte2= TTF_RenderText_Shaded(police, nom_2, couleurBlanche, couleurNoire);
texte3= TTF_RenderText_Shaded(petite_police, "choisissez vos personnages", couleurBlanche, couleurNoire); texte3= TTF_RenderText_Shaded(petite_police, "choisissez vos personnages", couleurBlanche, couleurNoire);
...@@ -367,7 +369,7 @@ int affichage_menu_configuration() ...@@ -367,7 +369,7 @@ int affichage_menu_configuration()
} }
char** path_images=obtenirSkinsClasses(); char** path_images=obtenirSkinsClasses();
int numClassePerso[3][2]={{-1,-1},{-1,-1},{-1,-1}}; int numClassePerso[NB_PERSO][NB_JOUEURS]={{-1,-1},{-1,-1},{-1,-1}};
j=0; /*numero du joeuur*/ j=0; /*numero du joeuur*/
p=0; /*numero du personnage*/ p=0; /*numero du personnage*/
char *classeChoisie; char *classeChoisie;
...@@ -421,12 +423,32 @@ int affichage_menu_configuration() ...@@ -421,12 +423,32 @@ int affichage_menu_configuration()
return 0; return 0;
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if(event.button.x>pos_bouton.x&&event.button.x<pos_bouton.x+lancer_partie->w&&event.button.y>pos_bouton.y&&event.button.y<pos_bouton.y+lancer_partie->h){
for(i=0;i<NB_PERSO;i++){
for(k=0;k<NB_JOUEURS;k++){
if(numClassePerso[i][k]==-1){
p=-1;
}
}
}
if(p==0&&c!=-1){
//etat=TOUR_J1P1;
printf("c'est parti!\n");
}
if(c==-1){
printf("choisissez une carte\n");
}
if(p==-1){
p=0;
printf("selectionnez des personnages\n");
}
}
for(i=0;i<5;i++) for(i=0;i<5;i++)
{ {
if(event.button.x>position_carte[i].x&&event.button.x<position_carte[i].x+previsualisation[0]->w&&event.button.y>position_carte[i].y&&event.button.y<position_carte[i].y+previsualisation[0]->h) if(event.button.x>position_carte[i].x&&event.button.x<position_carte[i].x+previsualisation[0]->w&&event.button.y>position_carte[i].y&&event.button.y<position_carte[i].y+previsualisation[0]->h)
{ {
c=i; c=i;
//selectionnerCarte(obtenirNomsCartes()[c]); selectionnerCarte(obtenirNomsCartes()[c]);
} }
} }
if(event.button.x>posTextes[0].x&&event.button.x<posTextes[0].x+textes[0]->w) if(event.button.x>posTextes[0].x&&event.button.x<posTextes[0].x+textes[0]->w)
...@@ -466,6 +488,7 @@ int affichage_menu_configuration() ...@@ -466,6 +488,7 @@ int affichage_menu_configuration()
} }
} }
} }
SDL_BlitSurface(lancer_partie,NULL,ecran,&pos_bouton);
SDL_BlitSurface(texte,NULL,ecran,&pos_texte); SDL_BlitSurface(texte,NULL,ecran,&pos_texte);
SDL_BlitSurface(texte2,NULL,ecran,&pos_texte2); SDL_BlitSurface(texte2,NULL,ecran,&pos_texte2);
SDL_BlitSurface(texte3,NULL,ecran,&pos_texte3); SDL_BlitSurface(texte3,NULL,ecran,&pos_texte3);
...@@ -487,6 +510,7 @@ int affichage_menu_configuration() ...@@ -487,6 +510,7 @@ int affichage_menu_configuration()
SDL_FreeSurface(texte); SDL_FreeSurface(texte);
SDL_FreeSurface(texte2); SDL_FreeSurface(texte2);
SDL_FreeSurface(texte3); SDL_FreeSurface(texte3);
SDL_FreeSurface(lancer_partie);
for(i=0;i<5;i++){ for(i=0;i<5;i++){
SDL_FreeSurface(previsualisation[i]); SDL_FreeSurface(previsualisation[i]);
} }
......
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