diff --git a/snake/ajout_score.c b/snake/ajout_score.c index 6af29e4..6fd2d16 100644 --- a/snake/ajout_score.c +++ b/snake/ajout_score.c @@ -3,13 +3,92 @@ #include <stdlib.h> #include <graph.h> +#include <stdio.h> -void ajout_scorescore (unsigned int compteur) { +/*int main(unsigned int compteur) { compteur = compteur + 5; char* a= (int) compteur; EcrireTexte(1250, 600, a, 2); +}*/ + + + + +/* +int main() { + int compteur = 10; + + compteur = compteur + 5; + + + char a[20]; + sprintf(a, "%d", compteur); + + + EcrireTexte(1250, 600, a, 2); + + return 0; +} +*/ + + + +void ajout_score(int* compteur) { + + + char a[20]; + + + *compteur = *compteur + 5; + + sprintf(a, "%d", *compteur); + + InitialiserGraphique(); + CreerFenetre(10,10,1450,840); + + EcrireTexte(1250, 600, a, 2); + + Touche(); + FermerGraphique(); +} + +int main(void) { + + int *compteur = NULL; + compteur = malloc(sizeof(int)); + *compteur = 0; + ajout_score(compteur); + free(compteur); + + return EXIT_SUCCESS; + +} + +/* +int main() { + int compteur = 0; + char key; + + printf("Appuyez sur ESPACE pour ajouter 5 (Appuyez sur 'q' pour quitter)\n"); + + while (1) { + key = getchar(); + if (key == ' ') { + compteur += 5; + printf("Compteur : %d\n", compteur); + } else if (key == 'q' || key == 'Q') { + printf("Sortie du programme.\n"); + break; + } + } + + return 0; } +*/ + + +