ajout des fichier pour les comportement du jeu en fonction du nombre de joueur
This commit is contained in:
8
Makefile
8
Makefile
@@ -11,6 +11,8 @@ OFILES = taille.o \
|
||||
nbjoueur2.o \
|
||||
boutonJVJ.o \
|
||||
jeu.o \
|
||||
comportementJCJ.o \
|
||||
comportementJCIA.o \
|
||||
main.o
|
||||
|
||||
|
||||
@@ -26,13 +28,17 @@ taille.o : taille.h jeu.h
|
||||
|
||||
nbjoueur.o : nbjoueur.h
|
||||
|
||||
comportementJCJ.o : comportementJCJ.h
|
||||
|
||||
comportementJCIA.o : comportementJCIA.h
|
||||
|
||||
boutonJVJ.o : boutonJVJ.h
|
||||
|
||||
nbjoueur2.o : nbjoueur2.h
|
||||
|
||||
grille.o : grille.h
|
||||
|
||||
jeu.o : jeu.h menu.h
|
||||
jeu.o : jeu.h menu.h comportementJCJ.h comportementJCIA.h
|
||||
|
||||
main.o : jeu.h
|
||||
|
||||
|
||||
6
comportementJCIA.c
Normal file
6
comportementJCIA.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <graph.h>
|
||||
|
||||
|
||||
void compJCIA(int taille){
|
||||
DessinerSegment(1, 1, 100, 100);
|
||||
}
|
||||
8
comportementJCIA.h
Normal file
8
comportementJCIA.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef COMPORTEMENTJCIA_H
|
||||
#define COMPORTEMENTJCIA_H
|
||||
|
||||
|
||||
void compJCIA(int taille);
|
||||
|
||||
|
||||
#endif
|
||||
5
comportementJCJ.c
Normal file
5
comportementJCJ.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <graph.h>
|
||||
|
||||
void compJCJ(int taille){
|
||||
DessinerSegment(0, 0, 100, 100);
|
||||
}
|
||||
8
comportementJCJ.h
Normal file
8
comportementJCJ.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef COMPORTEMENTJCJ_H
|
||||
#define COMPORTEMENTJCJ_H
|
||||
|
||||
|
||||
void compJCJ(int taille);
|
||||
|
||||
|
||||
#endif
|
||||
2
grille.c
2
grille.c
@@ -2,7 +2,7 @@
|
||||
|
||||
|
||||
void Grille(int taille){
|
||||
int bord = 0, x = 100, xx = 0, y = 100, yy = 100;
|
||||
int bord = 0, x = 100, xx = 50, y = 100, yy = 100;
|
||||
ChoisirCouleurDessin(CouleurParNom("Black"));
|
||||
for(bord = 0; bord < taille; bord++){
|
||||
DessinerSegment(50, 100, x, 100); /* Dessine le bord du haut de la grille */
|
||||
|
||||
17
jeu.c
17
jeu.c
@@ -1,16 +1,17 @@
|
||||
#include <graph.h>
|
||||
|
||||
|
||||
#include "menu.h"
|
||||
/* 1 = JCJ 2 = JCIA*/
|
||||
#include "comportementJCJ.h"
|
||||
#include "comportementJCIA.h"
|
||||
|
||||
void Jeu(){
|
||||
int choix = 0;
|
||||
choix = Menu();
|
||||
if(choix == 1){
|
||||
/**/
|
||||
}else if (choix == 2){
|
||||
/**/
|
||||
int choix[2], taille = 0;
|
||||
Menu(choix);
|
||||
taille = choix[1];
|
||||
if(choix[0] == 1){
|
||||
compJCJ(taille);
|
||||
}else if (choix[0] == 2){
|
||||
compJCIA(taille);
|
||||
}
|
||||
while(1){}
|
||||
}
|
||||
|
||||
6
menu.c
6
menu.c
@@ -7,13 +7,12 @@
|
||||
#include "grille.h"
|
||||
|
||||
|
||||
int Menu() {
|
||||
int Menu(int *retour) {
|
||||
int x = 50, y = 50, taille = -5, choix = 0, echotaille = 0, verrou = 0; /* initialisation des variable */
|
||||
couleur c = CouleurParNom("white");
|
||||
while(choix == 0){ /* Condition pour que le menu s'arrête quand le joueur aura selectionner le nombre de joueur */
|
||||
ChoisirCouleurDessin(CouleurParNom("black"));
|
||||
EcrireTexte(x, y, "Taille de grille entre 3 et 9 :", 2);
|
||||
|
||||
taille = GererChoixTaille(); /* Récupération de la taille de la grille */
|
||||
/* Demande a taille sa valeur pour la comparé pour savoir si menu peu passer a la selection de joueur */
|
||||
if(taille > 2 && taille < 10){
|
||||
@@ -37,5 +36,6 @@ int Menu() {
|
||||
InitialiserGraphique();
|
||||
CreerFenetre(50, 50, 650, 650);
|
||||
Grille(echotaille); /* Lancement du code qui affiche la grille */
|
||||
return choix;
|
||||
retour[0] = choix;
|
||||
retour[1] = echotaille;
|
||||
}
|
||||
|
||||
2
taille.c
2
taille.c
@@ -43,7 +43,7 @@ void AfficherSelectionBoutton(){
|
||||
DessinerSegment(100, 200, 150, 200);
|
||||
DessinerSegment(100, 100, 100, 200);
|
||||
DessinerSegment(150, 100, 150, 200);
|
||||
ChargerImage("3.png", 100, 100, 150, 200, 50, 100);
|
||||
ChargerImage("3.xpm", 100, 100, 150, 200, 50, 100);
|
||||
|
||||
DessinerSegment(200, 100, 250, 100);
|
||||
DessinerSegment(200, 200, 250, 200);
|
||||
|
||||
Reference in New Issue
Block a user