36 lines
969 B
C
36 lines
969 B
C
#include <stdio.h>
|
|
#include "affichage.h"
|
|
#include <graph.h>
|
|
#include "config.h"
|
|
|
|
|
|
void init_affichage(void){
|
|
|
|
InitialiserGraphique();
|
|
/*La fenetre vass faire la taille de la grille*/
|
|
CreerFenetre(100, 100, NB_COLS * TAILLE_CASE, NB_LIGNES * TAILLE_CASE);
|
|
}
|
|
void afficher_plateau(int grille[NB_LIGNES][NB_COLS]){
|
|
int i,j,x,y;
|
|
char texte[10];
|
|
EffacerEcran(CouleurParNom("white"));
|
|
|
|
for (i = 0; i < NB_LIGNES; i++){
|
|
for(j = 0; j < NB_COLS; j++){
|
|
/*Calcul en pixel de la taille d'une case*/
|
|
x = j * TAILLE_CASE;
|
|
y = i * TAILLE_CASE;
|
|
/*Ici on saute la case vide du taquin*/
|
|
if (grille[i][j] == 0) continue;
|
|
/*ET on ecrit le numéro dans un rectagle*/
|
|
ChoisirCouleurDessin(CouleurParNom("black"));
|
|
DessinerRectangle(x, y, TAILLE_CASE, TAILLE_CASE);
|
|
sprintf(texte, "%d", grille[i][j]);
|
|
EcrireTexte(x + 40, y + 60, texte, 2);
|
|
}
|
|
}
|
|
}
|
|
void fermer_affichage(void){
|
|
FermerGraphique();
|
|
}
|