ajout menu de début
This commit is contained in:
parent
ee273ed685
commit
2bbd0a3c01
BIN
JEUX_SERPENT/IMG/menu1.png
Normal file
BIN
JEUX_SERPENT/IMG/menu1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 112 KiB |
Binary file not shown.
@ -20,6 +20,7 @@ extern int fond, Nbr;
|
||||
extern char score[4];
|
||||
|
||||
extern int go_on;
|
||||
extern int imageMenu;
|
||||
|
||||
void Pomme();
|
||||
void Controle();
|
||||
@ -32,5 +33,6 @@ void DessinerScene();
|
||||
void Score();
|
||||
void Collision();
|
||||
void MenuDeFin();
|
||||
void MenuDebut();
|
||||
|
||||
#endif
|
@ -12,7 +12,7 @@ char timer[6];
|
||||
unsigned long int suivant;
|
||||
|
||||
int serpent;
|
||||
int x=500, y=500, direction=1, t, segment=10, i;
|
||||
int x=500, y=360, direction=4, t, segment=10, i=0;
|
||||
int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400];
|
||||
|
||||
int p, pp, pomme, pommex[5], pommey[5];
|
||||
@ -21,14 +21,34 @@ char score[4];
|
||||
|
||||
int go_on=1;
|
||||
int go_menu=1;
|
||||
int imageMenu;
|
||||
int go_menu2=1;
|
||||
int t2;
|
||||
int initialiser=0;
|
||||
int t3;
|
||||
|
||||
/*Fonction Principale*/
|
||||
int main(){
|
||||
/* paramétrage de la fenêtre + chargement première scène */
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(350,100,1200,800);
|
||||
|
||||
MenuDebut();
|
||||
|
||||
while(go_menu2){
|
||||
while(ToucheEnAttente()){
|
||||
t3 = Touche();
|
||||
switch(t3){
|
||||
case XK_q :
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
break;
|
||||
case XK_Right:
|
||||
go_menu2=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EffacerEcran(CouleurParComposante(0,0,0));
|
||||
suivant=Microsecondes()+CYCLE;
|
||||
old_seconde=(suivant/1000000)%10;
|
||||
|
@ -38,10 +38,20 @@ void DessinerScene(){
|
||||
}
|
||||
}
|
||||
|
||||
/*création du menu d'accueil*/
|
||||
void MenuDebut(){
|
||||
imageMenu=ChargerSprite("IMG/menu1.png");
|
||||
AfficherSprite(imageMenu,0,0);
|
||||
EcrireTexte(450,100,"JEU DU SERPENT",2);
|
||||
EcrireTexte(410,500,"Appuyer sur Q pour quitter",2);
|
||||
EcrireTexte(290,400,"Appuyer sur Fleche de Droite pour lancer le jeu",2);
|
||||
}
|
||||
|
||||
/*création du Menu de Fin*/
|
||||
void MenuDeFin(){
|
||||
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
|
||||
RemplirRectangle(0,0,1200,800);
|
||||
EffacerEcran(CouleurParComposante(0,0,0));
|
||||
imageMenu=ChargerSprite("IMG/menu1.png");
|
||||
AfficherSprite(imageMenu,0,0);
|
||||
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
||||
EcrireTexte(500,100,"Game Over", 2);
|
||||
snprintf(score,15,"Score : %04d", Nbr);
|
||||
|
@ -25,9 +25,6 @@ void Controle(){
|
||||
case XK_Escape:
|
||||
go_on=0;
|
||||
break;
|
||||
case XK_space:
|
||||
direction=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user