ajout fichier.h et makefile
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <graph.h>
|
||||
#include "serpent.h"
|
||||
#include "pommes.h"
|
||||
#include "time.h"
|
||||
#include "../fichier.h/serpent.h"
|
||||
#include "../fichier.h/pastille.h"
|
||||
#include "../fichier.h/time.h"
|
||||
#include "../fichier.h/main.h"
|
||||
|
||||
#define CYCLE 10000L
|
||||
|
||||
@@ -25,17 +26,18 @@ int main(void) {
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(350,100,1200,900);
|
||||
EffacerEcran(CouleurParComposante(0,0,0));
|
||||
suivant = Microsecondes()+CYCLE;
|
||||
old_seconde=(suivant/1000000)%10;
|
||||
/* suivant = Microsecondes()+CYCLE;
|
||||
old_seconde=(suivant/1000000)%10;*/
|
||||
DessinerScene(murx, mury);
|
||||
InitialiserPommes(pommex, pommey, segment);
|
||||
while(go_on){
|
||||
Timer();
|
||||
/*Timer();*/
|
||||
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);
|
||||
}
|
||||
usleep(100000);
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <graph.h>
|
||||
#include <stdlib.h>
|
||||
#include "pommes.h"
|
||||
#include "../fichier.h/pastille.h"
|
||||
|
||||
void InitialiserPommes(int pommex[], int pommey[], int segment) {
|
||||
int p;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <graph.h>
|
||||
#include "serpent.h"
|
||||
#include "../fichier.h/serpent.h"
|
||||
|
||||
void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_y[]){
|
||||
int i = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@ void DessinerScene(int murx[30], int mury[30]){
|
||||
int mur;
|
||||
int i;
|
||||
int fond;
|
||||
snprintf(timer,6,"%02d:%02d", minute ,seconde);
|
||||
/* snprintf(timer,6,"%02d:%02d", minute ,seconde);*/
|
||||
ChoisirCouleurDessin(CouleurParComposante(91,222,122));
|
||||
RemplirRectangle(20,20,1160,700);
|
||||
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
||||
|
||||
@@ -2,26 +2,37 @@
|
||||
#include <unistd.h>
|
||||
#include <graph.h>
|
||||
#include "../fichier.h/time.h"
|
||||
#include "../fichier.h/main.h"
|
||||
#include "../fichier.h/serpent.h"
|
||||
#define CYCLE 10000L
|
||||
|
||||
/*time*/
|
||||
void Update_Timer(void){
|
||||
int seconde =0;
|
||||
int minute=1;
|
||||
char timer[6];
|
||||
int seconde=0;
|
||||
int minute=0;
|
||||
int seconde_actuel=0;
|
||||
int old_seconde=0;
|
||||
unsigned long int suivant;
|
||||
char timer[6];
|
||||
|
||||
void Score(int segment){
|
||||
int nombre;
|
||||
char score[4];
|
||||
nombre= (segment-10)*10;
|
||||
snprintf(score,4,"%04d0", nombre);
|
||||
ChoisirCouleurDessin(CouleurParNom("black"));
|
||||
RemplirRectangle(1100,700,1200,800);
|
||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||
EcrireTexte(1000,760,"Score: ",2);
|
||||
EcrireTexte(1100,760,score,2);
|
||||
}
|
||||
void Update_Timer(){
|
||||
snprintf(timer,6,"%02d:%02d", minute, seconde);
|
||||
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
||||
RemplirRectangle(10,700,12000,800);
|
||||
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
||||
EcrireTexte(50,760,"Temps: ",2);
|
||||
EcrireTexte(160,760,timer,2);
|
||||
EcrireTexte(50,760,"time: ",2);
|
||||
EcrireTexte(120,760,timer,2);
|
||||
}
|
||||
void Timer(void){
|
||||
int seconde = 0;
|
||||
int minute = 0;
|
||||
int seconde_actuel;
|
||||
int old_seconde;
|
||||
unsigned long int suivant;
|
||||
void Timer(){
|
||||
if(Microsecondes()> suivant){
|
||||
suivant = Microsecondes()+CYCLE;
|
||||
seconde_actuel = (suivant/1000000)%10;
|
||||
|
||||
Reference in New Issue
Block a user