From 71262b5094f0f4b6e238177a0c0c9c5106ad53f6 Mon Sep 17 00:00:00 2001 From: rognant Date: Thu, 21 Dec 2023 15:01:03 +0100 Subject: [PATCH] Ajout d'une fonction pour gerer le pauses --- graphique.c | 6 ++++-- snake | Bin 0 -> 21608 bytes 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 snake diff --git a/graphique.c b/graphique.c index c4aba68..0695ce5 100644 --- a/graphique.c +++ b/graphique.c @@ -4,7 +4,9 @@ #include "obstacles.h" #include void Attendre(unsigned int millisecondes) { - usleep(millisecondes * 1000); + clock_t start_time = clock(); + while ((clock() - start_time) * 1000 / CLOCKS_PER_SEC < millisecondes){ + } } void InitialiserJeu(Serpent* serpent, Pommes* pommes, Obstacles* obstacles) { serpent->longueur = 10; @@ -37,7 +39,7 @@ void Graphique() { InitialiserGraphique(); CreerFenetre(0, 0, 1240, 940); EcrireTexte(500, 400, "Le jeu va commencer !", 2); - Attendre(1000); + Attendre(2000); EffacerEcran(CouleurParComposante(0, 0, 0)); } void AffichageBasique() { diff --git a/snake b/snake new file mode 100755 index 0000000000000000000000000000000000000000..5a6ce1057a0a65e618efaec92c0a3f68e4ba2aa9 GIT binary patch literal 21608 zcmeHP3vgW3c|N<6ZSk-r{03vZxR_!BLN>zK#txF@D_w(SE3yT&H7x7Zm9-#gm3
Z(7IRzEpF0VxJnF~H7ol(%KN3lt*6?&=aY{+E23nWx}6fV;1lX`tpPr+ds2nAI< z$qo9fl=j@P3_MC@{K=SGuTAQ?;d&{rAeBLB%X_i<|4w-|Qg54#qZ^(S=9z-3yw5?8 z;__*eYUWy5Uaod1ll@ac8D4f(Q)v5&(yN;4uWSmn#M`cHTe;%O6{W?|aPe~P0{KN% zpgvW#sg8MfvlP*kzK40TaIeH6!V}5P#)raA`fsfn{h;L1Hy)qWv*D9D&tJBz;ENUi zN-|UrvPm+Oh(;fkh^Ib^_G#eXLulp%f>qWH|qVSg-#d_@lVr*g|cA)f%h+#x3jTR#oG1!KdP%IQ^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