ajout du meilleure score
This commit is contained in:
parent
887caed239
commit
b57b441d63
25
gui.c
25
gui.c
@ -2,20 +2,35 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
|
|
||||||
void Menu()
|
void Menu(unsigned long *bestscore)
|
||||||
{
|
{
|
||||||
|
char buf[100];
|
||||||
|
couleur text;
|
||||||
|
text=CouleurParComposante(78, 93, 47);
|
||||||
ChoisirEcran(0);
|
ChoisirEcran(0);
|
||||||
ChargerImage("./images/Menu.png",0,0,0,0,930,710);
|
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);
|
ChoisirEcran(0);
|
||||||
ChargerImage("./images/Pause.png",0,0,0,0,930,710);
|
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);
|
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
6
gui.h
@ -1,9 +1,9 @@
|
|||||||
#ifndef GUI_H
|
#ifndef GUI_H
|
||||||
#define GUI_H
|
#define GUI_H
|
||||||
|
|
||||||
void Menu();
|
void Menu(unsigned long *bestscore);
|
||||||
void PerduGUI();
|
void PerduGUI(unsigned long *bestscore)
|
||||||
void Pause();
|
;void Pause(unsigned long *bestscore);
|
||||||
void Reinitialiser();
|
void Reinitialiser();
|
||||||
int AfficherGUI(unsigned char menu);
|
int AfficherGUI(unsigned char menu);
|
||||||
|
|
||||||
|
12
main.c
12
main.c
@ -14,6 +14,7 @@ int main()
|
|||||||
{
|
{
|
||||||
unsigned char pause = 0;
|
unsigned char pause = 0;
|
||||||
unsigned long score = 0;
|
unsigned long score = 0;
|
||||||
|
unsigned long bestscore = 0;
|
||||||
unsigned long suivant;
|
unsigned long suivant;
|
||||||
unsigned long suivant2;
|
unsigned long suivant2;
|
||||||
int game_on=0;
|
int game_on=0;
|
||||||
@ -48,8 +49,11 @@ int main()
|
|||||||
while(window_on)
|
while(window_on)
|
||||||
{
|
{
|
||||||
if(perdu == 1)
|
if(perdu == 1)
|
||||||
{
|
{ if(score>bestscore)
|
||||||
PerduGUI();
|
{
|
||||||
|
bestscore=score;
|
||||||
|
}
|
||||||
|
PerduGUI(&bestscore);
|
||||||
if (ToucheEnAttente() == 1)
|
if (ToucheEnAttente() == 1)
|
||||||
{
|
{
|
||||||
switch (Touche())
|
switch (Touche())
|
||||||
@ -62,7 +66,7 @@ int main()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Menu();
|
Menu(&bestscore);
|
||||||
if (ToucheEnAttente() == 1)
|
if (ToucheEnAttente() == 1)
|
||||||
{
|
{
|
||||||
switch (Touche())
|
switch (Touche())
|
||||||
@ -145,7 +149,7 @@ int main()
|
|||||||
|
|
||||||
if(pause==1)
|
if(pause==1)
|
||||||
{
|
{
|
||||||
Pause();
|
Pause(&bestscore);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
prog
BIN
prog
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user