94 lines
1.4 KiB
C
94 lines
1.4 KiB
C
#include <stdlib.h>
|
|
#include <graph.h>
|
|
#include "/export/home/an23/keraudre/SAE11_2023/prog/plateau_init.c"
|
|
|
|
|
|
int main (void) {
|
|
|
|
couleur green, white, yellow, red;
|
|
|
|
int** tableau = plateau_init();
|
|
|
|
int i, j;
|
|
|
|
|
|
InitialiserGraphique();
|
|
CreerFenetre(10,10,1550,910);
|
|
|
|
/* tracer du plateau de jeux*/
|
|
|
|
DessinerRectangle(15,15,1320,880);
|
|
|
|
/* remplisage du fond d'écran */
|
|
|
|
white = CouleurParComposante(255,255,255);
|
|
ChoisirCouleurDessin(white);
|
|
RemplirRectangle(0,0,1550,910);
|
|
|
|
|
|
|
|
/* remplissage du plateau de jeux avec les couleur adéquate */
|
|
|
|
|
|
for (i = 0; i < LIGNES; i++) {
|
|
for (j = 0; j < COLONNES; j++) {
|
|
|
|
if ( tableau[i][j] == 0) {
|
|
|
|
green = CouleurParComposante(0,255,30);
|
|
ChoisirCouleurDessin(green);
|
|
RemplirRectangle(15*(j+1),15*(i+1),22,20);
|
|
|
|
}
|
|
if ( tableau[i][j] == 1) {
|
|
|
|
yellow = CouleurParComposante(255,255,0);
|
|
ChoisirCouleurDessin(yellow);
|
|
RemplirRectangle(15*(j+1),15*(i+1),22,20);
|
|
|
|
}
|
|
|
|
if ( tableau[i][j] == 2) {
|
|
|
|
red = CouleurParComposante(255,0,0);
|
|
ChoisirCouleurDessin(red);
|
|
RemplirRectangle(15*(j+1),15*(i+1),22,20);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
for ( i = 0; i < LIGNES; i++) {
|
|
for ( j = 0; j < COLONNES; j++) {
|
|
|
|
printf("%d", tableau[i][j]);
|
|
|
|
}
|
|
printf("\n");
|
|
|
|
}
|
|
printf("\n");
|
|
|
|
|
|
|
|
for ( i = 0; i < LIGNES; i++) {
|
|
|
|
free(tableau[i]);
|
|
}
|
|
|
|
free(tableau);
|
|
|
|
|
|
|
|
|
|
|
|
Touche();
|
|
FermerGraphique();
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|