menu pause

This commit is contained in:
Wilfried BRIGITTE 2023-12-17 12:58:38 +01:00
parent f648a4726a
commit 12f9b4a49c
7 changed files with 27 additions and 14 deletions

Binary file not shown.

View File

@ -3,7 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
extern long int attendre; extern long int attendre;
@ -12,7 +12,7 @@ extern char timer[6];
extern unsigned long int suivant; extern unsigned long int suivant;
extern int serpent, tete_up, tete_down, tete_right, tete_left, queue_up, queue_down, queue_left, queue_right; extern int serpent, tete_up, tete_down, tete_right, tete_left, queue_up, queue_down, queue_left, queue_right;
extern int x, y, direction, t, segment, i; extern int x, y, direction, t, t4, segment, i;
extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400]; extern int pos_x[2400], pos_y[2400], old_x[2400], old_y[2400];
extern long int vitesse; extern long int vitesse;
@ -21,6 +21,8 @@ extern int fond, Nbr;
extern char score[4]; extern char score[4];
extern int go_on; extern int go_on;
extern int go_menu;
extern int pause;
extern int imageMenu; extern int imageMenu;
void Pomme(); void Pomme();

View File

@ -1,7 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
#include "fonction.h" #include "fonction.h"
#define CYCLE 10000L #define CYCLE 10000L
@ -22,10 +21,12 @@ char score[4];
int go_on=1; int go_on=1;
int go_menu=1; int go_menu=1;
int pause=1;
int imageMenu; int imageMenu;
int go_menu2=1; int go_menu2=1;
int t2; int t2;
int t3; int t3;
int t4;
/*Fonction Principale*/ /*Fonction Principale*/
int main(){ int main(){
@ -57,13 +58,16 @@ int main(){
/*Boucle Principale du Programme*/ /*Boucle Principale du Programme*/
while(go_on){ while(go_on){
Controle();
if (pause==1){
printf("test\n");
Timer(); Timer();
Score(); Score();
Collision(); Collision();
Controle();
Serpent(); Serpent();
Pomme(); Pomme();
} }
}
/* fermeture de la fenêtre si ECHAP pressé + Menu de Fin*/ /* fermeture de la fenêtre si ECHAP pressé + Menu de Fin*/
MenuDeFin(); MenuDeFin();

View File

@ -1,8 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
#include <unistd.h>
#include "fonction.h" #include "fonction.h"
void Terrain(){ void Terrain(){

View File

@ -1,7 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
#include "fonction.h" #include "fonction.h"
void Score(){ void Score(){

View File

@ -1,7 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
#include "fonction.h" #include "fonction.h"
/*Input Serpent*/ /*Input Serpent*/
@ -29,6 +28,18 @@ void Controle(){
direction=2; direction=2;
break; break;
} }
case XK_Escape:
go_on=0;
go_menu=0;
case XK_space:
if (pause==0){
pause=1;
}else{
pause=0;
ChoisirCouleurDessin(CouleurParComposante(255,255,255));
EcrireTexte(500,750,"Jeu en Pause",2);
}
} }
} }
} }

View File

@ -1,7 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <graph.h> #include <graph.h>
#include <time.h>
#include "fonction.h" #include "fonction.h"
#define CYCLE 100000L #define CYCLE 100000L