2023-12-04 17:01:52 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <graph.h>
|
2023-12-07 14:02:18 +01:00
|
|
|
#include "fonction.h"
|
2023-12-12 15:00:17 +01:00
|
|
|
#define CYCLE 100000L
|
2023-12-04 17:01:52 +01:00
|
|
|
|
|
|
|
/*Fonction pour calculer le temps*/
|
2023-12-07 14:02:18 +01:00
|
|
|
void Timer(){
|
2023-12-04 17:01:52 +01:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*Fonction pour mettre à jour unuquement le timer*/
|
|
|
|
void Update_Timer(){
|
|
|
|
snprintf(timer,6,"%02d:%02d", minute, seconde);
|
|
|
|
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
2023-12-10 13:11:43 +01:00
|
|
|
RemplirRectangle(0,700,1200,800);
|
2023-12-04 17:01:52 +01:00
|
|
|
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
|
|
|
EcrireTexte(10,760,timer,2);
|
2023-12-12 15:00:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Attendre(long int microsecondes){
|
2023-12-18 13:36:17 +01:00
|
|
|
long int attendre;
|
2023-12-12 15:00:17 +01:00
|
|
|
attendre = Microsecondes()+ microsecondes;
|
|
|
|
while (Microsecondes() < attendre){
|
|
|
|
}
|
2023-12-04 17:01:52 +01:00
|
|
|
}
|