usingMaths.com
Demonstrating and showing pupils and students one application of Mathematics.







<< PreviousNext >>

Code to Animate a Body (Circle) Across the Window Frame in C++




How to Draw on the C++ Window Frame

We'll will draw a circle - our body - using the Ellipse method with a HDC context.



Animating a Body

To make the circle appear to move across the canvas, i.e., animate the circle, we'll simply draw the circle repeatedly, changing its position progressively as well as clearing the previous image.

Create 2 new class files;
Call them Facet and MovingBody.
Type out the adjoining C++ code for animating an image body across the window frame.



Note: The code module for our Dymetric class was too big to be squeezed in with the others.
But not to worry; it, as well as the Facet class header file(Facet.h), will remain the same for the rest of the demonstrations in this category, hence will be left out hence forth.










<< PreviousNext >>