Skip to content
Snippets Groups Projects
Commit aec5ec28 authored by Montjoie Henri's avatar Montjoie Henri
Browse files

ajout du menu

parent 130127f1
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -360,8 +360,7 @@ int affichage_menu_configuration()
police=TTF_OpenFont("../resources/fonts/arial.ttf",26);
char src[50], dest[50];
char buffer[2];
char src[2], dest[20];
for(i=0; i<NB_PERSO; i++)
{
strcpy(dest, "personnage ");
......@@ -634,7 +633,8 @@ int affichage_carte()
Position_Case[j][i].y=j*HAUTEUR_CASE+(HAUTEUR_CASE/2);
}
}
while(etat!=FERMER&&etat!=VICTOIRE)
Position_Case_brillante=Position_Case[0][0];
while(etat!=FERMER)
{
SDL_WaitEvent(&event);
switch(event.type) /* Test du type d'vnement */
......@@ -658,8 +658,7 @@ int affichage_carte()
//persosuivant();
break;
case SDLK_ESCAPE:
//afficher_menu();
etat=FERMER;
afficher_menu();
break;
default:
break;
......@@ -703,7 +702,7 @@ int affichage_carte()
int afficher_menu()
{
SDL_Event event;
SDL_Surface* ecran = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_Surface* fenetre = SDL_SetVideoMode(LARGEUR_CARTE*(LARGEUR_CASE+1), HAUTEUR_CARTE*(HAUTEUR_CASE+2), 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
SDL_Surface* bouton_continuer=NULL;
SDL_Surface* bouton_quitter=NULL;
SDL_Rect pos_bouton_continuer;
......@@ -726,21 +725,23 @@ int afficher_menu()
printf("Unable to load bitmap: %s\n", SDL_GetError());
return 1;
}
while(etat!=FERMER)
{
SDL_WaitEvent(&event);
switch(event.type) /* Test du type d'vnement */
{
case SDL_QUIT: /* Si c'est un vnement de type "Quitter" */
etat=FERMER;
return 0;
break;
case SDL_MOUSEBUTTONDOWN:
if(pos_bouton_continuer.x<event.button.x&&event.button.x<pos_bouton_continuer.x+LARGEUR_BOUTON)
{
if(pos_bouton_continuer.y<event.button.y&&event.button.y<pos_bouton_continuer.x+HAUTEUR_BOUTON)
if(pos_bouton_continuer.y<event.button.y&&event.button.y<pos_bouton_continuer.y+HAUTEUR_BOUTON)
{
return 0;
}
if(pos_bouton_quitter.y<event.button.y&&event.button.y<pos_bouton_quitter.x+HAUTEUR_BOUTON)
if(pos_bouton_quitter.y<event.button.y&&event.button.y<pos_bouton_quitter.y+HAUTEUR_BOUTON)
{
etat=FERMER;
}
......@@ -757,7 +758,12 @@ int afficher_menu()
}
break;
}
SDL_BlitSurface(bouton_continuer,NULL,fenetre,&pos_bouton_continuer);
SDL_BlitSurface(bouton_quitter,NULL,fenetre,&pos_bouton_quitter);
SDL_Flip(fenetre);
}
//free les surfaces
SDL_FreeSurface(fenetre);
SDL_FreeSurface(bouton_continuer);
SDL_FreeSurface(bouton_quitter);
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment