From 83adc1cadf0c44f2def4600b2c91b339dfedb7af Mon Sep 17 00:00:00 2001 From: Tom Moguljak Date: Thu, 8 Dec 2022 09:22:06 +0100 Subject: [PATCH] =?UTF-8?q?Int=C3=A9gration=20du=20compteur=20de=20coups?= =?UTF-8?q?=20dans=20fin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/fin.h | 2 +- src/fin.c | 5 ++++- src/game.c | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/fin.h b/include/fin.h index a99ff70..7eb612a 100644 --- a/include/fin.h +++ b/include/fin.h @@ -1,6 +1,6 @@ #ifndef FIN_H #define FIN_H -int fin(unsigned long int timer); +int fin(unsigned long int timer, int coups); #endif diff --git a/src/fin.c b/src/fin.c index 82a41e7..7b0c67c 100644 --- a/src/fin.c +++ b/src/fin.c @@ -4,7 +4,7 @@ #include"../include/main.h" #include"../include/timer.h" -int fin(unsigned long int timer) { +int fin(unsigned long int timer, int coups) { zone recommencer = {375, 665, 150, 35}; zone quitter_fin = {735, 665, 100, 35}; @@ -23,6 +23,9 @@ int fin(unsigned long int timer) { snprintf(buf, 100, "Votre temps : %02d:%02d", minutes, secondes); EcrireTexte(530, 200, buf, 1); + snprintf(buf, 100, "Votre nombre de coups : %d", coups); + EcrireTexte(495, 250, buf, 1); + dessiner_bouton(recommencer, "Recommencer", CouleurParNom("black"), CouleurParNom("dark green"), CouleurParNom("dark green"), 1); dessiner_bouton(quitter_fin, "QUITTER", CouleurParNom("red"), CouleurParNom("red"), CouleurParNom("white"), 1); diff --git a/src/game.c b/src/game.c index 7768486..8739f88 100644 --- a/src/game.c +++ b/src/game.c @@ -23,7 +23,7 @@ int update_coups(int coups) { CopierZone(3, 0, 170, 0, 150, 30, 170, 0); ChoisirEcran(0); - return coups+1; + return coups; } int game(int colonnes, int lignes) { @@ -122,7 +122,7 @@ int game(int colonnes, int lignes) { for (c = 0; c < colonnes; c++) { if (check_zone(cards[l][c].zone, _X, _Y)) { cards[l][c] = show_card(cards[l][c]); - coups = update_coups(coups); + coups = update_coups(coups+1); } } } @@ -153,5 +153,5 @@ int game(int colonnes, int lignes) { } } - return fin(stop_timer(timer)); + return fin(stop_timer(timer), coups); } \ No newline at end of file