diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..098e2f9 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +### Leni Boscher # Tanguy Domergue ### + +### VARIABLES ### + +CC = gcc + +CFLAGS = -Wall \ + -ansi \ + -pedantic\ + +OPTION = -lgraph + +EXE = ./blocus + +OFILES = main.o \ + menu.o \ + plateau.o \ + regles.o \ + + +### BUT ### + +but: ${EXE} + +### CONDITIONS ### + +plateau.o : plateau.h regles.h main.h + +regles.o : plateau.h regles.h + +main.o : menu.h regles.h plateau.h main.h + +menu.o : menu.h + +${EXE}: ${OFILES} + $(CC) $(CFLAGS) -o ${EXE} ${OFILES} $(OPTION) + +### CONDITIONS FACULTATIVES ### + +clean: + -rm -f ${OFILES} ${EXE} + +run: + ${EXE} diff --git a/Rapport/Compte_Rendu_PT_1_1.pdf b/Rapport/Compte_Rendu_PT_1_1.pdf new file mode 100644 index 0000000..ad3168a Binary files /dev/null and b/Rapport/Compte_Rendu_PT_1_1.pdf differ diff --git a/img/croix_bleue3.png b/img/croix_bleue3.png new file mode 100644 index 0000000..516a846 Binary files /dev/null and b/img/croix_bleue3.png differ diff --git a/img/croix_bleue4.png b/img/croix_bleue4.png new file mode 100644 index 0000000..239a517 Binary files /dev/null and b/img/croix_bleue4.png differ diff --git a/img/croix_bleue5.png b/img/croix_bleue5.png new file mode 100644 index 0000000..dd0fe75 Binary files /dev/null and b/img/croix_bleue5.png differ diff --git a/img/croix_bleue6.png b/img/croix_bleue6.png new file mode 100644 index 0000000..2541114 Binary files /dev/null and b/img/croix_bleue6.png differ diff --git a/img/croix_bleue7.png b/img/croix_bleue7.png new file mode 100644 index 0000000..3493453 Binary files /dev/null and b/img/croix_bleue7.png differ diff --git a/img/croix_bleue8.png b/img/croix_bleue8.png new file mode 100644 index 0000000..2e95ebf Binary files /dev/null and b/img/croix_bleue8.png differ diff --git a/img/croix_bleue9.png b/img/croix_bleue9.png new file mode 100644 index 0000000..e5151ea Binary files /dev/null and b/img/croix_bleue9.png differ diff --git a/img/croix_orange3.png b/img/croix_orange3.png new file mode 100644 index 0000000..346b0ed Binary files /dev/null and b/img/croix_orange3.png differ diff --git a/img/croix_orange4.png b/img/croix_orange4.png new file mode 100644 index 0000000..5d9f7f6 Binary files /dev/null and b/img/croix_orange4.png differ diff --git a/img/croix_orange5.png b/img/croix_orange5.png new file mode 100644 index 0000000..a8a4205 Binary files /dev/null and b/img/croix_orange5.png differ diff --git a/img/croix_orange6.png b/img/croix_orange6.png new file mode 100644 index 0000000..2c8b582 Binary files /dev/null and b/img/croix_orange6.png differ diff --git a/img/croix_orange7.png b/img/croix_orange7.png new file mode 100644 index 0000000..970f362 Binary files /dev/null and b/img/croix_orange7.png differ diff --git a/img/croix_orange8.png b/img/croix_orange8.png new file mode 100644 index 0000000..de87a0a Binary files /dev/null and b/img/croix_orange8.png differ diff --git a/img/croix_orange9.png b/img/croix_orange9.png new file mode 100644 index 0000000..33d46ed Binary files /dev/null and b/img/croix_orange9.png differ diff --git a/img/menu.png b/img/menu.png new file mode 100644 index 0000000..22e1492 Binary files /dev/null and b/img/menu.png differ diff --git a/img/pion_bleu3.png b/img/pion_bleu3.png new file mode 100644 index 0000000..6a5a0b4 Binary files /dev/null and b/img/pion_bleu3.png differ diff --git a/img/pion_bleu4.png b/img/pion_bleu4.png new file mode 100644 index 0000000..2007c47 Binary files /dev/null and b/img/pion_bleu4.png differ diff --git a/img/pion_bleu5.png b/img/pion_bleu5.png new file mode 100644 index 0000000..3b34dd4 Binary files /dev/null and b/img/pion_bleu5.png differ diff --git a/img/pion_bleu6.png b/img/pion_bleu6.png new file mode 100644 index 0000000..63ddb10 Binary files /dev/null and b/img/pion_bleu6.png differ diff --git a/img/pion_bleu7.png b/img/pion_bleu7.png new file mode 100644 index 0000000..1059911 Binary files /dev/null and b/img/pion_bleu7.png differ diff --git a/img/pion_bleu8.png b/img/pion_bleu8.png new file mode 100644 index 0000000..cdfaacb Binary files /dev/null and b/img/pion_bleu8.png differ diff --git a/img/pion_bleu9.png b/img/pion_bleu9.png new file mode 100644 index 0000000..1a7a031 Binary files /dev/null and b/img/pion_bleu9.png differ diff --git a/img/pion_orange3.png b/img/pion_orange3.png new file mode 100644 index 0000000..73cfbb7 Binary files /dev/null and b/img/pion_orange3.png differ diff --git a/img/pion_orange4.png b/img/pion_orange4.png new file mode 100644 index 0000000..b59cd1f Binary files /dev/null and b/img/pion_orange4.png differ diff --git a/img/pion_orange5.png b/img/pion_orange5.png new file mode 100644 index 0000000..ae906a8 Binary files /dev/null and b/img/pion_orange5.png differ diff --git a/img/pion_orange6.png b/img/pion_orange6.png new file mode 100644 index 0000000..1f4e52c Binary files /dev/null and b/img/pion_orange6.png differ diff --git a/img/pion_orange7.png b/img/pion_orange7.png new file mode 100644 index 0000000..6f5d09d Binary files /dev/null and b/img/pion_orange7.png differ diff --git a/img/pion_orange8.png b/img/pion_orange8.png new file mode 100644 index 0000000..9480a4f Binary files /dev/null and b/img/pion_orange8.png differ diff --git a/img/pion_orange9.png b/img/pion_orange9.png new file mode 100644 index 0000000..523f183 Binary files /dev/null and b/img/pion_orange9.png differ diff --git a/img/reglage.png b/img/reglage.png new file mode 100644 index 0000000..a915af3 Binary files /dev/null and b/img/reglage.png differ diff --git a/img/reglages.png b/img/reglages.png new file mode 100644 index 0000000..7a7fe56 Binary files /dev/null and b/img/reglages.png differ diff --git a/img/winbleu.png b/img/winbleu.png new file mode 100644 index 0000000..b9ecb2d Binary files /dev/null and b/img/winbleu.png differ diff --git a/img/winorange.png b/img/winorange.png new file mode 100644 index 0000000..19df6b8 Binary files /dev/null and b/img/winorange.png differ diff --git a/main.c b/main.c new file mode 100644 index 0000000..5b5e215 --- /dev/null +++ b/main.c @@ -0,0 +1,27 @@ +/* Leni Boscher * Tanguy Domergue */ + +#include +#include +#include +#include"main.h" +#include"menu.h" +#include"plateau.h" +#include"regles.h" + + +int main(void){ + int number, versus; + InitialiserGraphique(); + CreerFenetre(10,10, LargeF, HautF); + if (accueil(&number, &versus)==0)return EXIT_SUCCESS; + while(1) { + if(SourisCliquee()) { + if (_X>=322 && _X<=426 && _Y>=453 && _Y<=511){ + FermerGraphique(); + plateau(number, versus); + break; + } + } + } + return EXIT_SUCCESS; + } \ No newline at end of file diff --git a/main.h b/main.h new file mode 100644 index 0000000..dd56187 --- /dev/null +++ b/main.h @@ -0,0 +1,9 @@ +#ifndef MAIN_H +#define MAIN_H + +#define LargeF 750 /*largeur de la fenetre*/ +#define HautF 550 /* hauteur de la fenetre */ + +int main(void); + +#endif \ No newline at end of file diff --git a/menu.c b/menu.c new file mode 100644 index 0000000..9e2d28c --- /dev/null +++ b/menu.c @@ -0,0 +1,146 @@ +/* Boscher Leni * Domergue Tanguy */ + +#include +#include +#include +#include"plateau.h" + +void backaccueil(int sortir){ /* cette fonction permet de revenir sur l'écran principale */ + if(sortir>=0){ + + while(SourisCliquee()){ + if (_X>=21 && _X<=168 && _Y>=20 && _Y<=52){ + FermerGraphique(); + main(); + } + } + } +} + + +int gameplay(){ /*( affiche rectangle autour de utilisateur vs ia / utilisateur vs j2 et renvoie une valeur en fonction du choix)*/ + int sortir = 0; + couleur rouge= CouleurParNom("red"); + + while(sortir == 0){ + + while(SourisCliquee()){ + + if(_X>=158 && _X<=441 && _Y>=392 && _Y<=422){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(158,392,(441-158),(422-392)); + sortir++; + return 2; + } + + else if (_X>=442 && _X<=724 && _Y>=392 && _Y<=422){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(442,392,(724-442),(422-392)); + sortir++; + return 1; + } + if (_X>=21 && _X<=168 && _Y>=20 && _Y<=52){ + FermerGraphique(); + main(); + return 0; + } + } + } +} + +int dimensions(){ /* (affiche rectangle autour des dimensions choisis par l'utilisateur et renvoie une valeur en fonction de celle-ci ) */ + int sortir = 0; + couleur rouge= CouleurParNom("red"); + + while(sortir == 0){ + + while(SourisCliquee()){ + + if(_X>=158 && _X<=239 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(158,341,(239-158),(371-341)); + sortir++; + return 3; + } + + if(_X>=239 && _X<=321 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(239,341,(321-239),(371-341)); + sortir++; + return 4; + } + + if(_X>=320 && _X<=402 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(320,341,(403-320),(371-341)); + sortir++; + return 5; + } + + if(_X>=402 && _X<=483 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(402,341,(483-402),(371-341)); + sortir++; + return 6; + } + + if(_X>=483 && _X<=564 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(483,341,(564-483),(371-341)); + sortir++; + return 7; + } + + if(_X>=565 && _X<=645 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(565,341,(645-565),(371-341)); + sortir++; + return 8; + } + + if(_X>=645 && _X<=724 && _Y>=341 && _Y<=368){ + ChoisirCouleurDessin(rouge); + DessinerRectangle(645,341,(724-645),(371-341)); + sortir++; + return 9; + } + if (_X>=21 && _X<=168 && _Y>=20 && _Y<=52){ + FermerGraphique(); + main(); + return 0; + } + } + } +} + + + +int accueil(int* number, int* versus){ /*Fonction qui lance la premiere page d'accueil ( permet d'aller vers exit ou jouer (reglage))*/ + ChargerImageFond("./img/menu.png"); + + while(1){ + if (SourisCliquee()){ + if(_X>=490 && _X<=600 && _Y>=436 && _Y<=488 ){ + FermerGraphique(); + return 0; + } + + if (_X>=616 && _X<=725 && _Y>=438 && _Y<=490) + { + ChargerImageFond("./img/reglage.png"); + *number = dimensions(); + *versus = gameplay(); + return 1; + } + + } + if (_X>=21 && _X<=168 && _Y>=20 && _Y<=52){ + FermerGraphique(); + main(); + } + } + } + + + + diff --git a/menu.h b/menu.h new file mode 100644 index 0000000..81de796 --- /dev/null +++ b/menu.h @@ -0,0 +1,11 @@ +#ifndef MENU_H +#define MENU_H + +void reglage(); +int accueil(int* number, int* versus); +void quitter(); +int dimensions(); +int gameplay(); +void backaccueil(int sortir); + +#endif /* MENU_H */ \ No newline at end of file diff --git a/plateau.c b/plateau.c new file mode 100644 index 0000000..7f75026 --- /dev/null +++ b/plateau.c @@ -0,0 +1,425 @@ +/* Leni Boscher * Tanguy Domergue */ + +#include +#include +#include +#include +#include +#include"regles.h" +#include"plateau.h" +#include"menu.h" +#include"main.h" + +/* Main */ + + + +int plateau(int dim, int nb_joueurs) { +taille = dim; +decalage = ((TAILLE_WINDOW-DIMENSIONS)/2); +srand(time(NULL)); +couple pion; +couple indice; +int jouer=1; +int tailleCase = DIMENSIONS/taille; +int i; +int j; +couleur c; +int win=0; + +tab=malloc((taille+2)*sizeof(tile)); +for(i=0;i +#include +#include +#include"regles.h" +#include"plateau.h" + +/* Fonction qui donne la case dans laquelle le pion du joueur est */ + +couple chercherPion(int joueur) { + int i; + int j; + for(i=1;i=tab[i][j].coord.x)&&(x<=tab[i+1][j].coord.x)) { + break; + } +} + + for(j=1;j=tab[i][j].coord.y)&&(y<=tab[i][j+1].coord.y)) { + break; + } +} + + if((x>decalage+DIMENSIONS) || (xdecalage+DIMENSIONS) || (y