ajout des variables dans jeu.c + modif makefile
This commit is contained in:
parent
e6a058de5d
commit
ccab398cdc
4
Makefile
4
Makefile
@ -3,11 +3,11 @@ CFLAGS= -Wall -c -lgraph
|
||||
LDFLAGS= -Wall -lgraph
|
||||
EXEC=menu
|
||||
|
||||
jeu: main.o images.o menu.o temps.o
|
||||
jeu: main.o images.o menu.o temps.o jeu.o
|
||||
$(CC) -o jeu main.o images.o menu.o temps.o $(LDFLAGS)
|
||||
main.o: main.c images.h menu.h main.h
|
||||
$(CC) main.c $(CFLAGS)
|
||||
images.o: images.c images.h jeu.h
|
||||
images.o: images.c images.h
|
||||
$(CC) images.c $(CFLAGS)
|
||||
menu.o: menu.c menu.h
|
||||
$(CC) menu.c $(CFLAGS)
|
||||
|
7
images.c
7
images.c
@ -10,12 +10,11 @@ int tirage_aleatoire(void){
|
||||
InitialiserGraphique();
|
||||
char tirage[50], affichage[50];
|
||||
int pos_x, pos_y, clic_x, clic_y, im_y, im_x;
|
||||
int i, j, g;
|
||||
int nb, score=0;
|
||||
int i, j;
|
||||
int nb;
|
||||
int tab[40];
|
||||
int nb_paires=20;
|
||||
int positions[20][4];
|
||||
int repet;
|
||||
char* comparer[2];
|
||||
|
||||
ChargerImage("Images/background.png",0,0,0,0,1024,576);
|
||||
@ -32,7 +31,7 @@ int tirage_aleatoire(void){
|
||||
|
||||
/*Tirage des images*/
|
||||
srand(time(NULL));
|
||||
for (i=0;i<2;i++){
|
||||
for (i=0;i<2;i++){
|
||||
for (j=0;j<nb_paires;j++){
|
||||
nb=rand()%(nb_paires*2);
|
||||
if (tab[nb]!=-1){
|
||||
|
7
jeu.c
7
jeu.c
@ -8,9 +8,13 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int jeu(void){
|
||||
int temps;
|
||||
int temps,score,repet;
|
||||
int i,j,g;
|
||||
int clic_x,clic_y,im_y,im_x;
|
||||
char tempstab[50];
|
||||
while(score<20){
|
||||
temps=timer();
|
||||
snprintf(tempstab,50,"%d secondes écoulées",temps);
|
||||
for (repet=0;repet<3;repet++){
|
||||
if (SourisCliquee()){
|
||||
clic_x=_X;
|
||||
@ -53,4 +57,5 @@ int jeu(void){
|
||||
}
|
||||
}
|
||||
}
|
||||
return score;
|
||||
}
|
Loading…
Reference in New Issue
Block a user