47 lines
907 B
C
47 lines
907 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <graph.h>
|
|
#include <time.h>
|
|
#include "images.h"
|
|
|
|
|
|
void main(void){
|
|
InitialiserGraphique();
|
|
ChoisirEcran(0);
|
|
CreerFenetre(0,0,1024,576);
|
|
int images_dispo[20];
|
|
int nb_tire;
|
|
int boucle;
|
|
char tirage[50];
|
|
int tire;
|
|
int pos_x;
|
|
int pos_y;
|
|
|
|
ChargerImage("Images/background.png",0,0,0,0,1024,576);
|
|
|
|
/*Remplissage du tableau*/
|
|
for(boucle=0;boucle<20;boucle++){
|
|
images_dispo[boucle]=2;
|
|
}
|
|
|
|
/*Tirage de la première image*/
|
|
for (pos_y=10;pos_y<380;pos_y=pos_y+90){
|
|
for (pos_x=10;pos_x<650;pos_x=pos_x+90){
|
|
srand(time(NULL));
|
|
nb_tire=rand()%20;
|
|
while (images_dispo[nb_tire]==0){
|
|
printf("oui");
|
|
srand(time(NULL));
|
|
nb_tire=rand()%20;
|
|
}
|
|
images_dispo[nb_tire]--;
|
|
|
|
tire=nb_tire+1;
|
|
snprintf(tirage,50,"Images/image%d.png",tire);
|
|
ChargerImage(tirage,pos_x,pos_y,0,0,80,80);
|
|
}
|
|
}
|
|
|
|
Touche();
|
|
FermerGraphique();
|
|
} |