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 / Solution for making circles visible and filled

Author
Message
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 24th Sep 2009 20:57 Edited at: 25th Sep 2009 08:32
I searched for a substitute circle- and ellipse-drawing method to ease the pain of those who don't see anything on the screen when they call dbCircle or dbEllipse. The main purpose was to draw an outline using only dbLine commands. As a second thought, it occurred to me that it would be easy to parameterize the function to draw both filled and unfilled shapes.

I chose a Bresenham-type algorythm which is an accepted method of drawing rasterized shapes, avoiding sine/cosine and square root calculations which are supposed to be slow. Since I understand the principle but haven't gone into the details, I adapted a ready-made code given in the article of another author. All credits are due to him.

Here is the explanation of the circle-drawing algorythm:

http://homepage.smc.edu/kennedy_john/BCIRCLE.PDF

And the adapted functions:

Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 24th Sep 2009 22:40
Here is the ellipse-drawing function as well, adapted from the same author:

http://homepage.smc.edu/kennedy_john/belipse.pdf


Bran flakes91093
15
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 24th Sep 2009 22:43
Here is IanM's function to draw circles:



http://forum.thegamecreators.com/?m=forum_view&t=64634&b=1

(Yeah, it's in DBP, but I'm sure you can convert it over...)

On second thought i'll make it even easier:



Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 24th Sep 2009 22:50 Edited at: 24th Sep 2009 23:11
Thank you for adding yet another useful function to the thread!
Mireben
15
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 25th Sep 2009 08:34
I edited the first post to be more understandable and concise. I think I didn't make it clear enough yesterday.

Login to post a reply

Server time is: 2024-05-04 21:41:47
Your offset time is: 2024-05-04 21:41:47