enlevement des usleeps
This commit is contained in:
parent
f7d048b7d5
commit
f648a4726a
Binary file not shown.
@ -4,8 +4,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
extern long int attendre;
|
||||||
|
|
||||||
extern int seconde, minute, seconde_actuel, old_seconde;
|
extern int seconde, minute, seconde_actuel, old_seconde;
|
||||||
extern char timer[6];
|
extern char timer[6];
|
||||||
@ -35,5 +35,6 @@ void Score();
|
|||||||
void Collision();
|
void Collision();
|
||||||
void MenuDeFin();
|
void MenuDeFin();
|
||||||
void MenuDebut();
|
void MenuDebut();
|
||||||
|
void Attendre();
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -2,11 +2,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "fonction.h"
|
#include "fonction.h"
|
||||||
#define CYCLE 10000L
|
#define CYCLE 10000L
|
||||||
|
|
||||||
|
long int attendre=0;
|
||||||
int seconde=0, minute=0, seconde_actuel, old_seconde;
|
int seconde=0, minute=0, seconde_actuel, old_seconde;
|
||||||
char timer[6];
|
char timer[6];
|
||||||
unsigned long int suivant;
|
unsigned long int suivant;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "fonction.h"
|
#include "fonction.h"
|
||||||
|
|
||||||
void Score(){
|
void Score(){
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "fonction.h"
|
#include "fonction.h"
|
||||||
|
|
||||||
/*Input Serpent*/
|
/*Input Serpent*/
|
||||||
@ -62,7 +61,7 @@ void Serpent(){
|
|||||||
|
|
||||||
Update_Serpent();
|
Update_Serpent();
|
||||||
Terrain();
|
Terrain();
|
||||||
usleep(vitesse);
|
Attendre(vitesse);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*fonction pour mettre à jour la position du serpent*/
|
/*fonction pour mettre à jour la position du serpent*/
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include "fonction.h"
|
#include "fonction.h"
|
||||||
#define CYCLE 10000L
|
#define CYCLE 100000L
|
||||||
|
|
||||||
/*Fonction pour calculer le temps*/
|
/*Fonction pour calculer le temps*/
|
||||||
void Timer(){
|
void Timer(){
|
||||||
@ -33,3 +32,9 @@ void Update_Timer(){
|
|||||||
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
||||||
EcrireTexte(10,760,timer,2);
|
EcrireTexte(10,760,timer,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Attendre(long int microsecondes){
|
||||||
|
attendre = Microsecondes()+ microsecondes;
|
||||||
|
while (Microsecondes() < attendre){
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user