Réorganisation des fichiers et création du fichier Makefile

This commit is contained in:
2023-11-30 20:50:39 +01:00
parent 9f64e553ce
commit a7e9587cbc
6 changed files with 15 additions and 191 deletions

View File

@@ -1,10 +1,10 @@
#Snake : fichier Makefile
#BUT FINAL
### BUT FINAL ###
but : snake
#VARIABLES
### VARIABLES ###
OFILES = plateau_init.o \
fenetre.o \
@@ -14,7 +14,7 @@ CC = gcc
CFLAGS = -ansi - pedantic -lgraph
#DEPENDANCES (REGLES IMPLICITES)
### REGLES ESSENTIELLES ###
plateau_init.o : plateau_init.h
@@ -23,4 +23,10 @@ fenetre.o : fenetre.h plateau_init.h
main.o : fenetre.h
#DEPENDANCES AVEC COMMANDES
snake : $(OFILES)
$(CC) $(CFLAGS) -o snake $(OFLIES)
clean : -rm -f $(OFLIES) snake
### FIN ###

View File

@@ -18,9 +18,6 @@ int main (void) {
InitialiserGraphique();
/*dimenion fenêtre*/
CreerFenetre(10,10,1450,840);
@@ -42,16 +39,6 @@ int main (void) {
RemplirRectangle( 1220, 17, 3, 806);
/*affichage du score */
RemplirRectangle( 1240, 17, 190, 3);
RemplirRectangle( 1240, 17, 3, 806);
RemplirRectangle( 1240, 820, 190, 3);/*
RemplirRectangle( 1230, 806, 806, 3);*/
/* remplissage du plateau de jeux avec les couleur adéquate */
@@ -85,7 +72,7 @@ int main (void) {
/* désallocation du tableau */
/* déallocation du tableau */
for ( i = 0; i < LIGNES; i++) {

10
snake/main.c Normal file
View File

@@ -0,0 +1,10 @@
#include <stdlib.h>
#include <stdio.h>
#include "fenetre.h"
#include "plateau_init.h"
int main(void) {
return EXIT_SUCCESS;
}

View File

@@ -54,7 +54,7 @@ int** plateau_init(void) {
/* teste pour faire apparaitre exactement 5 pommes */
while (tableau[ligne_pomme][colonne_pomme] == 2) {
while (tableau[ligne_pomme][colonne_pomme] == 2 || tableau[ligne_pomme][colonne_pomme] == 1) {
ligne_pomme = rand() % 40;
colonne_pomme = rand() % 60;