Flying Bird using Computer graphics in C/C++
In computer graphic, C++ provide graphic.h through which objects can be created and by using this objects flying bird can be created in C++ program.
Functions used in this program are as follows:
- line(): The line function is used to draw a line.
line(x1, y1, x2, y2);
where, (x1, y1) (x2, y2) are end points of the line.
- arc(): The arc function is used to draw an arc.
arc(x, y, start_angle, end_angle, r);
where, (x, y) are centre of the arc, start_angle is the starting angle, end_angle is the ending angle and r is the radius of angle.
- circle(): The circle function is used to draw a circle.
circle(x, y, r);
where, (x, y) is the centre points and r is the radius of the circle.
- delay(): The delay function is used to stop the screen for a certain time as the execution of program is very fast.
where, n is number of seconds you want to stop the screen.
- cleardevice(): The cleardevice function is used to clear the screen.
- closegraph(): The closegraph function is used to close the graph.
Below is the C++ program implementing flying bird using graphics.h: