void pinceau(){ POINT p,p1; int test=0,hauteur=option*2,i; p=position_souris(); while(bouton_appuye(CLIC_GCH)==true || bouton_appuye(CLIC_DRT)==true){ p1=p; if(test==0){p1.x-=LARGEUR_MENU;p1.y-=LARGEUR_MENU;test++;} p=position_souris(); if(bouton_appuye(CLIC_GCH)==true) { for(i=hauteur;i>=0;i--){ cercle(p,i,colour.pri); } } else if(bouton_appuye(CLIC_DRT)==true) { for(i=hauteur;i>0;i--){ cercle(p,i,colour.sec); } } p.x-=LARGEUR_MENU;p.y-=LARGEUR_MENU; if(bouton_appuye(CLIC_GCH)==true) { dessine_ligne_image(p,p1,colour.pri); } else if(bouton_appuye(CLIC_DRT)==true) { dessine_ligne_image(p,p1,colour.sec); } affichage_interface_fonction(); } }
void deuxCercles (int x, int y, int r){ if (r>10){ cercle(x,y,r); int pr=r/2; deuxCercles(x+pr,y,pr); deuxCercles(x-pr,y,pr); } }
void troisCercles(int x, int y, int r){ if(r>10){ cercle(x,y,r); int pr= (int) ((2*sqrt(3.0)-3)*r); int h=r-pr; troisCercles(x-h,y,pr); troisCercles(x+h/2,y+pr,pr); troisCercles(x+h/2,y-pr,pr); } }
void mainFunction( void ) { graphWin.drawAxes(); RectangleV1 rec(-2,2,4,2); rec.draw(); CircleV1 cercle(0,0,1,300); cercle.draw(); TriangleV1 triangle(2.0,2.0,1.0,3.0,2.0,1.0); triangle.draw(); SquareV1 square(2.0,2.0,0.5); square.draw(); }
void init(tab cmd){ if (!strcmp(cmd, "addition")) { int a,b; printf("Enter two integers :\n"); scanf("%d %d", &a, &b); printf("%d + %d = %d \n", a, b, addition(a, b)); } else if (!strcmp(cmd, "pgcd")) { int a,b; printf("Enter two integers :\n"); scanf("%d %d", &a, &b); printf("pgcd (%d, %d) = %d \n", a, b, pgcd(a, b)); } else if (!strcmp(cmd, "somme")) { int a; printf("Enter one integer :\n"); scanf("%d", &a); printf("Somme des %d premiers entiers = %d \n", a, somme(a)); } else if (!strcmp(cmd, "factorielle")) { int a; printf("Enter one integers :\n"); scanf("%d", &a); printf("(%d)! = %d \n", a, factorielle(a)); } else if (!strcmp(cmd, "puissance")) { float a,b; printf("Enter two floats :\n"); scanf("%f %f", &a, &b); printf("(%g ^ %g) = %g \n", a, b, puissance(a, b)); } else if (!strcmp(cmd, "isocele")) { int a; printf("Enter one integer :\n"); scanf("%d", &a); isocele(a); } else if (!strcmp(cmd, "cercle")) { int a; printf("Enter one integer :\n"); scanf("%d", &a); cercle(a); } else { printf("Command not found \n"); printf("Running listAll ... ? \n"); } return ; }
void dessin_asteroides(liste_asteroide *asteroides) { while(asteroides != NULL){ if(asteroides->asteroide.position.x < 400 && asteroides->asteroide.position.x > -400 && asteroides->asteroide.position.y < 400 && asteroides->asteroide.position.y > -400){ int rand1 = (rand() % (100 + 1)); float frand1 = rand1/100.0; glPushMatrix(); glColor3f(1,frand1,0); glTranslatef(asteroides->asteroide.position.x, asteroides->asteroide.position.y, 0); glScalef(40, 40, 1); cercle(30, 1); glPopMatrix(); } asteroides = asteroides->suivant; } }
void gomme(){ POINT p,p1; int test=0; p=position_souris(); int hauteur=2*option,i; while(bouton_appuye(CLIC_GCH)==true){ p1=p; if(test==0){p1.x-=LARGEUR_MENU;p1.y-=LARGEUR_MENU;test++;} p=position_souris(); for(i=hauteur;i>0;i--){ cercle(p,i,blanc); } p.x-=LARGEUR_MENU;p.y-=LARGEUR_MENU; dessine_ligne_image(p,p1,blanc); affichage_interface_fonction(); } }