on tente des trucs
This commit is contained in:
parent
ccab398cdc
commit
850d86b456
4
Makefile
4
Makefile
@ -7,12 +7,12 @@ 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
|
||||
images.o: images.c images.h jeu.h
|
||||
$(CC) images.c $(CFLAGS)
|
||||
menu.o: menu.c menu.h
|
||||
$(CC) menu.c $(CFLAGS)
|
||||
temps.o: temps.c temps.h
|
||||
$(CC) temps.c $(CFLAGS)
|
||||
jeu.o: jeu.c jeu.h
|
||||
jeu.o: jeu.c jeu.h images.h
|
||||
$(CC) jeu.c $(CFLAGS)
|
||||
run:./jeu
|
10
images.c
10
images.c
@ -8,14 +8,13 @@
|
||||
|
||||
int tirage_aleatoire(void){
|
||||
InitialiserGraphique();
|
||||
char tirage[50], affichage[50];
|
||||
char tirage[50];
|
||||
int pos_x, pos_y, clic_x, clic_y, im_y, im_x;
|
||||
int i, j;
|
||||
int nb;
|
||||
int nb,score;
|
||||
int tab[40];
|
||||
int nb_paires=20;
|
||||
int positions[20][4];
|
||||
char* comparer[2];
|
||||
|
||||
ChargerImage("Images/background.png",0,0,0,0,1024,576);
|
||||
|
||||
@ -82,12 +81,9 @@ int tirage_aleatoire(void){
|
||||
}
|
||||
printf("\n");
|
||||
}*/
|
||||
jeu();
|
||||
score=jeu(positions);
|
||||
Touche();
|
||||
FermerGraphique();
|
||||
printf("\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
20
jeu.c
20
jeu.c
@ -3,18 +3,22 @@
|
||||
#include <graph.h>
|
||||
#include <time.h>
|
||||
#include "images.h"
|
||||
#include "temps.h"
|
||||
#include "jeu.h"
|
||||
#include <unistd.h>
|
||||
|
||||
int jeu(void){
|
||||
int temps,score,repet;
|
||||
int jeu(int position[20][4]){
|
||||
int score,repet;
|
||||
int pos_x,pos_y;
|
||||
int i,j,g;
|
||||
int clic_x,clic_y,im_y,im_x;
|
||||
char tempstab[50];
|
||||
unsigned long temps, temps2;
|
||||
char tempstab[50],affichage[50];;
|
||||
char* comparer[2];
|
||||
temps2=Microsecondes();
|
||||
while(score<20){
|
||||
temps=timer();
|
||||
snprintf(tempstab,50,"%d secondes écoulées",temps);
|
||||
temps=(Microsecondes()-temps2)/1000000;
|
||||
snprintf(tempstab,50,"%ld secondes écoulées",temps);
|
||||
EcrireTexte(500,100,tempstab,1);
|
||||
for (repet=0;repet<3;repet++){
|
||||
if (SourisCliquee()){
|
||||
clic_x=_X;
|
||||
@ -43,8 +47,8 @@ int jeu(void){
|
||||
if (im_x!=0 && im_y!=0){
|
||||
for (i=0;i<20;i++){
|
||||
for (j=0;j<2;j++){
|
||||
if (positions[i][(j*2)]==im_x){
|
||||
if (positions[i][(j*2+1)]==im_y){
|
||||
if (position[i][(j*2)]==im_x){
|
||||
if (position[i][(j*2+1)]==im_y){
|
||||
g=i+1;
|
||||
snprintf(affichage,50,"Images/image%d.png",g);
|
||||
comparer[repet]=affichage;
|
||||
|
2
jeu.h
2
jeu.h
@ -1,6 +1,6 @@
|
||||
#ifndef JEU_H
|
||||
#define JEU_H
|
||||
|
||||
int jeu(void);
|
||||
int jeu(int positions[20][4]);
|
||||
|
||||
#endif
|
11
main.c
11
main.c
@ -4,7 +4,6 @@
|
||||
#include "images.h"
|
||||
#include "menu.h"
|
||||
#include "main.h"
|
||||
#include "temps.h"
|
||||
/*faire les includes des autres parties du programme*/
|
||||
|
||||
|
||||
@ -12,15 +11,7 @@ int main(void){
|
||||
int temps,coucou;
|
||||
int test=menu();
|
||||
char tableautemps[50];
|
||||
while(1){
|
||||
coucou=tirage_aleatoire();
|
||||
while(tirage_aleatoire()!=1){
|
||||
temps=timer();
|
||||
printf("%d",temps);
|
||||
snprintf(tableautemps,50,"%d secondes écoulées",temps);
|
||||
EcrireTexte(500,100,tableautemps,1);
|
||||
}
|
||||
}
|
||||
tirage_aleatoire();
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user