From 33fd06032a9bb084b77e6ecb4d82af5c53e6b121 Mon Sep 17 00:00:00 2001 From: Axel Date: Mon, 28 Nov 2022 10:02:00 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20d'un=20mode=20triche=20on/off?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test.c b/test.c index 14d12b7..d66688f 100644 --- a/test.c +++ b/test.c @@ -4,15 +4,29 @@ int main(void){ int i,j; + int x=1; + int touche; InitialiserGraphique(); CreerFenetre(10,10,1000,1000); ChoisirCouleurDessin(CouleurParComposante(255,0,0)); - for (i=1;i<6;i+=1){ - for (j=1;j<6;j+=1){ - RemplirRectangle(i*100,j*100,50,50); + while(1){ + if (ToucheEnAttente()){ + touche = Touche(); + if (touche == XK_t) + x = -x; + if (x==-1){ + EffacerEcran(CouleurParComposante(255,255,255)); + ChoisirCouleurDessin(CouleurParComposante(255,0,0)); + EcrireTexte(10,10,"mode triche",2); + } + if (x==1){ + EffacerEcran(CouleurParComposante(255,255,255)); + + } + if (touche == XK_space) + break; } } - Touche(); FermerGraphique(); return EXIT_SUCCESS; }