2023-12-14 15:00:02 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2023-12-19 14:52:23 +01:00
|
|
|
#include <graph.h>
|
|
|
|
#include "serpent.h"
|
|
|
|
#include "pommes.h"
|
|
|
|
#include "time.h"
|
2023-12-01 13:32:18 +01:00
|
|
|
|
2023-12-19 14:52:23 +01:00
|
|
|
#define CYCLE 10000L
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
int segment = 10;
|
|
|
|
int go_on = 1;
|
|
|
|
int direction = 4;
|
|
|
|
int pos_x[60];
|
|
|
|
int pos_y[60];
|
|
|
|
int old_x[60];
|
|
|
|
int old_y[60];
|
|
|
|
int pommex[5];
|
|
|
|
int pommey[5];
|
|
|
|
int murx[30];
|
|
|
|
int mury[30];
|
|
|
|
int *pointeur_segment = &segment;
|
|
|
|
int *pointeur_go_on = &go_on;
|
|
|
|
int *pointeur_direction = &direction;
|
2023-12-14 15:00:02 +01:00
|
|
|
InitialiserGraphique();
|
|
|
|
CreerFenetre(350,100,1200,900);
|
|
|
|
EffacerEcran(CouleurParComposante(0,0,0));
|
|
|
|
suivant = Microsecondes()+CYCLE;
|
|
|
|
old_seconde=(suivant/1000000)%10;
|
2023-12-19 14:52:23 +01:00
|
|
|
DessinerScene(murx, mury);
|
|
|
|
InitialiserPommes(pommex, pommey, segment);
|
|
|
|
while(go_on){
|
2023-12-14 15:00:02 +01:00
|
|
|
Timer();
|
2023-12-19 14:52:23 +01:00
|
|
|
Score(*pointeur_segment);
|
|
|
|
Controle(pointeur_direction, 0, pointeur_go_on);
|
|
|
|
Serpent(pos_x, pos_y, old_x, old_y, pointeur_segment, murx, mury, pointeur_go_on, pointeur_direction);
|
|
|
|
Pomme(pos_x, pos_y, pommex, pommey, pointeur_segment);
|
2023-12-14 15:00:02 +01:00
|
|
|
}
|
|
|
|
FermerGraphique();
|
2023-12-19 14:52:23 +01:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|