SAE11_2022/menu_v2.c

163 lines
3.5 KiB
C

#include <stdlib.h>
#include <stdio.h>
#include <graph.h>
#include "affichage.h"
int menu_principal(void){
//créeation de variable de position
int x;
int y;
ToucheEnAttente();
while(1){
SourisPosition();
x=_X;
y=_Y;
//affichage du menu principal sur le boutton jouer
if((x>384) && (x<1114) && (y>384) && (y<460)){
ChargerImageFond("./background/menu-jouer.png");
}
//afficage du menu principal sur le boutton quitter
else if((x>384) && (x<1114) && (y>497) && (y<573)){
ChargerImageFond("./background/menu-quitter.png");
}
//affichage du menu principal
else{
ChargerImageFond("./background/menu.png");
}
if(SourisCliquee()){
x=_X;
y=_Y;
//quitter
if((x>384) && (x<1114) && (y>497) && (y<572)){
break;
}
//affichage du menu theme
if((x>384) && (x<1114) && (y>384) && (y<459)){
ChargerImageFond("./background/menu-theme.png");
ToucheEnAttente();
while(1){
SourisPosition();
x=_X;
y=_Y;
//affichage du menu sur le boutton retour
if((x>1194) && (x<1399) && (y>45) && (y<121)){
ChargerImageFond("./background/menu-theme-retour.png");
}
//affichage du menu theme
else{
ChargerImageFond("./background/menu-theme.png");
}
if (SourisCliquee()){
x=_X;
y=_Y;
//retour au menu principal
if((x>1194) && (x<1399) && (y>45) && (y<121)){
menu_principal();
}
//affichage du menu difficultée du theme n°1
if((x>66) && (x<491) && (y>356) && (y<781)){
ChargerImageFond("./background/menu-difficultee.png");
while(1){
if(SourisCliquee()){
x=_X;
y=_Y;
if((x>68) && (x<488) && (y>266) && (y<696)){
FermerGraphique();
essay(3);
}
if((x>537) && (x<958) && (y>266) && (y<696)){
FermerGraphique();
essay(4);
}
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
FermerGraphique();
essay(5);
}
}
}
}
//affichage du menu difficultée du theme n°2
if((x>535) && (x<960) && (y>356) && (y<781)){
ChargerImageFond("./background/menu-difficultee.png");
while(1){
if(SourisCliquee()){
x=_X;
y=_Y;
if((x>68) && (x<488) && (y>266) && (y<696)){
FermerGraphique();
essay(3);
}
if((x>537) && (x<958) && (y>266) && (y<696)){
FermerGraphique();
essay(4);
}
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
FermerGraphique();
essay(5);
}
}
}
}
//affichage du menu difficultée du theme 3
if((x>1005) && (x<1430) && (y>356) &&(y<781)){
ChargerImageFond("./background/menu-difficultee.png");
while(1){
if(SourisCliquee()){
x=_X;
y=_Y;
if((x>68) && (x<488) && (y>266) && (y<696)){
FermerGraphique();
essay(3);
}
if((x>537) && (x<958) && (y>266) && (y<696)){
FermerGraphique();
essay(4);
}
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
FermerGraphique();
essay(5);
}
}
}
}
}
}
}
}
}
FermerGraphique();
return EXIT_SUCCESS;
}
int main(void){
//création de la fenetre
InitialiserGraphique();
CreerFenetre(10,10,1500,844);
//ouverture du menu principal
menu_principal();
return EXIT_SUCCESS;
}