From d5a3d1d6b9bae1c490cdb5744eddffc1cb5633a0 Mon Sep 17 00:00:00 2001 From: Simon Saye Babu Date: Wed, 30 Nov 2022 15:29:10 +0100 Subject: [PATCH] dessin --- DEV1.1/TP13/exercices_cercles.png | Bin 0 -> 1917 bytes DEV1.1/TP13/fenetre.c | 16 +++++ DEV1.1/TP13/formes.c | 64 +++++++++++++++++++ DEV1.1/random/ttt.c | 98 ++++++++++++++++++++++++++++++ 4 files changed, 178 insertions(+) create mode 100644 DEV1.1/TP13/exercices_cercles.png create mode 100644 DEV1.1/TP13/fenetre.c create mode 100644 DEV1.1/TP13/formes.c create mode 100644 DEV1.1/random/ttt.c diff --git a/DEV1.1/TP13/exercices_cercles.png b/DEV1.1/TP13/exercices_cercles.png new file mode 100644 index 0000000000000000000000000000000000000000..4713bcc6cc12c4aa22f8f79fdbb2b2d94ec4f5e6 GIT binary patch literal 1917 zcmV-@2ZH#CP)F#sGzjX$GsfD3h{4xO}W^n(IEzHJQ8H-XR#e3mjQTYvYt%l(#!W$%E z?9=Bs4G!wL1yLz52z6xX;?*tj%XnHz+25Tg%##DMnHO5gK7qJPpW^`9e))oG- zG9n|H!uLH=wCTt78&Lw*XG1!;PIk@)963-{IK!dEeqpl6AdCq+>o2v?8v0=jnE-%> zbss$HJGfr7(2W@S)+<@`(P}tu7?iF3>Z}O=P<5WOhZ7r zS0Dc{$^Q9ki?zK|Z9^PtU|fKCyDBuN1dHe4AVkzTRLYzL@8c(W%^6!h zHJ8XZG5NPhL@KQFewXu{?!H!uhhqH_Hdx@81VB!ULnhQeT%@VDLER&E9C`{^{C)}V zbXPE789g4aS%S$a#5&p~9*F!sVq$^!sJ?k!1R2{{PWkaJlW*c;!TL-F9DLvn2hG7{ zqnJq`4Vx69l^{HSj%V`BF)&D`yl)>ib~Pre()C_~rPf?fvu z{Am=4%m{&>+B33(F1cpbYNu|&fK3HnE|MlRcs&tXb(Y(POs#YO!eG6oj>Z*j=1Kj= zm?4GTZyv4I+=E-{;RoT+gP&x9J?*XQg4B*HO~0{4&QMsQ0KNFLgyF!hu-T=Nzaf+ za}Btd(!#^jo+~l4>e-tEx9ml6V;<#;_Thak<7m(Ej;i^zj>G6DLS+?jy0mfSN3 zTncVP7?$3Q*Y`GP>L3S!0})e_)BEm3_<8mAl40S_*bAcwAr#8}Ii&}Zk%@HIn>pX6 z=DVVH8&4G{oCc!@ZB!k6W&%i(%8ZvzJl>$wf*{>e9lfER*f(h~>dW!-1fEI-26G7l zL)Ppy@Zue+`t#l0ZOXL;7$b!{8l_WBFOxqgQ8ohgODm9tN8&xmDKAnAn})jPfgKw( zDI<8(b-*MF-8tJsg*u_&CtIAHV>>UxbKCBFdlx%_iG6KTgBj8IT#u01n8Um?rj%sK zI%r}7FZK!0T(-!FEhg=#KIMnuGswA^XYMn77dh&j5EK_c4}o=BHpUMz9s`ocNlq$M zZxa>94#I@s4OfK1*v>mbLU&@B=(ORMh{9eo$=&aLPTf=+%+Axq3BL#0}XT7lp^6cjoDp0Gs;e4fJAiR7EJebLXdyWWvfEu +#include +#include + +int main(int argc, char const *argv[]) +{ + InitialiserGraphique(); + CreerFenetre(10,10,480,270); + while(!SourisCliquee()); + FermerGraphique(); + + return 0; + + + +} \ No newline at end of file diff --git a/DEV1.1/TP13/formes.c b/DEV1.1/TP13/formes.c new file mode 100644 index 0000000..2f5b903 --- /dev/null +++ b/DEV1.1/TP13/formes.c @@ -0,0 +1,64 @@ +#include +#include +#include + +void carre(int x,int y) +{ + DessinerSegment(x-25,y-25,x+25,y-25); + DessinerSegment(x+25,y-25,x+25,y+25); + DessinerSegment(x+25,y+25,x-25,y+25); + DessinerSegment(x-25,y+25,x-25,y-25); +} + +void cercle(int x,int y) +{ + couleur c; + c=CouleurParComposante(0,255,0); + ChoisirCouleurDessin(c); + RemplirArc(x-30,y-30,60,60,0,360); +} + +void txtface(int x, int y) +{ + couleur c; + c=CouleurParComposante(255,0,255); + ChoisirCouleurDessin(c); + EcrireTexte(x-25,y+7,">o<",2); +} + + + + +int main(int argc, char const *argv[]) +{ + InitialiserGraphique(); + CreerFenetre(10,10,480,270); + int touche; + while(touche!=XK_space) + { + touche=Touche(); + SourisPosition(); + if(touche==XK_a) + { + carre(_X,_Y); + } + if(touche==XK_z) + { + cercle(_X,_Y); + } + if(touche==XK_e) + { + txtface(_X,_Y); + } + if(touche==XK_r) + { + ChargerImage("exercices_cercles.png",_X-45,_Y+15,0,0,103,36); + } + } + FermerGraphique(); + + return 0; + + + +} \ No newline at end of file diff --git a/DEV1.1/random/ttt.c b/DEV1.1/random/ttt.c new file mode 100644 index 0000000..b4b8e5d --- /dev/null +++ b/DEV1.1/random/ttt.c @@ -0,0 +1,98 @@ +#include +#include +#include + +void Croix(int c,int l) +{ + DessinerSegment(20+300*c,20+300*l,280+300*c,280+300*l); + DessinerSegment(280+300*c,20+300*l,20+300*c,280+300*l); + return; +} + +void Cercle(int c, int l) +{ + DessinerArc(300*c+20,300*l+20,260,260,0,360); + return; +} + +int victoire(int tab[3][3]) +{ + int full=0; + for(int i=0;i<3;i++) + { + for(int j=0;j<3;j++) + if (tab[i][j]==0) + { + full++; + } + } + for(int i=0;i<3;i++) + { + if (tab[i][0]==tab[i][1]&&tab[i][1]==tab[i][2]) + { + if (tab[i][0]!=0) + { + return(1); + } + } + } + if (full==9) + { + return(-1); + } + else{return(0);} +} + +int main(int argc, char const *argv[]) +{ + int x=_X; + int y=_Y; + + InitialiserGraphique(); + CreerFenetre(10,10,900,900); + DessinerSegment(300,0,300,900); + DessinerSegment(600,0,600,900); + DessinerSegment(0,300,900,300); + DessinerSegment(0,600,900,600); + int l,c; + int tab[3][3]={0}; + int tour=1; + int vic=0; + while(vic==0) + { + while(!SourisCliquee()); + l=_Y/300; + c=_X/300; + if (tab[c][l]==0) + { + if ((tour%2)==0) + { + Croix(c,l); + tab[c][l]=1; + } + else + { + Cercle(c,l); + tab[c][l]=2; + } + tour++; + } + vic=victoire(tab); + } + + if (vic==-1) + { + printf("Egalité !"); + } + if (vic=1&&(tour%2)==0) + { + printf("Victoire Croix !"); + }else{ + printf("Victoire Cercle !"); + } + + + Touche(); + FermerGraphique(); + return 0; +} \ No newline at end of file