#include #include #include #include typedef struct bouton{ int xmin; int xmax; int ymin; int ymax; }bouton; void creerBouton(bouton** boutons){ int numBouton, x, y; *boutons= (bouton*) malloc(4*sizeof(bouton)); for (numBouton=0, y=100; y<300; y+=150){ for (x=100; x<300; x+=150, numBouton++){ printf("%d) x=%d y=%d\n",numBouton,x,y); boutons[numBouton]->xmin=x; boutons[numBouton]->xmax=x+100; boutons[numBouton]->ymin=y; boutons[numBouton]->ymax=y+100; printf("finis\n"); printf("%d %d %d %d\n",boutons[numBouton]->xmin,boutons[numBouton]->xmax,boutons[numBouton]->ymin,boutons[numBouton]->ymax); } } } void afficheBouton(bouton* boutons, int numBouton, int etat){ char chemin[21]="images/bouton?-?.png"; chemin[13]= (char) numBouton+48; chemin[13]= etat; ChargerImage(chemin,boutons[numBouton].xmin,boutons[numBouton].ymin,0,0,100,100); } int detectClic(bouton* boutons, int choix){ int numBouton; while(SourisCliquee()); while(1){ while (SourisCliquee()==0){} for (numBouton=0;numBouton<4; numBouton++){ if (_Xboutons[numBouton].xmin && _Yboutons[numBouton].ymin){ afficheBouton(boutons,choix,0); return numBouton; } } } }