SAE11_2021/images.c

84 lines
1.2 KiB
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#include <graph.h>
#include <time.h>
#include "images.h"
2022-11-21 16:10:01 +01:00
2022-11-28 13:42:06 +01:00
/*int aleatoire(int* tab[40]){
2022-11-25 10:59:42 +01:00
int nb;
int position[20][4];
nb=rand()%20;
if (position[nb][0]<10){
position[nb][0]=pos_x;
position[nb][1]=pos_y;
return nb;
}
else if (position[nb][2]<10){
position[nb][2]=pos_x;
position[nb][3]=pos_y;
return nb;
}
else{
aleatoire(pos_x, pos_y);
}
2022-11-28 13:42:06 +01:00
return tab[40];
}*/
2022-11-25 10:59:42 +01:00
2022-11-28 13:42:06 +01:00
int main(void){
/*InitialiserGraphique();
2022-11-21 16:19:18 +01:00
ChoisirEcran(0);
2022-11-28 13:42:06 +01:00
CreerFenetre(0,0,1024,576);*/
char tirage[50];
int tire;
2022-11-28 13:42:06 +01:00
int pos_x, pos_y;
int i, j, n;
int nb;
/*int position[20][4];*/
int tab[40];
2022-11-28 13:42:06 +01:00
//ChargerImage("Images/background.png",0,0,0,0,1024,576);
2022-11-21 16:19:18 +01:00
2022-11-28 13:42:06 +01:00
j=1;
n=1;
2022-11-25 10:59:42 +01:00
srand(time(NULL));
2022-11-28 13:42:06 +01:00
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]);
}*/
/*Tirage des images*/
/*srand(time(NULL));
for (pos_y=10;pos_y<380;pos_y=pos_y+90){
2022-11-28 13:42:06 +01:00
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);
}
2022-11-28 13:42:06 +01:00
}*/
2022-11-28 13:42:06 +01:00
//Touche();
//FermerGraphique();
return EXIT_SUCCESS;
2022-11-25 10:59:42 +01:00
}