amélioration du temps pour passer de seconde en minute
This commit is contained in:
parent
c0bd9eca99
commit
ff14429d88
13
main.c
13
main.c
@ -16,7 +16,7 @@
|
|||||||
#define delta 100000L
|
#define delta 100000L
|
||||||
|
|
||||||
|
|
||||||
void Affichertimeretscore(int n,int score) /*Afficher le temps passé et le score*/
|
void Affichertimeretscore(int m,int n,int score) /*Afficher le temps passé et le score*/
|
||||||
{
|
{
|
||||||
char buf[100];
|
char buf[100];
|
||||||
char buff[100];
|
char buff[100];
|
||||||
@ -26,7 +26,7 @@ void Affichertimeretscore(int n,int score) /*Afficher le temps passé et le sc
|
|||||||
|
|
||||||
ChoisirEcran(1);
|
ChoisirEcran(1);
|
||||||
CopierZone(2,1,0,0,930,710,0,0);
|
CopierZone(2,1,0,0,930,710,0,0);
|
||||||
snprintf(buf,100,"temps : %05d",n);
|
snprintf(buf,100,"temps : %02d:%02d",m,n);
|
||||||
snprintf(buff,100,"SCORE : %07d",score);
|
snprintf(buff,100,"SCORE : %07d",score);
|
||||||
EcrireTexte(60,650,buf,2);
|
EcrireTexte(60,650,buf,2);
|
||||||
EcrireTexte(600,650,buff,2);
|
EcrireTexte(600,650,buff,2);
|
||||||
@ -197,6 +197,7 @@ int main()
|
|||||||
int go_on=1;
|
int go_on=1;
|
||||||
int x_pastille,y_pastille;
|
int x_pastille,y_pastille;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
int m = 0;
|
||||||
size_t longueur_serpent = 20;
|
size_t longueur_serpent = 20;
|
||||||
size_t longueur_pastilles = 10;
|
size_t longueur_pastilles = 10;
|
||||||
int *serpent = (int *)malloc(longueur_serpent * sizeof(int));
|
int *serpent = (int *)malloc(longueur_serpent * sizeof(int));
|
||||||
@ -248,8 +249,12 @@ int main()
|
|||||||
if (Microsecondes()>suivant)
|
if (Microsecondes()>suivant)
|
||||||
{
|
{
|
||||||
n++;
|
n++;
|
||||||
Affichertimeretscore(n,score);
|
if(n%60==0)
|
||||||
|
{
|
||||||
|
m++;
|
||||||
|
n=0;
|
||||||
|
}
|
||||||
|
Affichertimeretscore(m,n,score);
|
||||||
suivant=Microsecondes()+delta;
|
suivant=Microsecondes()+delta;
|
||||||
DeplacementSerpent(direction,serpent,longueur_serpent);
|
DeplacementSerpent(direction,serpent,longueur_serpent);
|
||||||
|
|
||||||
|
BIN
prog
BIN
prog
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user