Click & Register in this...
Click & Register in this..... enjoy earning easily..
Register in this...... earn easily $$$$$$$$$$$$ Earn upto Rs. 9,000 pm checking Emails. Join now! - sunny

Tuesday, July 13, 2010

c graphics program for commonweakth games Delhi 2010

/Author : Srikanth Noundla
//Email ID : sicetece@gmail.com
//Web Site : sicetece.blogspot.com

/*An advertisment for Commonwealth Games Delhi 2010
Official sponserer: Hero Honda */


#include
#include
#include
#include
#include
#define PI 3.1415


heli_draw(int,int,int);


//Draws & moves wheel
void rotate_wheel(int xc,int yc,int t)
{
int x,y,i;
setcolor(random(16));
for(t=t;t<180;t=t+60)
{
x=30*cos(t*PI/180);
y=30*sin(t*PI/180);
line(xc+x,yc+y,xc-x,yc-y);
}
for(i=0;i<5;i++)
{
setcolor(random(16));
circle(xc,yc,10+i);
}
setcolor(8);
circle(xc,yc,30);
circle(xc,yc,32);
circle(xc,yc,34);
circle(xc,yc,35);
circle(xc,yc,36);
}

//Draws Ashoka wheel
void ashoka_wheel(int xc,int yc,int t)
{
int x1,y1,x2,y2,x3,y3;

setcolor(BLUE);
for(t=t;t<180;t=t+60)
{
x1=15*cos(t*PI/180);
y1=15*sin(t*PI/180);
x2=15*cos(500+t*PI/180);
y2=15*sin(500+t*PI/180);
x3=15*cos(2000+t*PI/180);
y3=15*sin(2000+t*PI/180);
line(xc+x1,yc+y1,xc-x1,yc-y1);
line(xc+x2,yc+y2,xc-x2,yc-y2);
line(xc+x3,yc+y3,xc-x3,yc-y3);

}
circle(xc,yc,15);
circle(xc,yc,16);
circle(xc,yc,17);
}

//Draws flag
void flag(int i)
{
setfillstyle(SOLID_FILL,BROWN);
bar(i,50,100,100);
setfillstyle(SOLID_FILL,WHITE);
bar(i,90,100,130);
setfillstyle(SOLID_FILL,GREEN);
bar(i,130,100,170);
}

//Draws helicopter at given location and direction
heli_draw ( int x, int y, int d )
{
int direction, i, j ;

setcolor(LIGHTBLUE);

sound(50);
delay(10);
nosound();
if ( d )
direction = -1 ;
else
direction = 1 ;

i = 3 ;
j = 8 ;

line ( x - j - 8, y - i - 2, x + j + 8, y - i - 2 ) ;
line ( x - j + 5, y - i - 1, x + j - 5, y - i - 1 ) ;
line ( x - j, y - i, x + j, y - i ) ;
for ( ; i > 0 ; i--, j += 2 )
{
putpixel ( x - ( direction * j ), y - i, 1 ) ;
line ( x + ( direction * j ), y - i, x + ( direction * ( j - 8 ) ), y - i ) ;
}

i = 0 ;
j -= 2 ;

line ( x - ( direction * j ), y - i, x - ( direction * ( j + 17 ) ), y - i ) ;
line ( x - ( direction * j ), y - i + 1, x - ( direction * ( j + 7 ) ), y - i + 1 ) ;
putpixel ( x - ( direction * ( j + 19 ) ), y - i - 1, 1 ) ;

for ( ; i < 3 ; i++, j -= 2 )
{
putpixel ( x - j, y + i, 1 ) ;
putpixel ( x + j, y + i, 1 ) ;
}

line ( x - j, y + i, x + j, y + i ) ;
putpixel ( x - j + 3, y + i + 1, 1 ) ;
putpixel ( x + j - 3, y + i + 1, 1 ) ;
line ( x - j - 10, y + i + 2, x + j + 10, y + i + 2 ) ;
putpixel ( x + ( direction * ( j + 12 ) ), y + i + 1, 1 ) ;
return 0;
}

