So i’ve got a basic program which allows the user to draw circles, squares, triangles, lines but the problem is there can only be one of each at a time. I think this is more of a general c++ question but is there an efficient way to make the program have the ability to draw multiple circles of varying size and colour?
Thanks
Not sure about unlimited, but you can draw LOTS!
So i’ve got a basic program which allows the user to draw circles, squares, triangles, lines but the problem is there can only be one of each at a time.
How are you drawing the shapes? I suggest to store the shapes in a container(array, vector, list) that way you can keep track of them all, and do as you please with them
I think this is more of a general c++ question but is there an efficient way to make the program have the ability to draw multiple circles of varying size and colour?
For this I recommend the Particle System tutorial in the wiki page, then you can modified to draw any n-sided polygon you want
Hope that helps
rS
I’m using ofCircle, ofTriangle, ofRect.
I just looked into ofSetBackgroundAuto but there if the shape has noFill(true) and the size changes it doesn’t work.
I’m thinking maybe i do need to use an array of some kind.
I’ll look into the particles too.
Cheers for the advice, keep it coming.
Do you need the shapes to change(move, resize, rotate,change color)?
If you do then you will likely need to store them in some sort of data structure (array, list etc.) and then draw them all each cycle.
If not, you might want to use an image to store your data.
Basically you would do the same thing as you are currently doing but you would draw the shape to a second image buffer (not to the screen)
Then during your draw cycle, you draw that image buffer to the screen.
There are some trade offs in either case but it might be worth exploring.