From 8c4945750c7d64ab034303bd059ea352896f8702 Mon Sep 17 00:00:00 2001 From: Tom Moguljak Date: Fri, 25 Nov 2022 15:57:46 +0100 Subject: [PATCH] modification fichier fin.c et ajout fichier fin.h --- include/fin.h | 6 ++++++ src/fin.c | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 include/fin.h diff --git a/include/fin.h b/include/fin.h new file mode 100644 index 0000000..f9892a3 --- /dev/null +++ b/include/fin.h @@ -0,0 +1,6 @@ +#ifndef FIN_H +#define FIN_H + +void fin(unsigned long int timer); + +#endif \ No newline at end of file diff --git a/src/fin.c b/src/fin.c index a771634..484f538 100644 --- a/src/fin.c +++ b/src/fin.c @@ -1,17 +1,28 @@ #include #include #include +#include"../include/main.h" +#include"../include/timer.h" -int main() { +void fin(unsigned long int timer) { Zone Recommencer = {375, 665, 150, 35}; Zone Quitterfin = {735, 665, 100, 35}; ChargerImage("./../img/backgrounds/peeposhy.png", 225, 100, 0, 0, 800, 550); - ChoisirCouleurDessin("black"); + ChoisirCouleurDessin(CouleurParNom("black")); EcrireTexte(550, 150, "You Win !", 2); - snprintf(buf, 100, "Votre temps : %02d:%02d", minute, seconde); + + char buf[100]; + timer = stop_timer(timer); + unsigned int secondes = timer / DELTA; + unsigned int minutes = 0; + while (secondes >= 60) { + minutes += 1; + secondes -= 60; + } + snprintf(buf, 100, "Votre temps : %02d:%02d", minutes, secondes); EcrireTexte(530, 200, buf, 1); dessinerbouton(Recommencer, "Recommencer", CouleurParNom("black"), CouleurParNom("dark green"), CouleurParNom("dark green"), 1); @@ -20,10 +31,10 @@ int main() { SourisPosition(); - if(SourisCliquee()){ + if(SourisCliquee()) { if(checkzone(Quitterfin, _X, _Y)) - boucle = 0; + Touche(); } } \ No newline at end of file