void cwg_logo()
{
int i;
setcolor(BLUE);
settextstyle(TRIPLEX_FONT,0,2);
outtextxy(478,89,"DELHI 2010");
for(i=0;i<50;i++)
{
delay(i);
}
settextstyle(SMALL_FONT,0,4);
outtextxy(471,112,"XIX COMMONWEALTH GAMES");
for(i=0;i<50;i++)
{
delay(i);
}
setcolor(YELLOW);
setfillstyle(SOLID_FILL,YELLOW);
pieslice(538,170,85,95,30);
setcolor(RED);
setfillstyle(SOLID_FILL,RED);
pieslice(527,164,85,95,24);
setcolor(LIGHTBLUE);
setfillstyle(SOLID_FILL,LIGHTBLUE);
pieslice(548,164,85,95,24);
setcolor(8);
for(i=0;i<=10;i++)
{
ellipse(520,140,180,270,30-i,18);
ellipse(555,140,270,360,30-i,18);
}
setfillstyle(SOLID_FILL,8);
bar(480,127,595,131);
setcolor(BLUE);
settextstyle(SMALL_FONT,0,2);
outtextxy(503,175,"COME OUT AND PLAY");
for(i=0;i<50;i++)
{
delay(i);
}
setcolor(8);
for(i=0;i<3;i++)
{
circle(535,130,74);
circle(535,130,80-i);
}
}

