# Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

### Dark GDK / Expanding a circle for 120 frames

Message
Posted: 23rd Apr 2015 01:59
I have an assignment that I have been working on. I am creating BoomShine, and we need to be able to expand a circle for 2 seconds. My framerate is 60 frames per second, so I would need to expand the circle for 120 frames. I am unsure how to do this, also since there is no fill function for the circle I have created my own function to do so which is as follows:
[code void ACircle::drawFilled () const
{
for (int count = 1; count <= mRadius; count++)
{
DWORD name = dbRGB (mColor.getRed(),
mColor.getGreen(),
mColor.getBlue());
dbInk (name, name);
dbCircle (mXCenter, mYCenter, count);
}
}]

If there is any way that someone could help me that'd be great.
Posted: 24th Apr 2015 20:48
Do you need filled circle? -- No problems! Use Cloggy'sD3D!

Go to http://www.dbdepot.co.uk/d3dfunc.html
Unpack and drop "D3DFunc.h" and "D3DFunc.lib" into your project's folder.
In your game wright: #include "D3DFunc.h"
Then you can use this functions with iFilled=1 (and many other usefull functions):

void d3dCircle ( int iX, int iY, float fRadius, int iFilled );
void d3dCircle ( int iX, int iY, float fRadius, int iFilled, DWORD dwColour );
void d3dEllipse ( int iX, int iY, float fRadiusX, float fRadiusY, int iFilled );
void d3dEllipse ( int iX, int iY, float fRadiusX, float fRadiusY, int iFilled, DWORD dwColour );
Posted: 9th May 2015 18:46
Or if you're interested in actually writing the function yourself seeing to how it is an assignment (presumably for school?), drawing a filled circle can be donw by iterating over every pixel in a square where the side is the diameter of the circle. You then check each pixel's distance from the center of this square (d^2 = x^2 + y^2) and if it is less or equal to the radius of the circle you set that pixel to whatever fill colour you want for the circle, otherwise you leave it be.

Note however that doing this using the dbDot() function will be very slow for larger circles.
If you want to do it this way I'd suggest either making a memblock image or to manipulate the pixel data of an image directly.