90 lines
1002 B
C
Raw Normal View History

#include <stdlib.h>
#include <stdio.h>
2023-12-10 22:51:36 +01:00
#include <graph.h>
#include "fenetre.h"
#include "plateau_init.h"
2023-12-12 17:39:55 +01:00
#include "deplacement.h"
2023-12-10 23:03:16 +01:00
2023-12-10 00:36:22 +01:00
2023-12-12 17:39:55 +01:00
#define CYCLE 1000000L
int main(void) {
2023-12-11 16:19:17 +01:00
struct adresse* pointeur = plateau_init();
2023-12-11 16:19:17 +01:00
2023-12-12 19:55:28 +01:00
int i;
2023-12-11 16:19:17 +01:00
2023-12-12 17:27:44 +01:00
2023-12-12 19:55:28 +01:00
unsigned char* sens = NULL;
2023-12-12 17:39:55 +01:00
unsigned char jeu = 1 ;
unsigned long suivant;
2023-12-12 19:55:28 +01:00
sens = malloc(sizeof(unsigned char));
2023-12-12 17:39:55 +01:00
2023-12-12 19:55:28 +01:00
*sens = 2;
2023-12-12 17:39:55 +01:00
suivant = Microsecondes() + CYCLE;
2023-12-12 17:43:07 +01:00
2023-12-11 16:19:17 +01:00
InitialiserGraphique();
2023-12-10 00:36:22 +01:00
/*initialisation de la taille de la fenetre de jeux*/
CreerFenetre(10,10,1450,840);
2023-12-07 11:16:30 +01:00
2023-12-12 17:39:55 +01:00
start(pointeur);
2023-12-12 17:39:55 +01:00
while ( jeu = 1) {
2023-12-11 16:19:17 +01:00
if (Microsecondes() > suivant) {
2023-12-12 17:39:55 +01:00
deplacement(pointeur, sens);
2023-12-11 16:19:17 +01:00
2023-12-12 17:39:55 +01:00
}
}
/* déallocations des tableaux */
for ( i = 0; i < LIGNES; i++) {
2023-12-12 19:55:28 +01:00
free(pointeur->plateau[i]);
2023-12-12 17:39:55 +01:00
}
2023-12-12 19:55:28 +01:00
free(pointeur -> plateau);
2023-12-12 17:39:55 +01:00
2023-12-12 19:55:28 +01:00
free(pointeur -> tete);
2023-12-12 17:39:55 +01:00
2023-12-12 19:55:28 +01:00
free(pointeur -> queue);
2023-12-12 17:39:55 +01:00
free(sens);
2023-12-12 19:55:28 +01:00
free(pointeur);
2023-12-10 00:36:22 +01:00
2023-12-12 17:27:44 +01:00
2023-12-10 00:36:22 +01:00
Touche();
FermerGraphique();
return EXIT_SUCCESS;
}