Posts

How To Create Flying Kite Animation in C Or C++ (Computer Graphics)

Image
                                                                                        PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON FLYING KITE ANIMATION SOURCE CODE: #include<stdio.h> #include<dos.h> #include<graphics.h> void main() {     int gd=DETECT,gm;     int color;     int x=10,y=1,inc_x=10,inc_y=10;     int poly[10];     initgraph(&gd,&gm,"C:\\TC\\BGI");     while(!kbhit())     {         x += inc_x;         if(x > getmaxx()-175)             inc_x = -5; if(x < 0 )     inc_x = 10; y += inc_y; if(y > 200)     inc_y = -10; if(y < 0 )     inc_y = 10; cleardevice(); setcolor(WHITE); setbkcolor(LIGHTBLUE); poly[0]=100+x; poly[1]=50+y; poly[2]=140+x; poly[3]=100+y; poly[4]=100+x; poly[5]=155+y; poly[6]=60+x; poly[7]=100+y; poly[8]=100+x; poly[9]=50+y; drawpoly(5,poly); setfillstyle(SOLID_FILL,GREEN); fillpoly(5,poly); setcolor(BLUE); setlinestyle(SOLID_LINE,1,3); line(100+x,155+y,100+x,3

How To Create Concentric Ellipse Animation in C Or C++ (Computer Graphics)

Image
                                                                                         PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON CONCENTRIC ELLIPSE ANIMATION SOURCE CODE: #include<stdio.h> #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> void main() { int i,r1,r2,n,j=2,xr=200,yr=100; int gd=DETECT,gm; initgraph(&gd,&gm,"C:\\TC\\BGI"); printf("Enter The No. of Ellipse:"); scanf("%d",&n); r1=xr/n; r2=yr/n; for(i=0;i<n;i++) { setfillstyle(1,j); ellipse(300,200,0,360,xr,yr); if(j==10) j=2; xr=xr-r1; yr=yr-r2; j++; } getch(); }

How To Create Circles in Circles Animation in C Or C++ (Computer Graphics)

Image
                                                                                        PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON CIRCLES IN CIRCLE ANIMATION SOURCE CODE: #include<graphics.h> #include<conio.h> #include<dos.h>   main() {    int gd = DETECT, gm, x, y, color, angle = 0;    struct arccoordstype a, b;      initgraph(&gd, &gm, "C:\\TC\\BGI");    delay(2000);    while(angle<=360)    {       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,100);       setcolor(YELLOW);       getarccoords(&a);       circle(a.xstart,a.ystart,25);       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,150);       getarccoords(&a);       setcolor(GREEN);       circle(a.xstart,a.ystart,25);       setcolor(BLACK);       arc(getmaxx()/2,getmaxy()/2,angle,angle+2,50);       setcolor(RED);       getarccoords(&a);       circle(a.xstart,a.ystart,25);       angle = angle+5;       delay(50);    }    getch();    closegraph(

How To Create a Restrict Mouse Pointer In a Circle in C Or C++ (Computer Graphics)

Image
                                                                                       PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON RESTRICT MOUSE POINTER IN A CIRCLE SOURCE CODE: #include<graphics.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<math.h> union REGS i, o; int initmouse() {    i.x.ax = 0;    int86(0X33, &i, &o);    return ( o.x.ax ); } void showmouseptr() {    i.x.ax = 1;    int86(0X33, &i, &o); } void hidemopuseptr() {    i.x.ax = 2;    int86(0X33, &i, &o); } void getmousepos(int *x, int *y) {    i.x.ax = 3;    int86(0X33, &i, &o);    *x = o.x.cx;    *y = o.x.dx; } void movemouseptr(int x, int y) {    i.x.ax = 4;    i.x.cx = x;    i.x.dx = y;    int86(0X33, &i, &o); } main() {    int gd = DETECT, gm, midx, midy, radius, x, y, tempx, tempy;    radius = 100;    initgraph(&gd, &gm, "C:\\TC\\BGI");    if(!initmouse())    {       closegraph();       exit(1);    }    midx =

How To Draw Parachute Animation in C Or C++ (Computer Graphics)

Image
                                                                                     PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON PARACHUTE ANIMATION SOURCE CODE: #include <stdio.h> #include <conio.h> #include <graphics.h> #include <dos.h>   int main() {         /* request auto detection */         int gdriver = DETECT, gmode, err;         int i, x, y;         /* initialize graphic mode */         initgraph(&gdriver, &gmode, "C:/TURBOC3/BGI");         err = graphresult();         if (err != grOk) {                 /* error occurred */                 printf("Graphics Error: %s",                                 grapherrormsg(err));                 return 0;         }         x = 50;         y = getmaxy() - 100;         for (i = 0; i < 900; i++) {                 /* drawing the balloon first */                 setcolor(LIGHTRED);                 setfillstyle(SOLID_FILL, LIGHTRED);                 arc(x, y, 0, 180, 40);                

How To Draw Helicopter Animation in C Or C++ (Computer Graphics)

Image
                                                                                                PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON HELICOPTER ANIMATION SOURCE CODE: #include<conio.h> #include<graphics.h> #include<dos.h> //Animation void Helicopter(); void Go(); void main() {   clrscr();   int gd=DETECT, gm;   initgraph(&gd, &gm,"C://TC//BGI");   Go();   Helicopter();   getch();   closegraph(); } //This Go is only to make it stand for some time  void Go(){ //...........     For Background   .........  for(int l=0;l<50;l++){   int b=0;                                      //Speed of y-axis of helicoptor   int c=0;                                      //Speed of x-axis of helicoptor  // Helicopter   line(216+c,235-b,75+c,235-b);   line(115+c,247-b,120+c,240-b);           //UpperBackSmallInclinedLine   line(166+c,247-b,161+c,240-b);            //UpperFrontSmallInclinedLine   line(120+c,240-b,161+c,240-b);                //UpperHorizontallLIne

How To Draw Cosine Wave Animation in C Or C++ (Computer Graphics)

Image
                                                                                          PROJECT BY (SIMPLIFY LEARN PROGRAMMING)  ON COSINE WAVE ANIMATION SOURCE CODE: #include <conio.h> #include <math.h> #include <graphics.h> #include <dos.h>   void main() {     int gd = DETECT, gm;     int angle = 0;     double x, y;       initgraph(&gd, &gm, "C:\\TC\\BGI");    line(0, getmaxy() / 2, getmaxx(), getmaxy() / 2);  /* generate a sine wave */  for(x = 0; x < getmaxx(); x+=3) {        /* calculate y value given x */      y = 50*sin(angle*3.141/180);      y = getmaxy()/2 - y;        /* color a pixel at the given position */   putpixel(x, y, 15);   delay(100);     /* increment angle */   angle+=5;  }    getch();    /* deallocate memory allocated for graphics screen */  closegraph();    return 0; }