Home › Forums › C Programming › animation
- This topic has 2 replies, 2 voices, and was last updated 17 years, 6 months ago by dham.
- AuthorPosts
- May 21, 2007 at 2:53 am #1974dhamParticipant
please help me.i must write the programm using function and pointer,that should be shown like animation.please send me animation code.it can be simple.
- May 21, 2007 at 9:05 am #3227willParticipant
Hello
Here is a portion of a program for “Bank managgement system” which I worte while I was in my Bachelors of IT. To make an animation in C Language you will need to create the image at run time and move that image on the screen. What i have done is created a bitmap using circles, arcs & different colors, and tried to make some sort of a logo, then put the whole graphics area in an image using getimage() function & used putimage() to show the image on the screen. To make an animation in C Language I have put this image in a loop which animates the image on the screen in scrolling mode.123for(int count=1;count<300;count+=2){<br />putimage(1+count,100,image,COPY_PUT);<br />}
Also I have made another animation which makes a complete line from a single point.12345for(int down=0;down<640;++down)<br />{<br />delay(5);<br />line(1,220,1+down,220);<br />}
And at the end I have made another animation effect using the line() function again.123for(int bottom=0;bottom<300;bottom+=4)<br />line(1,220+bottom,640,220+bottom);<br />
Below is the main source code of the complete animation. You can modify it according to your needs.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455#include<iostream.h><br />#include<conio.h><br />#include<graphics.h><br />#include<alloc.h><br />#include<dos.h><br />#include<fstream.h><br />#include<stdlib.h><br />#include<string.h><br />void main(void){<br />void *image;<br />int size;<br />int dr=9,mode=2;<br />initgraph(&dr,&mode,"..\bgi");<br />size=imagesize(140,140,500,250);<br />image=malloc(size);<br />setfillstyle(SOLID_FILL,GREEN);<br />circle(200,200,50);<br />floodfill(200,200,WHITE);<br />setcolor(LIGHTGRAY);<br />circle(200,200,19);<br />setcolor(WHITE);<br />circle(200,200,18);<br />circle(200,200,49);<br />circle(200,200,53);<br />circle(200,200,20);<br /><br />arc(215,215,350,90,30);<br />arc(210,182,90,194,30);<br />arc(180,195,180,300,30);<br />settextstyle(1,HORIZ_DIR,1);<br />setcolor(LIGHTGRAY);<br />outtextxy(270,180,"National Bank");<br /><br />outtextxy(270,185,"___________________");<br />outtextxy(270,210,"Of Pakistan Pvt Ltd.");<br />settextstyle(0,HORIZ_DIR,0);<br />setcolor(DARKGRAY);<br />outtextxy(270,240,"COPYRIGHT 2002");<br />getimage(141,141,499,259,image);<br />cleardevice();<br />for(int count=1;count<300;count+=2)<br />putimage(1+count,100,image,COPY_PUT);<br />for(int down=0;down<640;++down)<br />{<br />delay(5);<br />line(1,220,1+down,220);<br />}<br />setcolor(BLUE);<br />for(int bottom=0;bottom<300;bottom+=4)<br />line(1,220+bottom,640,220+bottom);<br />free(image);<br />getch();<br />closegraph();<br />}<br /> - May 21, 2007 at 8:29 pm #3228dhamParticipant
thank you very much.
but i need to do that on Turbo C.and which should be simple.
just using function and pointer and time duration.
just using characters like walking man,i want to do basketball player who threw the ball and ball enters goal.
- AuthorPosts
- The forum ‘C Programming’ is closed to new topics and replies.