premier essais de clics

This commit is contained in:
Mathieu PROAL 2022-11-29 16:35:28 +01:00
parent 54cdbbf4b6
commit e7a3019038

View File

@ -8,10 +8,10 @@ int main(void){
InitialiserGraphique();
ChoisirEcran(0);
CreerFenetre(0,0,1024,576);
char tirage[50];
char tirage[50], affichage[10];
int pos_x, pos_y, clic_x, clic_y, im_y, im_x;
int i, j;
int nb;
int i, j, g;
int nb, score=0;
int tab[40];
int nb_paires=20;
int positions[20][4];
@ -22,6 +22,7 @@ int main(void){
for (i=0;i<20;i++){
for (j=0;j<2;j++){
positions[i][j]=0;
}
}
for (i=0;i<40;i++){
tab[i]=0;
@ -58,31 +59,68 @@ int main(void){
positions[tab[i]][2]=pos_x;
positions[tab[i]][3]=pos_y;
}
/*Triche
/*Triche*/
snprintf(tirage,50,"Images/image%d.png",tab[i]);
ChargerImage(tirage,pos_x,pos_y,0,0,80,80);
i++;*/
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);
}
}
SourisCliquee();
clic_x=_X;
clic_y=_Y;
for (pos_y=380;pos_y>10;pos_y=pos_y-90){
}
for (pos_x=650;pos_x>10;pos_x=pos_x-90){
}
/*for (i=0;i<20;i++){
printf("%03d", i);
printf(" ");
}
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_y=_Y;
}
for (pos_y=380;pos_y>10;pos_y=pos_y-90){
if (clic_y>=pos_y){
if (clic_y<=pos_y+90){
im_y=pos_y;
pos_y=0;
}
}
}
for (pos_x=650;pos_x>10;pos_x=pos_x-90){
if (clic_x>=pos_x){
if (clic_x<=pos_x+90){
im_x=pos_x;
pos_x=0;
}
}
}
for (i=0;i<20;i++){
for (j=0;j<2;j++){
if (positions[i][(j*2)]==im_x){
if (positions[i][(j*2+1)]==im_y){
g=i+1;
snprintf(affichage,10,"Images/image%d.png",g);
ChargerImage(affichage,pos_x,pos_y,0,0,80,80);
}
}
}
}
/*}*/
Touche();
FermerGraphique();
printf("\n");
return EXIT_SUCCESS;
}
}