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

probleme avec la fonction selectionner_carte

parent 0df4eeff
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -369,6 +369,8 @@ int affichage_menu_configuration() ...@@ -369,6 +369,8 @@ int affichage_menu_configuration()
printf("Unable to load bitmap: %s\n", SDL_GetError()); printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1; return 1;
} }
SDL_SetColorKey(map_choisie, SDL_SRCCOLORKEY, SDL_MapRGB(map_choisie->format, 0, 0, 255));
SDL_Surface* previsualisation[5]={NULL}; SDL_Surface* previsualisation[5]={NULL};
SDL_Rect position_carte[5]; SDL_Rect position_carte[5];
char* path[5]; char* path[5];
...@@ -378,6 +380,8 @@ int affichage_menu_configuration() ...@@ -378,6 +380,8 @@ int affichage_menu_configuration()
path[3]="../resources/Skins/Map_4.bmp"; path[3]="../resources/Skins/Map_4.bmp";
path[4]="../resources/Skins/autre_map.bmp"; path[4]="../resources/Skins/autre_map.bmp";
int c=-1;
for(i=0;i<5;i++) for(i=0;i<5;i++)
{ {
previsualisation[i]=SDL_LoadBMP(path[i]); previsualisation[i]=SDL_LoadBMP(path[i]);
...@@ -399,6 +403,14 @@ int affichage_menu_configuration() ...@@ -399,6 +403,14 @@ int affichage_menu_configuration()
etat=FERMER; etat=FERMER;
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
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)
{
c=i;
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)
j=1; j=1;
if(event.button.x>posTextes[3].x&&event.button.x<posTextes[3].x+textes[3].w) if(event.button.x>posTextes[3].x&&event.button.x<posTextes[3].x+textes[3].w)
...@@ -443,6 +455,7 @@ int affichage_menu_configuration() ...@@ -443,6 +455,7 @@ int affichage_menu_configuration()
{ {
SDL_BlitSurface(previsualisation[i],NULL,ecran,&position_carte[i]); SDL_BlitSurface(previsualisation[i],NULL,ecran,&position_carte[i]);
} }
if(c!=-1) SDL_BlitSurface(map_choisie,NULL,ecran,&position_carte[c]);
SDL_Flip(ecran); SDL_Flip(ecran);
p=0; p=0;
j=0; j=0;
......
...@@ -276,11 +276,14 @@ int selectionnerCarte(char * nomCarte){ ...@@ -276,11 +276,14 @@ int selectionnerCarte(char * nomCarte){
if(initCarte(&packGlobal.Cartes_Package[i],getCarte(partieGlobale),&packGlobal)==0){ if(initCarte(&packGlobal.Cartes_Package[i],getCarte(partieGlobale),&packGlobal)==0){
return 0; return 0;
} }
printf("la carte selectionnee est %s\n",nomCarte);
// Positionnement des Personnages sur la Carte_Jeu. // Positionnement des Personnages sur la Carte_Jeu.
setOnFirstJoueur(partieGlobale->participants); setOnFirstJoueur(partieGlobale->participants);
for(i=0;i<TAILLE_MAX_GROUPE;i++){ for(i=0;i<TAILLE_MAX_GROUPE;i++){
setPosition(getCurrentJoueur(partieGlobale->participants)->groupe[i],&partieGlobale->c->Tab_Cases[6+i][0]); printf("test1\n");
setPosition(getCurrentJoueur(partieGlobale->participants)->groupe[i],&partieGlobale->c->Tab_Cases[6+i][0]); //le probleme est ici
printf("test2\n");
} }
nextJoueur(partieGlobale->participants); nextJoueur(partieGlobale->participants);
for(i=0;i<TAILLE_MAX_GROUPE;i++){ for(i=0;i<TAILLE_MAX_GROUPE;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