mise à jour
This commit is contained in:
@@ -8,6 +8,7 @@ but : run
|
|||||||
|
|
||||||
OFILES = plateau_init.o \
|
OFILES = plateau_init.o \
|
||||||
fenetre.o \
|
fenetre.o \
|
||||||
|
time.o \
|
||||||
main.o
|
main.o
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
@@ -20,7 +21,10 @@ plateau_init.o : plateau_init.h
|
|||||||
|
|
||||||
fenetre.o : fenetre.h plateau_init.h
|
fenetre.o : fenetre.h plateau_init.h
|
||||||
|
|
||||||
main.o : main.c fenetre.h
|
time.o : time.h
|
||||||
|
|
||||||
|
main.o : main.c fenetre.h time.h
|
||||||
|
|
||||||
|
|
||||||
### COMMANDES ###
|
### COMMANDES ###
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ int** deplacement(int* p, int timer) {
|
|||||||
|
|
||||||
if (TouchEnAttente() == 1) {
|
if (TouchEnAttente() == 1) {
|
||||||
|
|
||||||
if (Touche() == "XK_Left") {
|
if (Touche() == XK_Left) {
|
||||||
|
|
||||||
p[tete[0]][tete[1]] = 0;
|
p[tete[0]][tete[1]] = 0;
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ int** deplacement(int* p, int timer) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Touch() == "XK_Right") {
|
if (Touch() == XK_Right) {
|
||||||
|
|
||||||
p[tete[0]][tete[1]] = 0;
|
p[tete[0]][tete[1]] = 0;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ int** deplacement(int* p, int timer) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Touch() == "XK_Up") {
|
if (Touch() == XK_Up") {
|
||||||
|
|
||||||
p[tete[0]][tete[1]] = 0;
|
p[tete[0]][tete[1]] = 0;
|
||||||
|
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <graph.h>
|
||||||
#include "fenetre.h"
|
#include "fenetre.h"
|
||||||
#include "plateau_init.h"
|
#include "plateau_init.h"
|
||||||
#include <graph.h>
|
#include "time.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -20,9 +21,6 @@ int main(void) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Touche();
|
Touche();
|
||||||
FermerGraphique();
|
FermerGraphique();
|
||||||
|
|
||||||
|
34
snake/time.c
34
snake/time.c
@@ -11,11 +11,17 @@ int main(void) {
|
|||||||
|
|
||||||
unsigned long suivant;
|
unsigned long suivant;
|
||||||
|
|
||||||
unsigned int secondes = 0, minutes = 0;
|
/* int* time = NULL; */
|
||||||
|
|
||||||
|
/* time = malloc( sizeof(short int));
|
||||||
|
|
||||||
|
time[0] = 0;
|
||||||
|
time[1] = 0; */
|
||||||
|
|
||||||
|
|
||||||
suivant = Microsecondes() + CYCLE;
|
suivant = Microsecondes() + CYCLE;
|
||||||
|
|
||||||
printf("%d : %d\n", minutes, secondes);
|
/*printf("%d : %d\n", &time[0],&time[1]);*/
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
@@ -28,17 +34,16 @@ int main(void) {
|
|||||||
|
|
||||||
suivant = Microsecondes()+CYCLE;
|
suivant = Microsecondes()+CYCLE;
|
||||||
|
|
||||||
secondes++;
|
/*time[1]++;
|
||||||
|
|
||||||
if ( secondes == 60) {
|
if ( time[1] == 60) {
|
||||||
|
|
||||||
secondes = 0;
|
time[1] = 0;
|
||||||
|
|
||||||
minutes ++;
|
time[0] ++;
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
printf("%lu", Microsecondes());
|
||||||
printf("%d : %d\n", minutes,secondes);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +53,18 @@ int main(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if ( ToucheEnAttente() == 1 ) {
|
||||||
|
|
||||||
|
if (Touche() == XK_space) {
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
10
snake/time.h
Normal file
10
snake/time.h
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef TIME_H
|
||||||
|
#define TIME_H
|
||||||
|
|
||||||
|
void time(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* TIME_H */
|
Reference in New Issue
Block a user