Merge branch 'master' of https://dwarves.iut-fbleau.fr/gitiut/pietrois/SAE11_2022
BIN
background/ecran-victoire.png
Normal file
After Width: | Height: | Size: 739 KiB |
BIN
background/menu-difficultee.png
Normal file
After Width: | Height: | Size: 165 KiB |
BIN
background/menu-jouer.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
background/menu-quitter.png
Normal file
After Width: | Height: | Size: 223 KiB |
BIN
background/menu-theme-retour.png
Normal file
After Width: | Height: | Size: 172 KiB |
BIN
background/menu-theme.png
Normal file
After Width: | Height: | Size: 172 KiB |
BIN
background/menu.png
Normal file
After Width: | Height: | Size: 223 KiB |
84
menu_v1.c
Normal file
@ -0,0 +1,84 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <graph.h>
|
||||
|
||||
int menu_principal(void){
|
||||
int x;
|
||||
int y;
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
|
||||
ChoisirCouleurDessin(CouleurParNom("red"));
|
||||
RemplirRectangle(180,580,100,25);
|
||||
RemplirRectangle(720,580,100,25);
|
||||
|
||||
ChoisirCouleurDessin(CouleurParNom("black"));
|
||||
EcrireTexte(475,200,"Memorie",2);
|
||||
EcrireTexte(200,600,"Quitter",1);
|
||||
EcrireTexte(750,600,"jouer",1);
|
||||
|
||||
ToucheEnAttente();
|
||||
while(1){
|
||||
if(SourisCliquee()){
|
||||
x=_X;
|
||||
y=_Y;
|
||||
|
||||
if((x>180) && (x<280) && (y>580) && (y<605)){
|
||||
break;
|
||||
}
|
||||
|
||||
if((x>720) && (x<820) && (y>580) && (y<605)){
|
||||
mode_jeu();
|
||||
}
|
||||
}
|
||||
}
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int mode_jeu(void){
|
||||
int x;
|
||||
int y;
|
||||
EffacerEcran(CouleurParNom("gray"));
|
||||
ChoisirCouleurDessin(CouleurParNom("red"));
|
||||
RemplirRectangle(450,300,100,25);
|
||||
RemplirRectangle(400,400,200,380);
|
||||
RemplirRectangle(700,400,200,380);
|
||||
RemplirRectangle(100,400,200,380);
|
||||
|
||||
ChoisirCouleurDessin(CouleurParNom("Black"));
|
||||
RemplirRectangle(100,780,200,50);
|
||||
RemplirRectangle(400,780,200,50);
|
||||
RemplirRectangle(700,780,200,50);
|
||||
EcrireTexte(400,200,"Mode de Jeu",2);
|
||||
EcrireTexte(470,320,"retour",1);
|
||||
|
||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||
EcrireTexte(140,810,"theme_1",2);
|
||||
EcrireTexte(440,810,"theme_2",2);
|
||||
EcrireTexte(740,810,"theme_3",2);
|
||||
|
||||
|
||||
|
||||
ToucheEnAttente();
|
||||
while(1){
|
||||
if (SourisCliquee()){
|
||||
x=_X;
|
||||
y=_Y;
|
||||
if((x>450) && (x<550) && (y>300) && (y<325)){
|
||||
menu_principal();
|
||||
}
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
int main(void){
|
||||
int x ;
|
||||
int y ;
|
||||
couleur c;
|
||||
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(10,10,1000,1000);
|
||||
menu_principal();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
152
menu_v2.c
Normal file
@ -0,0 +1,152 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <graph.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)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>537) && (x<958) && (y>266) && (y<696)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>537) && (x<958) && (y>266) && (y<696)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>537) && (x<958) && (y>266) && (y<696)){
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
if((x>1007) && (x<1432) && (y>266) && (y<696)) {
|
||||
EffacerEcran(CouleurParNom("grey"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
BIN
souris_test
Executable file
33
souris_test.c
Normal file
@ -0,0 +1,33 @@
|
||||
#include <graph.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define tx 300
|
||||
#define ty 300
|
||||
|
||||
int main(void){
|
||||
char t[50];
|
||||
int x,y;
|
||||
couleur c;
|
||||
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(100,100,tx,ty);
|
||||
c=CouleurParNom("black");
|
||||
SourisPosition();
|
||||
x=_X;
|
||||
y=_Y;
|
||||
sprintf(t,"x=%3d:y=%3d",_X,_Y);
|
||||
EffacerEcran(CouleurParNom("white"));
|
||||
EcrireTexteC((tx-TailleChaineEcran(t,0))/2,ty/2,t,c,0);
|
||||
|
||||
while(!SourisCliquee()){
|
||||
SourisPosition();
|
||||
if(_X!=x||_Y!=y){
|
||||
sprintf(t,"x=%3d:y=%3d",_X,_Y);
|
||||
EffacerEcran(CouleurParNom("white"));
|
||||
EcrireTexteC((tx-TailleChaineEcran(t,0))/2,ty/2,t,c,0);
|
||||
x=_X;
|
||||
y=_Y;
|
||||
}
|
||||
}
|
||||
FermerGraphique();
|
||||
}
|