2023-12-01 13:32:18 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <graph.h>
|
|
|
|
#define CYCLE 10000L
|
|
|
|
|
|
|
|
int seconde=0;
|
|
|
|
int minute=0;
|
|
|
|
int seconde_actuel=0;
|
|
|
|
int old_seconde=0;
|
|
|
|
char timer[6];
|
|
|
|
unsigned long int suivant;
|
2023-12-04 17:27:48 +01:00
|
|
|
int nombre;
|
2023-12-01 13:32:18 +01:00
|
|
|
|
|
|
|
void Update_Timer(){
|
|
|
|
snprintf(timer,6,"%02d:%02d", minute, seconde);
|
|
|
|
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
2023-12-04 17:27:48 +01:00
|
|
|
RemplirRectangle(0,780,1200,800);
|
2023-12-01 13:32:18 +01:00
|
|
|
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
2023-12-04 17:27:48 +01:00
|
|
|
EcrireTexte(10,800,timer,2);
|
2023-12-01 13:32:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Timer(){
|
|
|
|
if(Microsecondes()> suivant){
|
|
|
|
suivant = Microsecondes()+CYCLE;
|
|
|
|
seconde_actuel = (suivant/1000000)%10;
|
|
|
|
if(seconde_actuel !=old_seconde){
|
|
|
|
old_seconde = seconde_actuel;
|
|
|
|
if(seconde == 59){
|
|
|
|
minute=minute+1;
|
|
|
|
seconde=0;
|
|
|
|
Update_Timer();
|
|
|
|
}else{
|
|
|
|
seconde = seconde+1;
|
|
|
|
Update_Timer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-12-04 17:27:48 +01:00
|
|
|
|