Le programme permet maintenant d'affichier un ecran qui fait la taille d'une grille 4*4

This commit is contained in:
2025-11-30 16:16:27 +01:00
parent 78c24a6541
commit 7e105c12d6
7 changed files with 74 additions and 10 deletions
+25 -3
View File
@@ -1,13 +1,35 @@
#include <stdio.h>
#include "affichage.h"
#include <graph.h>
#include "config.h"
void init_affichage(void){
InitialiserGraphique();
CreerFenetre(100, 100, 800, 600);
/*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();
FermerGraphique();
}