ajout du meilleure score

This commit is contained in:
David AKAGUNDUZ 2023-12-22 17:23:26 +01:00
parent 887caed239
commit b57b441d63
4 changed files with 31 additions and 12 deletions

25
gui.c

@ -2,20 +2,35 @@
#include <stdio.h>
#include <graph.h>
void Menu()
void Menu(unsigned long *bestscore)
{
char buf[100];
couleur text;
text=CouleurParComposante(78, 93, 47);
ChoisirEcran(0);
ChargerImage("./images/Menu.png",0,0,0,0,930,710);
ChoisirCouleurDessin(text);
snprintf(buf,100,"BEST SCORE : %07ld",*bestscore);
EcrireTexte(450,470,buf,2);
}
void Pause()
{
void Pause(unsigned long *bestscore)
{
char buf[100];
couleur text;
text=CouleurParComposante(78, 93, 47);
ChoisirEcran(0);
ChargerImage("./images/Pause.png",0,0,0,0,930,710);
ChoisirCouleurDessin(text);
snprintf(buf,100,"BEST SCORE : %07ld",*bestscore);
EcrireTexte(450,300,buf,2);
}
void PerduGUI()
void PerduGUI(unsigned long *bestscore)
{
char buf[100];
ChoisirEcran(0);
ChargerImage("./images/Perdu.png",0,0,0,0,930,710);
ChargerImage("./images/Perdu.png",0,0,0,0,930,710);
snprintf(buf,100,"SCORE : %07ld",*bestscore);
EcrireTexte(450,250,buf,2);
}

6
gui.h

@ -1,9 +1,9 @@
#ifndef GUI_H
#define GUI_H
void Menu();
void PerduGUI();
void Pause();
void Menu(unsigned long *bestscore);
void PerduGUI(unsigned long *bestscore)
;void Pause(unsigned long *bestscore);
void Reinitialiser();
int AfficherGUI(unsigned char menu);

12
main.c

@ -14,6 +14,7 @@ int main()
{
unsigned char pause = 0;
unsigned long score = 0;
unsigned long bestscore = 0;
unsigned long suivant;
unsigned long suivant2;
int game_on=0;
@ -48,8 +49,11 @@ int main()
while(window_on)
{
if(perdu == 1)
{
PerduGUI();
{ if(score>bestscore)
{
bestscore=score;
}
PerduGUI(&bestscore);
if (ToucheEnAttente() == 1)
{
switch (Touche())
@ -62,7 +66,7 @@ int main()
}
else
{
Menu();
Menu(&bestscore);
if (ToucheEnAttente() == 1)
{
switch (Touche())
@ -145,7 +149,7 @@ int main()
if(pause==1)
{
Pause();
Pause(&bestscore);
}
}

BIN
prog

Binary file not shown.