From ee273ed6850f0857b32dbd7ce2f54d1c8c5d62aa Mon Sep 17 00:00:00 2001 From: brigitte Date: Sun, 10 Dec 2023 13:11:43 +0100 Subject: [PATCH] menu de fin 2 --- JEUX_SERPENT/Jeux | Bin 21576 -> 21680 bytes JEUX_SERPENT/fonction.h | 1 + JEUX_SERPENT/main.c | 34 ++++++++++++++++++++++------------ JEUX_SERPENT/scene.c | 17 ++++++++++++++++- JEUX_SERPENT/serpent.c | 2 +- JEUX_SERPENT/timer.c | 2 +- 6 files changed, 41 insertions(+), 15 deletions(-) diff --git a/JEUX_SERPENT/Jeux b/JEUX_SERPENT/Jeux index 195efbe2ec9ad307f87c32ef9c4adcf4652eb381..f9c630cba3a0448310499aaf9fbe8d441e0d0937 100755 GIT binary patch delta 5358 zcmZu#4^)&@7XQ9+9{+-1ka0jn#$2_`U_cEC`KN|MYJh(-TgxVMlPpDrR?8fd#cj@) zE%aX ztXs_*`BVDOLpHdiEOcBY+1e`pqUC%-(UE~ySARJ7rJVYkJ1;yw;@HfoRdIZCzq$HR zUTAgjIIEkxCMN1lG}B)aye-!I^>@VFn1kye{x#ukZu5LHbWTU>iJg5Aa&m=vnUS+#|Ul-M&+mF>WJw9r&ib8LYs3(=_+8 z&D<3~TK|PV7(d2o{f}ujlI_4IP;M4Cf)v>-TH9cE=J7)*gQ9{L{ukK!2b)BDi zCs8hAvDC_n2OFYOuZ z_ydBuI>um!LFU#Y6;}gsNFi#;R4HuPFMwmP^XLnGt-jqjtA2xMt6Fv;JUY6Q5V?JR z>B`Wnrnv(PYrEE>Yrt6ve2|`^Hb%7lUV!`+kTp_!U3A-)3 z=$16ml?oh%CIn9;iv1MFk-2nMubx&-qdM>NgP+z?S~??7kRkL6G#-Yjqz?dvqy zUd;8~1{(~9?+_f^1N#PZD7pQ0fsepcZ*y;SuTQ8UV^}MO6rwGLy;C68qIb_f;$9#9 zyad=E@c>}88SDT7?0X0R1JPt4j4Vv`aL<7LH)Oq~aDNrJ+TJ*Vy^uq&2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Q@>B_o`r-EWD*m67j$vI3Rf)n_uy$p5=V@`QS5T6_NT% zm`u zPI?&aM6{Jb!?+*qgs)+TcI`RC*n!slFW93s(4IrP^&8kD`9%1lBHS5nd^lxfxOnG3 z4I^Jn%DAD#hM-9_;(|W$k6FgV_KNCjiHYvblA&6KpB2g6fi{d=3JI3@CaBYZyXZX{ zwoix(+3$n;MsXn{iGKv?Vd2P3;$4tDA_Gz~QrsSyI;X^!bwRozRCcriao?8zT4I`TJatAxKG&$bM42QW9=C|V1~YkP#} zwiy|v&?T@wEc9J|qjEwsLHbfP*K)?7+ag-=HJn~7znmvv?J@`RumxY4W_0DCg10A2 zu*9*hRM`zzCm<2OrpZ*T9c;EA;;TAMyF%aA87Y{1;#iAKEacO!GJVfw>X(}hi>L2% ztzI;Zad|A#*3D{*dfN6E7l3BNgM(ocr1wOY>nJR6U0*$A+Q=V0D zwo(ZW=IlLw7R_8xN~}5u;02-hvU{@rkIYmDgQ^rr$A3Bbg)|C^t7n_Lwe|t8U7%nc-R2iOemq%ZWRSym&b{< zO8#f5?Jv(Pu=ov+DuVAIn5SS+Mw`H&a%1HS>hIlU=cc5LT!t16#2A#QC*Z4{;O`D zI$AdM5yy*$+CzJq&Z*);?GaI2oaVUZA2?ABZAZG9PpI8j-&&lfX?4OeCCw4qNgMM` t(jZYhCCj!?_3A|Rlq_wZI5cHE@uz0lp75Hyn?*5tJJo^IS2!l8{uiv#x!wQ( diff --git a/JEUX_SERPENT/fonction.h b/JEUX_SERPENT/fonction.h index 8176ba8..d656b2c 100644 --- a/JEUX_SERPENT/fonction.h +++ b/JEUX_SERPENT/fonction.h @@ -31,5 +31,6 @@ void Update_Timer(); void DessinerScene(); void Score(); void Collision(); +void MenuDeFin(); #endif \ No newline at end of file diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index ea5c020..66bdc52 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -20,11 +20,13 @@ int fond, Nbr; char score[4]; int go_on=1; +int go_menu=1; +int t2; +int initialiser=0; /*Fonction Principale*/ int main(){ - -/* paramétrage de la fenêtre + chargement première scène */ + /* paramétrage de la fenêtre + chargement première scène */ InitialiserGraphique(); CreerFenetre(350,100,1200,800); EffacerEcran(CouleurParComposante(0,0,0)); @@ -42,16 +44,24 @@ int main(){ Pomme(); } -/* fermeture de la fenêtre si ECHAP pressé*/ - ChoisirCouleurDessin(CouleurParComposante(255,255,255)); - RemplirRectangle(0,0,1200,800); - ChoisirCouleurDessin(CouleurParComposante(0,0,0)); - EcrireTexte(500,100,"Game Over", 2); - snprintf(score,15,"Score : %04d", Nbr); - EcrireTexte(500,200,score,2); - snprintf(timer,14,"Temps : %02d:%02d", minute, seconde); - EcrireTexte(490,300,timer,2); - sleep(5); +/* fermeture de la fenêtre si ECHAP pressé + Menu de Fin*/ + MenuDeFin(); + + while(go_menu){ + while(ToucheEnAttente()){ + t2 = Touche(); + switch(t2){ + case XK_q : + go_menu=0; + break; + /*case XK_r : + system("make run"); + sleep(1); + FermerGraphique(); + return EXIT_SUCCESS; */ + } + } + } FermerGraphique(); return EXIT_SUCCESS; } \ No newline at end of file diff --git a/JEUX_SERPENT/scene.c b/JEUX_SERPENT/scene.c index 511bed9..e5f13af 100644 --- a/JEUX_SERPENT/scene.c +++ b/JEUX_SERPENT/scene.c @@ -37,10 +37,25 @@ void DessinerScene(){ AfficherSprite(pomme, pommex[p], pommey[p]); } } + +/*création du Menu de Fin*/ +void MenuDeFin(){ + ChoisirCouleurDessin(CouleurParComposante(255,255,255)); + RemplirRectangle(0,0,1200,800); + ChoisirCouleurDessin(CouleurParComposante(0,0,0)); + EcrireTexte(500,100,"Game Over", 2); + snprintf(score,15,"Score : %04d", Nbr); + EcrireTexte(500,200,score,2); + snprintf(timer,14,"Temps : %02d:%02d", minute, seconde); + EcrireTexte(490,300,timer,2); + EcrireTexte(410,500,"Appuyer sur Q pour quitter",2); + /*EcrireTexte(350,600,"Appuyer sur R pour relancer une partie",2);*/ +} + /*Apparition aléatoire des pommes*/ void Pomme(){ for (pp = 0; pp < 5; ++pp) { AfficherSprite(pomme, pommex[pp], pommey[pp]); } -} \ No newline at end of file +} diff --git a/JEUX_SERPENT/serpent.c b/JEUX_SERPENT/serpent.c index 8493b42..aca0f34 100644 --- a/JEUX_SERPENT/serpent.c +++ b/JEUX_SERPENT/serpent.c @@ -25,7 +25,7 @@ void Controle(){ case XK_Escape: go_on=0; break; - case XK_p: + case XK_space: direction=0; break; } diff --git a/JEUX_SERPENT/timer.c b/JEUX_SERPENT/timer.c index a192f86..73e288a 100644 --- a/JEUX_SERPENT/timer.c +++ b/JEUX_SERPENT/timer.c @@ -29,7 +29,7 @@ void Timer(){ void Update_Timer(){ snprintf(timer,6,"%02d:%02d", minute, seconde); ChoisirCouleurDessin(CouleurParComposante(0,0,0)); - RemplirRectangle(0,720,1200,800); + RemplirRectangle(0,700,1200,800); ChoisirCouleurDessin(CouleurParComposante(255,255,255)); EcrireTexte(10,760,timer,2); } \ No newline at end of file