This commit is contained in:
2023-12-12 17:43:07 +01:00
6 changed files with 54 additions and 20 deletions

View File

@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <graph.h>
#include <stdio.h>
#include "ajout_score.h"
/*int main(unsigned int compteur) {
@@ -44,25 +45,12 @@ void ajout_score(int* compteur) {
sprintf(a, "%d", *compteur);
InitialiserGraphique();
CreerFenetre(10,10,1450,840);
RemplirRectangle( 1241, 600, 195, 80);
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;
}
/*

15
snake/ajout_score.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef AJOUT_SCORE_H
#define AJOUT_SCORE_H
void ajout_score(int* compteur);
#endif /* AJOUT_SCORE_H */

View File

@@ -28,9 +28,6 @@ int start (struct adresse* pointeur) {
int score=0;
/* remplisage du fond d'écran */
grey = CouleurParComposante(35,35,35);

View File

@@ -15,6 +15,7 @@ int main(void) {
struct adresse* pointeur = plateau_init();
char* sens = NULL;
@@ -31,7 +32,7 @@ int main(void) {
InitialiserGraphique();
/*initialisation de la taille de la fenetre de jeux*/
@@ -76,6 +77,10 @@ int main(void) {
free(tableau);
Touche();
FermerGraphique();

20
snake/score_init.c Normal file
View File

@@ -0,0 +1,20 @@
#include <stdlib.h>
#include <graph.h>
#include <stdio.h>
#include "score_init.h"
void score_init(int* compteur) {
int *compteur = NULL;
compteur = malloc(sizeof(int));
*compteur = 0;
free(compteur);
}

9
snake/score_init.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef SCORE_INIT_H
#define SCORE_INIT_H
void score_init (int* compteur);
#endif /* SCORE_INIT_H */