From e844b950228b8d661b73d1fe0df42f2591ee1b1e Mon Sep 17 00:00:00 2001 From: proal Date: Mon, 28 Nov 2022 13:42:06 +0100 Subject: [PATCH] =?UTF-8?q?on=20gal=C3=A8re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- images.c | 62 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/images.c b/images.c index 0ec3cc0..fcb58a3 100644 --- a/images.c +++ b/images.c @@ -4,8 +4,7 @@ #include #include "images.h" - -int aleatoire(int pos_x, int pos_y){ +/*int aleatoire(int* tab[40]){ int nb; int position[20][4]; nb=rand()%20; @@ -22,33 +21,62 @@ int aleatoire(int pos_x, int pos_y){ else{ aleatoire(pos_x, pos_y); } -} + + + return tab[40]; +}*/ -void main(void){ - InitialiserGraphique(); +int main(void){ + /*InitialiserGraphique(); ChoisirEcran(0); - CreerFenetre(0,0,1024,576); - int boucle, boucle2; + CreerFenetre(0,0,1024,576);*/ char tirage[50]; int tire; - int pos_x; - int pos_y; - int position[20][4]; + int pos_x, pos_y; + int i, j, n; + int nb; + /*int position[20][4];*/ + int tab[40]; + + //ChargerImage("Images/background.png",0,0,0,0,1024,576); + + j=1; + n=1; + srand(time(NULL)); + for (i=0;i<40;i++){ + nb=rand()%40; + while (tab[nb]==0){ + nb++; + if (nb==20){ + nb=0; + } + } + printf("%d\n", nb); + tab[nb]=j; + n++; + if (n==3){ + j++; + n=1; + } + } + /* + for (i=0; i<40; i++){ + printf("%d\n", tab[i]); + }*/ - ChargerImage("Images/background.png",0,0,0,0,1024,576); /*Tirage des images*/ - srand(time(NULL)); + /*srand(time(NULL)); for (pos_y=10;pos_y<380;pos_y=pos_y+90){ - for (pos_x=10;pos_x<650;pos_x=pos_x+90){ - tire=aleatoire(pos_x, pos_y, position)+1; + for (pos_x=10;pos_x<650;pos_x=pos_x+90){ snprintf(tirage,50,"Images/image%d.png",tire); ChargerImage(tirage,pos_x,pos_y,0,0,80,80); } - } + }*/ - Touche(); - FermerGraphique(); + //Touche(); + //FermerGraphique(); + return EXIT_SUCCESS; }