Affichage de la grille + mode triche
This commit is contained in:
parent
33fd06032a
commit
adc683d61a
34
test.c
34
test.c
@ -1,14 +1,41 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <graph.h>
|
#include <graph.h>
|
||||||
|
|
||||||
|
void DessinerGrille(int x_g, int y_g, int x_fen, int y_fen, int triche){
|
||||||
|
int i,j;
|
||||||
|
int tab[2][2] = {{1,2},{1,2}};
|
||||||
|
int x = 0;
|
||||||
|
int y = 0;
|
||||||
|
int l_case = (x_fen-((10*x_g)+10))/x_g;
|
||||||
|
int h_case = (y_fen-((10*y_g)+10))/y_g;
|
||||||
|
if (triche == 0){
|
||||||
|
for(i=10;i<x_fen-10;i+=l_case+10){
|
||||||
|
for(j=10;j<y_fen-10;j+=h_case+10){
|
||||||
|
RemplirRectangle(i,j,l_case,h_case);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (triche == 1){
|
||||||
|
for(i=10;i<x_fen-10;i+=l_case+10){
|
||||||
|
for(j=10;j<y_fen-10;j+=h_case+10){
|
||||||
|
ChoisirCouleurDessin((tab[x][y]*100)+100);
|
||||||
|
RemplirRectangle(i,j,l_case,h_case);
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
x++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main(void){
|
int main(void){
|
||||||
|
int tab[2][2] = {{1,2},{1,2}};
|
||||||
int i,j;
|
int i,j;
|
||||||
int x=1;
|
int x=1;
|
||||||
int touche;
|
int touche;
|
||||||
InitialiserGraphique();
|
InitialiserGraphique();
|
||||||
CreerFenetre(10,10,1000,1000);
|
CreerFenetre(10,10,1000,1000);
|
||||||
ChoisirCouleurDessin(CouleurParComposante(255,0,0));
|
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
||||||
|
DessinerGrille(2,2,1000,1000,0);
|
||||||
while(1){
|
while(1){
|
||||||
if (ToucheEnAttente()){
|
if (ToucheEnAttente()){
|
||||||
touche = Touche();
|
touche = Touche();
|
||||||
@ -18,13 +45,16 @@ int main(void){
|
|||||||
EffacerEcran(CouleurParComposante(255,255,255));
|
EffacerEcran(CouleurParComposante(255,255,255));
|
||||||
ChoisirCouleurDessin(CouleurParComposante(255,0,0));
|
ChoisirCouleurDessin(CouleurParComposante(255,0,0));
|
||||||
EcrireTexte(10,10,"mode triche",2);
|
EcrireTexte(10,10,"mode triche",2);
|
||||||
|
DessinerGrille(2,2,1000,1000,1);
|
||||||
}
|
}
|
||||||
if (x==1){
|
if (x==1){
|
||||||
EffacerEcran(CouleurParComposante(255,255,255));
|
EffacerEcran(CouleurParComposante(255,255,255));
|
||||||
|
ChoisirCouleurDessin(CouleurParComposante(0,0,0));
|
||||||
|
DessinerGrille(2,2,1000,1000,0);
|
||||||
}
|
}
|
||||||
if (touche == XK_space)
|
if (touche == XK_space)
|
||||||
break;
|
break;
|
||||||
|
touche = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FermerGraphique();
|
FermerGraphique();
|
||||||
|
Loading…
Reference in New Issue
Block a user