From 2fdcd8330e52d0c3ed119c1fdeb381f85b7b5fa4 Mon Sep 17 00:00:00 2001 From: SAE11_2023 Date: Wed, 22 Nov 2023 19:53:24 +0100 Subject: [PATCH] ajout timer 1 --- JEUX_SERPENT/.nfs0000000002e8cfdb00000009 | Bin 0 -> 15496 bytes JEUX_SERPENT/main.c | 33 ++++++++++++++++------ JEUX_SERPENT/timer.c | 20 +++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) create mode 100755 JEUX_SERPENT/.nfs0000000002e8cfdb00000009 create mode 100644 JEUX_SERPENT/timer.c diff --git a/JEUX_SERPENT/.nfs0000000002e8cfdb00000009 b/JEUX_SERPENT/.nfs0000000002e8cfdb00000009 new file mode 100755 index 0000000000000000000000000000000000000000..23bd9ca0348dd3026768d6b1cb38a9c9adb3c778 GIT binary patch literal 15496 zcmeHOU2Ggz6~4Pk8kg4gCQ7KAKr?D%lp=ZJf1Fq*>z{ST;3Tf=h=736+B>!vt#{4t zxZSj(7#WZ(D-s|mqUuA7ka$9J)jm`zg$+ST3w?0lC5nWwDk3=wlvEVtLdbB=%=yOS z>ADRFc$y>4eD|JvzI)G{J3n`J&VDsDJQ$C~6l9zFq~h90!qX(Bp{7F$1WDDUYH9y~ z`lz~#>f2qN*Pir%T0OZE-;6b)-$uy11};>=k9cYYgoljG+e)U{ArhdH<6zznZjgEy zUyuQSX!pm{m`tL%dmopj3Jmhtm6ayXV5Mg>j!0b22!h8|=B)~ERd_y%pR0n1C&z@h zE{SItlhnqNboWYyd1c{+aX{>WJO<07*X+!HGTw;r5}MnM3gbaft$-Ns5#q_zipBc_ zrg>Dx+iD(~CH_DOt2&&^j(4^n&Sjc%+5B9&sod4s)Y-0=3VN$MF#FX^8=q6hPo7rs zc~xN@_%RjRRF6xYOk82xJ+yJyng96G(Z?RTw*IBdYjd9)U4Hea)}HRGY{SRFeXv)538#d_f1b33r?ka{Oq|>VC50S2#eQpc;C%4eEuhsgwpY#vX_8uwaENfPoCe6o$ zS+dhb+nh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w6Q;7`?pB1(H54PSoJvUBmIM6W2$$seVp!Aq4QGN*%_;-PbhQXvnP8` z4E0miHl3Yj$}k53oJ0%!f{qRVJG^=So&anO2^5=6I_x#0uxoRntQ7G=hVXya!S z_+7#WCaEnbcy2-0NrfQ4EPNpU{u&hAC!iamLXiKg@PQf(1;hN$kp6Gag|PZOV?{orGL0IX0O3;W1%1|QGqEa})~@Uh+iVtqj-u5ceg`7%}bSq?s)-$2}k z;6LnuPZ6Kj2B>3w0Bn}Q!v4dDb5!7%f{*nHup)*SKYaY(7k;1EVZ8&y_{`@uQJDWc z={P3n-@ot5fnyy=Ca#3%|5?%o`I_*67+>h&?$wV&eEk0q_(*8Nqa5Wh?Kz%qz}m_Mk0O9jd%bgu!{Vf~K( zy@l;j2mYQo^#MNC_g9*@w~h0~t8LW5zd;Rr?#OM!U$6Q9W0d*h^PdGg%;P(xV-xW4 zzoyDzwpQwp2mT&>;JefkiipR9^u0wLa3_#1$Ll{=>Px# literal 0 HcmV?d00001 diff --git a/JEUX_SERPENT/main.c b/JEUX_SERPENT/main.c index aa56fe7..8911937 100644 --- a/JEUX_SERPENT/main.c +++ b/JEUX_SERPENT/main.c @@ -1,24 +1,41 @@ #include +#include #include +#include int main(){ + /*variables*/ + int seconde=0; + int minute=0; + char t; + char y; + char timer[4] = {'0',':','0','\0'}; + /* taille de la fenêtre */ InitialiserGraphique(); - CreerFenetre(10,10,1200,800); + CreerFenetre(350,100,1200,800); /* Couleur de la fenêtre */ EffacerEcran(CouleurParComposante(0,0,0)); ChoisirCouleurDessin(CouleurParComposante(141,199,63)); RemplirRectangle(10,10,1180,700); - /*Affichage du score*/ - ChoisirCouleurDessin(CouleurParComposante(255,255,255)); - EcrireTexte(10,760,"Score",2); - - /*Appartion du serpent*/ - - + /*Affichage du timer (timer Ok, mais pas l'affichage)*/ + ChoisirCouleurDessin(CouleurParComposante(255,255,255)); + while(1){ + EcrireTexte(10,760,timer,2); + t=(char)seconde; + y=(char)minute; + timer[0]= y; + timer[2]= t; + seconde=seconde+1; + if(seconde>=60){ + seconde=0; + minute=minute+1; + } + sleep(1); + } /* fermeture de la fenêtre */ Touche(); diff --git a/JEUX_SERPENT/timer.c b/JEUX_SERPENT/timer.c new file mode 100644 index 0000000..6a26dee --- /dev/null +++ b/JEUX_SERPENT/timer.c @@ -0,0 +1,20 @@ +#include +#include +#include + + +/*timer de base (à mettre plus tard dans un fichier makefile)*/ +int main(void){ + int seconde=0; + int minute=0; + + while(1) { + sleep(1); + seconde=seconde+1; + if(seconde>=60) { + seconde=0; + minute=minute+1; + } + } + return 0; +} \ No newline at end of file