Affichage de la grille faite en fonction de la taille selectionner par le joueur

This commit is contained in:
ozvann
2024-11-12 23:24:16 +01:00
parent ccd6e58510
commit 666253eb3c
7 changed files with 36 additions and 19 deletions

View File

@@ -25,7 +25,7 @@ CFLAGS = -Wall -ansi -pedantic
#deplacement.o : pion.h obstacle.h
menu.o : taille.h menu.h nbjoueur.h nbjoueur2.h boutonJVJ.h
menu.o : taille.h menu.h nbjoueur.h nbjoueur2.h boutonJVJ.h grille.h
#pion.o : deplacement.h obstacle.h
@@ -37,11 +37,11 @@ boutonJVJ.o : boutonJVJ.h
nbjoueur2.o : nbjoueur2.h
grille.o : grille.h taille.h
grille.o : grille.h
#obstacle.o : pion.h
jeu.o : jeu.h
jeu.o : jeu.h grille.h
main.o : menu.h jeu.h

BIN
game

Binary file not shown.

View File

@@ -1,10 +1,8 @@
#include <stdio.h>
#include <graph.h>
#include "taille.h"
void Grille(int taillegrille){
/*
void Test(){
int x, y;
int tabgrille[taillegrille + 2][taillegrille + 2];
for(x = 0; x < taillegrille + 2; x++){
@@ -21,3 +19,29 @@ void Grille(int taillegrille){
printf("\n");
}
}
*/
void Grille(int taille){
int bord = 0, x = 100, xx = 0, y = 100, yy = 100;
ChoisirCouleurDessin(CouleurParNom("Black"));
for(bord = 0; bord < taille; bord++){
DessinerSegment(50, 100, x, 100);
x += 50;
}
x -= 50;
for(bord = 0; bord <= taille; bord++){
DessinerSegment(50, 100, 50 , y);
DessinerSegment(x, 100, x, y);
y += 50;
}
y -= 50;
DessinerSegment(50, y, x, y);
for(bord = 0; bord <= taille; bord++){
DessinerSegment(50, yy, x, yy);
yy += 50;
}
for(bord = 0; bord <= taille; bord++){
DessinerSegment(xx, 100, xx, y);
xx += 50;
}
}

View File

@@ -3,7 +3,7 @@
void Grille(int taillegrille);
void Grille(int taille);
#endif

4
jeu.c
View File

@@ -6,10 +6,6 @@
void GraphJeu(){
int x = 50, y = 50, xx = 150, yy = 50, i = 0;
printf("fichier jeu.c taille variable\n");
for(i = 1; i < 9; i++){
DessinerSegment(x, y * i, xx * i, yy * i);
}
while(1){}
}

6
menu.c
View File

@@ -5,7 +5,7 @@
#include "nbjoueur.h"
#include "nbjoueur2.h"
#include "boutonJVJ.h"
#include "jeu.h"
#include "grille.h"
int Menu() {
@@ -40,7 +40,7 @@ int Menu() {
printf("choix de menu %d\n", choix);
FermerGraphique();
InitialiserGraphique();
/* Demander a Luck quel est la taille de fenetre max qu'il peut voir sur son écran pour corriger les SAE */
CreerFenetre(50, 50, 600, 600);
CreerFenetre(50, 50, 650, 650);
Grille(echotaille);
return choix;
}

View File

@@ -2,8 +2,6 @@
#include <stdio.h>
#include "grille.h"
/* Code permettant de choisir la taille de la grille en fonction du chiffre que l'utilisateur a entrer qui est compris entre 3 et 9 */
@@ -34,7 +32,6 @@ int GererChoixTaille(){
}
if(taille != 0){
printf("Taille de taille.c = %d\n", taille);
Grille(taille);
return taille;
}
}