enlevement des usleeps

This commit is contained in:
Wilfried BRIGITTE 2023-12-12 15:00:17 +01:00
parent f7d048b7d5
commit f648a4726a
6 changed files with 11 additions and 8 deletions

Binary file not shown.

View File

@ -4,8 +4,8 @@
#include <stdio.h>
#include <graph.h>
#include <time.h>
#include <unistd.h>
extern long int attendre;
extern int seconde, minute, seconde_actuel, old_seconde;
extern char timer[6];
@ -35,5 +35,6 @@ void Score();
void Collision();
void MenuDeFin();
void MenuDebut();
void Attendre();
#endif

View File

@ -2,11 +2,10 @@
#include <stdio.h>
#include <graph.h>
#include <time.h>
#include <unistd.h>
#include "fonction.h"
#define CYCLE 10000L
long int attendre=0;
int seconde=0, minute=0, seconde_actuel, old_seconde;
char timer[6];
unsigned long int suivant;

View File

@ -2,7 +2,6 @@
#include <stdio.h>
#include <graph.h>
#include <time.h>
#include <unistd.h>
#include "fonction.h"
void Score(){

View File

@ -2,7 +2,6 @@
#include <stdio.h>
#include <graph.h>
#include <time.h>
#include <unistd.h>
#include "fonction.h"
/*Input Serpent*/
@ -62,7 +61,7 @@ void Serpent(){
Update_Serpent();
Terrain();
usleep(vitesse);
Attendre(vitesse);
}
/*fonction pour mettre à jour la position du serpent*/

View File

@ -2,9 +2,8 @@
#include <stdio.h>
#include <graph.h>
#include <time.h>
#include <unistd.h>
#include "fonction.h"
#define CYCLE 10000L
#define CYCLE 100000L
/*Fonction pour calculer le temps*/
void Timer(){
@ -32,4 +31,10 @@ void Update_Timer(){
RemplirRectangle(0,700,1200,800);
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
EcrireTexte(10,760,timer,2);
}
void Attendre(long int microsecondes){
attendre = Microsecondes()+ microsecondes;
while (Microsecondes() < attendre){
}
}