void main()
{
int d=0,m=0,x,y,i,h1,h2,dl;
initgraph(&d,&m,"c:\\tc\\bgi");
setbkcolor(0);
clrscr();


setcolor(LIGHTGREEN);
outtextxy(70,200,"Commonwealth Games");
outtextxy(70,210,"Delhi 2010");
outtextxy(70,220,"81 seconds");
outtextxy(70,230,"Young Indian creations");
outtextxy(70,240,"11 07 2010");
for(dl=0;dl<100;dl++)
{
delay(dl);
}
cleardevice();
settextstyle(SANS_SERIF_FONT,0,2);
outtextxy(150,90,"My sincere thanx to my encouraged friends");
settextstyle(DEFAULT_FONT,0,1);
outtextxy(150,125,"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
for(dl=0;dl<55;dl++)
{
delay(dl);
}
outtextxy(280,140,"S.Sinivas Rao sir");
outtextxy(280,155,"ShivaRam");
outtextxy(280,170,"SaiKrishna");
outtextxy(280,185,"Gopika");
outtextxy(280,200,"Divyanand");
outtextxy(280,215,"Sridhar");
outtextxy(280,235,"And all my friends");
for(dl=0;dl<100;dl++)
{
delay(dl);
}
cleardevice();
settextstyle(SANS_SERIF_FONT,0,2);
outtextxy(150,120,"My special thanx to my dear bro.");
settextstyle(GOTHIC_FONT,0,6);
outtextxy(230,170,"sunny");
settextstyle(DEFAULT_FONT,0,1);
for(dl=0;dl<90;dl++)
{
delay(dl);
}
setpalette(0,7);
//draws n moves Hero Honda
for(x=0;x<740;x++)
{

setcolor(8);
rotate_wheel(x,230,x%60);
delay(5);
rotate_wheel(x,230,x%60);
rotate_wheel(x-120,230,x%60);
setfillstyle(BKSLASH_FILL,random(16));//Petrol tank
setcolor(8);
fillellipse(x-30,175,40,20);
setcolor(WHITE);
//Engine
//{
circle(x-60,215,18);
circle(x-60,215,17);
circle(x-60,215,15);
circle(x-60,215,13);
circle(x-60,215,5);
//}
setcolor(random(16));
outtextxy(x-80,205,"HERO");
outtextxy(x-80,215,"HONDA");
for(i=0;i<4;i++)
{
ellipse(x-25,160,0,85,30-i,40-i);

}
//seat
setcolor(8);
setfillstyle(SOLID_FILL,8);
fillellipse(x-118,185,55,12);
pieslice(x-150,195,80,230,23);
pieslice(x-70,180,70,170,9);
setfillstyle(SOLID_FILL,8);//HEAD LIGHT
setcolor(random(16));
pieslice(x+20,155,80,275,20);
setfillstyle(SOLID_FILL,random(16));
fillellipse(x-120,230,45,7);
for(i=0;i<3;i++)
{
ellipse(x-160,175,0,180,5-i,25-i);
}

for(i=0;i<4;i++)
{
setcolor(random(16));
ellipse(x+30,170,76,180,25-i,45-i);

}
delay(5);
cleardevice();
rotate_wheel(x-120,230,x%60);

}
for(i=620;i>=205;i--)
{
rotate_wheel(i,230,i%60);
delay(10);
cleardevice();
rotate_wheel(i,230,i%60);
if(i>=300)
{
flag(i);
}
flag(300);
}
for(y=i;y>=110;y--)
{
rotate_wheel(i,y,y%60);
delay(10);
cleardevice();
flag(300);
rotate_wheel(i,y,y%60);

}
cleardevice();
flag(300);
ashoka_wheel(i,y,y%60);
for(h1=0,h2=550;h1<550;h1=h1+2,h2=h2-2)
{
heli_draw(h1,30,0);
heli_draw(h2,30,1);
delay(10);
cleardevice();
flag(300);
ashoka_wheel(i,y,y%60);
}
flag(300);
ashoka_wheel(i,y,y%60);
for( ;h2<550;h1=h1-2,h2=h2+2)
{
heli_draw(h1,30,1);
heli_draw(h2,30,0);
delay(10);
cleardevice();
flag(300);
ashoka_wheel(i,y,y%60);
}
flag(300);
ashoka_wheel(i,y,y%60);
for(dl=0;dl<45;dl++)
{
delay(dl);
}
settextstyle(DEFAULT_FONT,0,2);
setcolor(GREEN);
outtextxy(362,348,"DHAK DHAK GO");
setcolor(RED);
outtextxy(360,350,"DHAK DHAK GO");
for(dl=0;dl<35;dl++)
{
delay(dl);
}
cwg_logo();
for(dl=0;dl<35;dl++)
{
delay(dl);
}
settextjustify(CENTER_TEXT,CENTER_TEXT);
setcolor(RED);
settextstyle(SANS_SERIF_FONT,0,1);
outtextxy(120,300,"Chalo");
for(dl=0;dl<35;dl++)
{
delay(dl);
}
setcolor(WHITE);
settextstyle(GOTHIC_FONT,0,6);
outtextxy(130,330,"INDIA");
for(dl=0;dl<35;dl++)
{
delay(dl);
}
setcolor(GREEN);
settextstyle(SANS_SERIF_FONT,0,1);
outtextxy(120,370,"Chalo");
for(dl=0;dl<80;dl++)
{
delay(dl);
}
cleardevice();
setbkcolor(8);
settextjustify(LEFT_TEXT,LEFT_TEXT);
settextstyle(SANS_SERIF_FONT,0,6);
setcolor(RED);
outtextxy(20,100,"Proud");
setcolor(WHITE);
outtextxy(20,180,"To be");
setcolor(GREEN);
settextstyle(GOTHIC_FONT,0,13);
outtextxy(20,350,"An Indian");
for(dl=0;dl<90;dl++)
{
delay(dl);
}
cleardevice();
setbkcolor(0);
setcolor(LIGHTCYAN);
settextstyle(SANS_SERIF_FONT,0,5);
outtextxy(120,180,"Come out and play");
for(dl=0;dl<30;dl++)
{
delay(dl);
}
setcolor(YELLOW);
settextstyle(SANS_SERIF_FONT,0,7);
outtextxy(120,300,"Dhak Dhak Go");
for(dl=0;dl<55;dl++)
{
delay(dl);
}
cleardevice();
setcolor(LIGHTGREEN);
settextstyle(SANS_SERIF_FONT,0,4);
outtextxy(140,200,"Created by");
settextstyle(SANS_SERIF_FONT,0,5);
outtextxy(140,250,"Srikanth Noundla");
getch();
closegraph();
}

1 comment: