ajouts : test souris et menu
This commit is contained in:
parent
acc927e9b5
commit
f0d20e1617
84
menu_v1.c
Normal file
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;
|
||||
}
|
BIN
souris_test
Executable file
BIN
souris_test
Executable file
Binary file not shown.
33
souris_test.c
Normal 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user