mise à jour

This commit is contained in:
Yann KERAUDREN 2023-12-10 22:51:36 +01:00
parent 81aa9fae9b
commit eaea71caa3
5 changed files with 47 additions and 19 deletions

@ -8,6 +8,7 @@ but : run
OFILES = plateau_init.o \
fenetre.o \
time.o \
main.o
CC = gcc
@ -20,7 +21,10 @@ plateau_init.o : 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 ###

@ -72,7 +72,7 @@ int** deplacement(int* p, int timer) {
if (TouchEnAttente() == 1) {
if (Touche() == "XK_Left") {
if (Touche() == XK_Left) {
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;
@ -96,7 +96,7 @@ int** deplacement(int* p, int timer) {
}
if (Touch() == "XK_Up") {
if (Touch() == XK_Up") {
p[tete[0]][tete[1]] = 0;

@ -1,8 +1,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <graph.h>
#include "fenetre.h"
#include "plateau_init.h"
#include <graph.h>
#include "time.h"
@ -18,9 +19,6 @@ int main(void) {
start();
Touche();

@ -11,15 +11,21 @@ int main(void) {
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;
printf("%d : %d\n", minutes, secondes);
/*printf("%d : %d\n", &time[0],&time[1]);*/
while (1) {
if (Microsecondes() > suivant) {
if (Microsecondes() > suivant) {
@ -28,17 +34,16 @@ int main(void) {
suivant = Microsecondes()+CYCLE;
secondes++;
/*time[1]++;
if ( secondes == 60) {
if ( time[1] == 60) {
secondes = 0;
time[1] = 0;
minutes ++;
time[0] ++;
}
printf("%d : %d\n", minutes,secondes);
}*/
printf("%lu", Microsecondes());
@ -47,8 +52,19 @@ int main(void) {
}
/* if ( ToucheEnAttente() == 1 ) {
if (Touche() == XK_space) {
break;
}
}*/
}
}
return EXIT_SUCCESS;
}

10
snake/time.h Normal file

@ -0,0 +1,10 @@
#ifndef TIME_H
#define TIME_H
void time(void);
#endif /* TIME_H */