on répare quelques trucs

This commit is contained in:
Mathieu PROAL 2022-11-29 17:27:10 +01:00
parent e7a3019038
commit b0605c841a

View File

@ -20,20 +20,20 @@ int main(void){
/*Initialisation des tableaux*/ /*Initialisation des tableaux*/
for (i=0;i<20;i++){ for (i=0;i<20;i++){
for (j=0;j<2;j++){ for (j=0;j<4;j++){
positions[i][j]=0; positions[i][j]=0;
} }
} }
for (i=0;i<40;i++){ for (i=0;i<40;i++){
tab[i]=0; tab[i]=-1;
} }
/*Tirage des images*/ /*Tirage des images*/
srand(time(NULL)); srand(time(NULL));
for (i=0;i<2;i++){ for (i=0;i<2;i++){
for (j=0;j<nb_paires+1;j++){ for (j=0;j<nb_paires;j++){
nb=rand()%(nb_paires*2); nb=rand()%(nb_paires*2);
if (tab[nb]!=0){ if (tab[nb]!=-1){
j--; j--;
} }
else{ else{
@ -41,16 +41,16 @@ int main(void){
} }
} }
} }
printf("toto\n");
/*Affichage des images*/ /*Affichage des images*/
srand(time(NULL)); srand(time(NULL));
i=0; i=0;
for (pos_y=10;pos_y<380;pos_y=pos_y+90){ for (pos_y=10;pos_y<380;pos_y=pos_y+90){
for (pos_x=10;pos_x<650;pos_x=pos_x+90){ for (pos_x=10;pos_x<650;pos_x=pos_x+90){
if (tab[i]==0){ /*if (tab[i]==-1){
pos_y=1000; pos_y=1000;
} }*/
if (positions[tab[i]][0]==0){ if (positions[tab[i]][0]==0){
positions[tab[i]][0]=pos_x; positions[tab[i]][0]=pos_x;
positions[tab[i]][1]=pos_y; positions[tab[i]][1]=pos_y;
@ -60,28 +60,18 @@ int main(void){
positions[tab[i]][3]=pos_y; positions[tab[i]][3]=pos_y;
} }
/*Triche*/ /*Triche*/
snprintf(tirage,50,"Images/image%d.png",tab[i]); snprintf(tirage,50,"Images/image%d.png",(tab[i]+1));
ChargerImage(tirage,pos_x,pos_y,0,0,80,80); ChargerImage(tirage,pos_x,pos_y,0,0,80,80);
///ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80);
i++; i++;
//ChargerImage("Images/image0.png",pos_x,pos_y,0,0,80,80);
} }
} }
/*for (i=0;i<20;i++){ while(score<=20){
printf("%03d", i); if (SourisCliquee()){
printf(" "); SourisPosition();
}
printf("\n");
for (j=0;j<4;j++){
for (i=0;i<20;i++){
printf("%03d", positions[i][j]);
printf(" ");
}
printf("\n");
}*/
/*while(score==20){*/
while (SourisCliquee()==0){
clic_x=_X; clic_x=_X;
clic_y=_Y; clic_y=_Y;
} }
@ -89,7 +79,7 @@ int main(void){
for (pos_y=380;pos_y>10;pos_y=pos_y-90){ for (pos_y=380;pos_y>10;pos_y=pos_y-90){
if (clic_y>=pos_y){ if (clic_y>=pos_y){
if (clic_y<=pos_y+90){ if (clic_y<=pos_y+80){
im_y=pos_y; im_y=pos_y;
pos_y=0; pos_y=0;
} }
@ -97,7 +87,7 @@ int main(void){
} }
for (pos_x=650;pos_x>10;pos_x=pos_x-90){ for (pos_x=650;pos_x>10;pos_x=pos_x-90){
if (clic_x>=pos_x){ if (clic_x>=pos_x){
if (clic_x<=pos_x+90){ if (clic_x<=pos_x+80){
im_x=pos_x; im_x=pos_x;
pos_x=0; pos_x=0;
} }
@ -115,7 +105,7 @@ int main(void){
} }
} }
} }
/*}*/ }
Touche(); Touche();
FermerGraphique(); FermerGraphique();
printf("\n"); printf("\n");