From 54e2083393acfc0d55089d073ec4a275f1b004e8 Mon Sep 17 00:00:00 2001 From: morinl Date: Fri, 2 Dec 2022 16:25:42 +0100 Subject: [PATCH] Fix du merge --- images.c | 1 - jeu.c | 52 +++++++++++++--------------------------------------- jeu.h | 2 +- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/images.c b/images.c index 8abbfb1..ec70382 100644 --- a/images.c +++ b/images.c @@ -58,7 +58,6 @@ int tirage_aleatoire(int nb_paires){ positions[tab[i]][2]=pos_x; positions[tab[i]][3]=pos_y; } - /*j'ai mis la triche dans le jeu.c*/ ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); i++; diff --git a/jeu.c b/jeu.c index cb896d1..c0faf96 100644 --- a/jeu.c +++ b/jeu.c @@ -28,9 +28,6 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ ChoisirCouleurDessin(c); EcrireTexte(865,360,scoretab,2); while(score=10;pos_y=pos_y-90){ if (clic_y>=pos_y){ if (clic_y<=pos_y+80){ @@ -122,8 +118,6 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ } } } - - /*Détecter si le clic était sur l'axe des abcisses d'une image*/ for (pos_x=640;pos_x>=10;pos_x=pos_x-90){ if (clic_x>=pos_x){ if (clic_x<=pos_x+80){ @@ -133,22 +127,22 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ } } - /*Si les deux boucles précédentes ont été vérifiées (si le clic a bien eu lieu sur une image)*/ if (im_x!=0 && im_y!=0){ for (i=0;i<20;i++){ for (j=0;j<2;j++){ if (position[i][(j*2)]==im_x && position[i][(j*2+1)]==im_y){ if (repet==0){ g=i+1; + snprintf(comparer1,50,"Images/image%d.png",g); + ChargerImage(comparer1,im_x,im_y,0,0,80,80); stock_g_1=g; } else{ g=i+1; + snprintf(comparer2,50,"Images/image%d.png",g); + ChargerImage(comparer2,im_x,im_y,0,0,80,80); stock_g_2=g; } - snprintf(affichage,50,"Images/image%d.png",g); - printf("Voici affichage: %s\n",affichage); - ChargerImage(affichage,im_x,im_y,0,0,80,80); repet++; } } @@ -158,40 +152,20 @@ int jeu(int position[20][4], int nb_paires,int tab[40]){ } /*printf("%d\n", im_x); printf("%d\n", im_y);*/ - - /*Si les deux images retournées ont le même numéro*/ if (stock_g_1==stock_g_2){ score++; - for (i=0; i<40;i++){ - if (tab[i]==stock_g_1){ - tab[i]=0; - } - } - position[stock_g_1-1][0]=0; - position[stock_g_1-1][1]=0; - position[stock_g_1-1][2]=0; - position[stock_g_1-1][3]=0; } repet2=0; - i=0; if (score!=nb_paires){ sleep(1); for (pos_y=10;pos_y<=370;pos_y=pos_y+90){ for (pos_x=10;pos_x<=640;pos_x=pos_x+90){ - printf("Voici tab[%d]", i); - printf(": %d\n", tab[i]); - - repet2++; - if (repet2==nb_images){ - pos_x=750; - pos_y=380; - } - - if (tab[i]!=0){ - ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); - } - i++; - + ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); + repet2++; + if (repet2==nb_images){ + pos_x=750; + pos_y=380; + } } } } diff --git a/jeu.h b/jeu.h index 4b712fd..256c67b 100644 --- a/jeu.h +++ b/jeu.h @@ -1,6 +1,6 @@ #ifndef JEU_H #define JEU_H -int jeu(int positions[20][4], int nb_paires,int tab); +int jeu(int positions[20][4], int nb_paires,int tab[40]); #endif \ No newline at end of file