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.

Newcomers DBPro Corner / Fill Ellipse

Author
Message
CodeCriminal
14
Years of Service
User Offline
Joined: 29th Jan 2010
Location:
Posted: 31st Jan 2010 04:18
Hi all, im writing a simple 'bouncing ball' physics sim for a college course I am on (just for a bit of practice with a new language) and I've come across something very perculiar. For some reason or another there doesnt seem to be a way to 'fill' an ellipse with a solid block of colour. with rectangles (or 'box' as it is called in DBPro) you can define four colours for each corner however there is no such parameters in any of the other basic 2d primitive drawing commands.

Ive searched high and low in the manual index, and still nothing.

Any help?

If anyone is interested here is the full source code for the application if you wish to test it out or make suggestions on my code.

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st Jan 2010 19:14 Edited at: 29th Mar 2010 03:45
Nicely done. I would suggest that you search for "filled circle". You should find some snippets to help. To me, it would make sense to use a function to draw the filled circle, grab the image and use sprites to move them around. You could also do it in 3D using spheres.

Also, if I click at the top of the screen to where the very top of the ellipse is above the screen, it moves slowly upward.

CodeCriminal
14
Years of Service
User Offline
Joined: 29th Jan 2010
Location:
Posted: 31st Jan 2010 21:42
Thanks. Ah yes i should have thought of that before hand, even so i took your advice and tested a few of the more promising algorithms lying around amongst the forums. Unfortunatly they were all to slow.

Anywho, ive changed my mind, i think ill stick with just the regular ellipse command (as it draws a better circle than the 'circle' command =/). still though you would think that a 'fill ellipse' or even 'fill circle' command would have been implemented.

Thanks for all your help
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st Jan 2010 22:32 Edited at: 29th Mar 2010 03:45
You're welcome. Yes, it would take too long to draw these on the fly. Have you thought of creating all of them ahead of time, grabbing the images and then using sprites? It seems like it would work well.

It does seem like a fill circle and fill ellipse commands would be there in the first place.

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Feb 2010 15:02
Fill Ellipse and Fill Circle

Just follow the first link in my signature and download the plug-ins.

CodeCriminal
14
Years of Service
User Offline
Joined: 29th Jan 2010
Location:
Posted: 2nd Feb 2010 18:21
Ah, thank you, those should come in handy.
Torgoth
16
Years of Service
User Offline
Joined: 16th Dec 2007
Location:
Posted: 29th Mar 2010 02:36
Here, i modified your code so that it only draws a filled circle only once and the grabs the image of the circle, it makes drawing filled circles faster. I had to add a function for adding a ball, so you cant really just change the ballcount variable and make a new ball, you actually have to call the addBall() function.

Login to post a reply

Server time is: 2024-11-24 20:57:23
Your offset time is: 2024-11-24 20:57:23