From 37df62e7bd2adbb320749b183fa92e609e139d85 Mon Sep 17 00:00:00 2001 From: Mathias Fourreaux <mathias.fourreaux6@etu.univ-lorraine.fr> Date: Sun, 16 Dec 2018 15:28:11 +0100 Subject: [PATCH] score --- main.c | 12 ++++++++++++ tab_des_scores.txt | 1 + 2 files changed, 13 insertions(+) create mode 100644 tab_des_scores.txt diff --git a/main.c b/main.c index c10a478..8d6825c 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,9 @@ int main(int argc, char *argv[]) Mix_Chunk *sons[3]; TTF_Font *police; + FILE* fichier = NULL; + fichier = fopen("tab_des_scores.txt", "r+"); + @@ -236,6 +239,15 @@ int main(int argc, char *argv[]) } if(joueur_ptr->vie <= 0){ + + int caractereActuel; + while (caractereActuel != EOF){ + caractereActuel = fgetc(fichier); + } + char score[11]; + sprintf(score, "Score : %d \n", nbTues); + fputs(score, fichier); + fclose(fichier); gameover = true; } diff --git a/tab_des_scores.txt b/tab_des_scores.txt new file mode 100644 index 0000000..2f73a47 --- /dev/null +++ b/tab_des_scores.txt @@ -0,0 +1 @@ +Score : 0 -- GitLab