#include #include #include #include #include "images.h" #include "jeu.h" #include int jeu(int position[20][4], int nb_paires){ int score=0,repet,test=0; int pos_x,pos_y; int i,j,g; int repet2, nb_images; int clic_x,clic_y,im_y,im_x; unsigned long temps, temps2,temps3; char tempstab[50],affichage[50];; char* comparer[2]; int tab[3]; couleur c=CouleurParComposante(0,0,0); temps2=Microsecondes(); printf("Voici le nombre de paires: %d\n", nb_paires); nb_images=nb_paires*2; score=0; while(score=10;pos_y=pos_y-90){ if (clic_y>=pos_y){ if (clic_y<=pos_y+80){ im_y=pos_y; break; } } } for (pos_x=640;pos_x>=10;pos_x=pos_x-90){ if (clic_x>=pos_x){ if (clic_x<=pos_x+80){ im_x=pos_x; break; } } } 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){ g=i+1; snprintf(affichage,50,"Images/image%d.png",g); printf("Voici repet: %d\n", repet); printf("Voici affichage: %s\n", affichage); comparer[repet]=affichage; printf("Voici comparer[0]: %s\n", comparer[0]); printf("Voici comparer[1]: %s\n\n", comparer[1]); ChargerImage(affichage,im_x,im_y,0,0,80,80); repet++; } } } } } } printf("Voici comparer[0]: %s\n", comparer[0]); printf("Voici comparer[1]: %s\n", comparer[1]); /*printf("%d\n", im_x); printf("%d\n", im_y);*/ if (comparer[0]==comparer[1]){ score++; } repet2=0; if (score!=20){ 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){ ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80); repet2++; if (repet2==nb_images){ pos_x=750; pos_y=380; } } } } } FermerGraphique(); return EXIT_SUCCESS; }