Ajout d'une fonction pour gerer le pauses

This commit is contained in:
Thomas ROGNANT 2023-12-21 15:01:03 +01:00
parent f7ecb4d475
commit 71262b5094
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,9 @@
#include "obstacles.h"
#include <time.h>
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() {

BIN
snake Executable file

Binary file not shown.