mise à niveau

This commit is contained in:
Yann KERAUDREN 2023-12-19 11:49:49 +01:00
parent 773d907b5a
commit fbede17e04
6 changed files with 185 additions and 61 deletions

@ -7,6 +7,7 @@ but : run
### VARIABLES ###
OFILES = plateau_init.o \
ecran_lancement.o \
fenetre.o \
augmentation_serpent.o \
deplacement.o \
@ -24,7 +25,9 @@ CFLAGS = -ansi -pedantic -lgraph
plateau_init.o : plateau_init.h
fenetre.o : fenetre.h plateau_init.h
fenetre.o : fenetre.h plateau_init.h ecran_lancement.h
ecran_lancement.o : ecran_lancement.h
augmentation_serpent.o : augmentation_serpent.h

@ -1,78 +1,81 @@
/* Fonction qui affiche un écran principal avant de lancer le jeu
Written by Yann KERAUDREN and Titouan LERICHE */
#include <stdlib.h>
#include <graph.h>
#include <stdio.h>
#include "ecran_lancement.h"
int main(void) {
void ecran_lancement(void) {
couleur grey, green, yellow, red;
couleur grey, green, yellow, red;
grey = CouleurParComposante(50,205,50);
ChoisirCouleurDessin(grey);
RemplirRectangle(0,0,1450,840);
yellow = CouleurParComposante(255,255,0);
ChoisirCouleurDessin(yellow);
RemplirRectangle(100,100,1200,6);
RemplirRectangle(1300,100,6,220);
RemplirRectangle(90,320,1216,6);
RemplirRectangle(90,320,6,165);
RemplirRectangle(90,485,200,6);
RemplirRectangle(250,465,50,46);
DessinerSegment(300, 470, 380, 440);
DessinerSegment(300, 469, 380, 439);
DessinerSegment(300, 468, 380, 438);
DessinerSegment(300, 467, 380, 437);
DessinerSegment(300, 507, 380, 537);
DessinerSegment(300, 506, 380, 536);
DessinerSegment(300, 505, 380, 535);
DessinerSegment(300, 504, 380, 534);
InitialiserGraphique();
CreerFenetre(10,10,1450,840);
EcrireTexte(700,200, "SNAKE", 2);
grey = CouleurParComposante(50,205,50);
ChoisirCouleurDessin(grey);
RemplirRectangle(0,0,1450,840);
yellow = CouleurParComposante(255,255,0);
ChoisirCouleurDessin(yellow);
RemplirRectangle(100,100,1200,6);
RemplirRectangle(1300,100,6,220);
RemplirRectangle(90,320,1216,6);
RemplirRectangle(90,320,6,165);
RemplirRectangle(90,485,200,6);
RemplirRectangle(250,465,50,46);
DessinerSegment(300, 470, 380, 440);
DessinerSegment(300, 469, 380, 439);
DessinerSegment(300, 468, 380, 438);
DessinerSegment(300, 467, 380, 437);
DessinerSegment(300, 507, 380, 537);
DessinerSegment(300, 506, 380, 536);
DessinerSegment(300, 505, 380, 535);
DessinerSegment(300, 504, 380, 534);
red = CouleurParComposante(255,0,0);
ChoisirCouleurDessin(red);
EcrireTexte(400,500, "space = play", 2);
EcrireTexte(1000,500, "echap = quit", 2);
(if Touche() == XK_space ) {
return ;
}
if ( Touche() == XK_Escape) {
FermerGraphique();
}
EcrireTexte(700,200, "SNAKE", 2);
red = CouleurParComposante(255,0,0);
ChoisirCouleurDessin(red);
EcrireTexte(400,500, "space = play", 2);
EcrireTexte(1000,500, "echap = quit", 2);
while (1) {
}
FermerGraphique();
return EXIT_SUCCESS;
}

96
snake/ecran_lancement.c Normal file

@ -0,0 +1,96 @@
/* Fonction qui affiche l'écran principale du jeu
Written by Yann KERAUDREN and Titouan LERICHE */
#include <stdlib.h>
#include <stdio.h>
#include "ecran_lancement.h"
void ecran_lancement(void) {
couleur grey, green, yellow, red;
grey = CouleurParComposante(50,205,50);
ChoisirCouleurDessin(grey);
RemplirRectangle(0,0,1450,840);
yellow = CouleurParComposante(255,255,0);
ChoisirCouleurDessin(yellow);
RemplirRectangle(100,100,1200,6);
RemplirRectangle(1300,100,6,220);
RemplirRectangle(90,320,1216,6);
RemplirRectangle(90,320,6,165);
RemplirRectangle(90,485,200,6);
RemplirRectangle(250,465,50,46);
DessinerSegment(300, 470, 380, 440);
DessinerSegment(300, 469, 380, 439);
DessinerSegment(300, 468, 380, 438);
DessinerSegment(300, 467, 380, 437);
DessinerSegment(300, 507, 380, 537);
DessinerSegment(300, 506, 380, 536);
DessinerSegment(300, 505, 380, 535);
DessinerSegment(300, 504, 380, 534);
EcrireTexte(700,200, "SNAKE", 2);
red = CouleurParComposante(255,0,0);
ChoisirCouleurDessin(red);
EcrireTexte(400,500, "space = play", 2);
EcrireTexte(1000,500, "echap = quit", 2);
if (Touche() == XK_space ) {
return ;
}
if (Touche() == XK_Escape) {
FermerGraphique();
}
}

13
snake/ecran_lancement.h Normal file

@ -0,0 +1,13 @@
/* Fichier d'en-tête du fichier ecran_lancemetn.c
Written by Yann KERAUDREN and Titouan LERICHE */
#ifndef ECRAN_LANCEMENT_H
#define ECRAN_LANCEMENT_H
#include <graph.h>
void ecran_lancement(void) ;
#endif /* ECRAN_LANCEMENT_H */

@ -7,6 +7,7 @@
#include <graph.h>
#include "plateau_init.h"
#include "fenetre.h"
#include "ecran_lancement.h"
@ -29,6 +30,14 @@ void start (struct adresse* pointeur) {
int score=0;
/* affichage du l'écran principale */
ecran_lancement();
/* remplisage du fond d'écran */
grey = CouleurParComposante(35,35,35);

BIN
snake/lancement Executable file

Binary file not shown.