Dev C++ Bouncy Ball
Source Code For Bouncing Ball In 3d Using Opengl Codes and Scripts Downloads Free. Accounting source code for Delphi. Metis is an open source project management module developed in PHP using MySQL for a database backend.
In this program, we will draw a red color ball move it vertically up and down like a bouncing ball. We will use below mentioned functions in this program.
Function | Description |
---|---|
initgraph | It initializes the graphics system by loading the passed graphics driver then changing the system into graphics mode. |
getmaxx | It returns the maximum X coordinate in current graphics mode and driver. |
setcolor | It changes the current drawing colour. Default colour is white. Each color is assigned a number, like BLACK is 0 and RED is 4. Here we are using colour constants defined inside graphics.h header file. |
setfillstyle | It sets the current fill pattern and fill color. |
circle | It draws a circle with radius r and centre at (x, y). |
floodfill | It is used to fill a closed area with current fill pattern and fill color. It takes any point inside closed area and color of the boundary as input. |
cleardevice | It clears the screen, and sets current position to (0, 0). |
kbhit | It is used to determine whether a key is pressed or not. It returns a non-zero value if a key is pressed otherwise zero. |
delay | It is used to suspend execution of a program for a M milliseconds. |
closegraph | It unloads the graphics drivers and sets the screen back to text mode. |
C program for bouncing ball graphics animation
In this program, we first draw a red color ball on screen having center at (x, y) and then erases it using cleardevice function. We again draw this ball at center (x, y + 5), or (x, y - 5) depending upon whether ball is moving down or up. This will look like a bouncing ball. We will repeat above steps until user press any key on keyboard.
Program OutputDev C++ Bouncy Ball Video
Here is the screenshot of bouncing ball.Related Topics
C graphics program for moving car animation |
C program to draw pie chart using graphics |
C program to draw sine wave graph on screen |
C program to draw 3D bar graph on screen |
C graphics program to draw digital clock |
C Program to draw concentric circles screen |
C Program to draw a hut using graphics |
List of all C Graphics Programs |
hi guys,
i am working on a new java program, the program consists of a ball, bouncing around the applet, i have created button to control the ball, one to stop the ball bouncing, another to resume the ball boucing and another to reverse the direction of the ball bouncing,
but i am trying to re-design the buttons so that i can steer the direction of ball / drag the ball with the mouse around the applet.
the code so far is below...
any advice and help, would be appreciated a lot.....
thx for your time,
tc..
- 4 Contributors
- forum 8 Replies
- 896 Views
- 2 Years Discussion Span
- commentLatest Postby jadhav vijayLatest Post