From f648a4726a6ff9732acec32ced02cca367c91571 Mon Sep 17 00:00:00 2001 From: brigitte Date: Tue, 12 Dec 2023 15:00:17 +0100 Subject: [PATCH] enlevement des usleeps --- JEUX_SERPENT/Jeux | Bin 22120 -> 22136 bytes JEUX_SERPENT/fonction.h | 3 ++- JEUX_SERPENT/main.c | 3 +-- JEUX_SERPENT/score.c | 1 - JEUX_SERPENT/serpent.c | 3 +-- JEUX_SERPENT/timer.c | 9 +++++++-- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/JEUX_SERPENT/Jeux b/JEUX_SERPENT/Jeux index a13105dfbd036740852e6c786cf184f0dd7149b3..69f9f7ddbde1de62e154ea5069188e5aa5a1d119 100755 GIT binary patch delta 5948 zcmZu#4OCRs7CvX-zziZVz%YYgGhi;Tm;72r@~_f}R)Ard@4ZAVv-eXN)RWTD$YQ)| z*vTIBvqWf3BUW zN8)~|fgdmUH$?MytcfO;&p)+}zU~MNAhp?*?)tnh^PuVW{;y`FTgh7sxN7SI$Uk3I z)dOrhcSUELEWh!}=YL6{hC#YF826$;)G$l=JGC@$?$LA;#(X@-R+t0%U!lx^{$* zoy#5O^|hxT+E1_to&*JgVYaMAkH{z^ziVPheKyarf5o)HRjK&L(s;|cSzX6a91 z_45R{Y^1{e0nNNtSY1<=0p(GBO6kkC2>^w)fGqO%dAp$WI}@;C-R-ap@J*}(liTal zLiv!dh)tmV{N-4O=jmTmb*~Dfb`%{b{4*g`Ap5t0?QLAq;2=df=xz@{zXSJ!e<@hO zkSZqf`9FuQmqj6M4I3lDUI9M(i2xHMxLbg~9YWB<;v~93pyve2VkEdqfc+X6CBa$& z`ZO>?f^!A9R|CT&I9-7M(m=BWZxmpY26{pynk3Mt0rj!+Nsu2rXU>99Y@gkX#VrKz zFFoHX%m-cCrLYtLya%C72Yyyng}J2Nwnfmb(4~jmP3|?ZE72DeB?1S8n-tq6!Ker6 zPMiOUdrkOyjbZ!STwnxS74~0b*bX8CJcR2WZsl|1Vv}#$CRrN zl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GRamI>PNg?zG)L*zIt^jA+HngF zJWe~H0v%I<9;ULGk8Dzf3Ytj=Coc1N5X6q%tU^y!H@;4V-bT2kJFP~i>usfk+%yy?ZQQ+&Eswx(&&>@x;+B$w%HeVd~ zigkq^YjuAkQMEW!xQ4A3MbkZT8a|BWrP^z(cK!4W#%jcg86K;7(p3uE%rVw8>dx;M k1v4kI{i15-M5~r%xI4uOD4e;*s7@r^HwLfGg8K&l7aTMHyZ`_I diff --git a/JEUX_SERPENT/fonction.h b/JEUX_SERPENT/fonction.h index be41090..eff296e 100644 --- a/JEUX_SERPENT/fonction.h +++ b/JEUX_SERPENT/fonction.h @@ -4,8 +4,8 @@ #include #include #include -#include +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 \ No newline at end of file diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index 7d304a1..96ff829 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -2,11 +2,10 @@ #include #include #include -#include #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; diff --git a/JEUX_SERPENT/score.c b/JEUX_SERPENT/score.c index 944c7a5..bf84718 100644 --- a/JEUX_SERPENT/score.c +++ b/JEUX_SERPENT/score.c @@ -2,7 +2,6 @@ #include #include #include -#include #include "fonction.h" void Score(){ diff --git a/JEUX_SERPENT/serpent.c b/JEUX_SERPENT/serpent.c index 37b0ecd..eda18e6 100644 --- a/JEUX_SERPENT/serpent.c +++ b/JEUX_SERPENT/serpent.c @@ -2,7 +2,6 @@ #include #include #include -#include #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*/ diff --git a/JEUX_SERPENT/timer.c b/JEUX_SERPENT/timer.c index 73e288a..113c623 100644 --- a/JEUX_SERPENT/timer.c +++ b/JEUX_SERPENT/timer.c @@ -2,9 +2,8 @@ #include #include #include -#include #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){ + } } \ No newline at end of file