tags:

views:

763

answers:

5

I want to draw a 2d, filled, circle. I've looked everywhere and cannot seem to find anything that will even remotely help me draw a circle. I simply want to specify a height and width and location on my canvas.

Anyone know how?

Thanks!

+1  A: 

Out of the box, there's no support for this in XNA. I'm assuming you're coming from some GDI background and just want to see something moving around onscreen. In a real game though, this is seldom if ever needed.

There's some helpful info here:

http://forums.xna.com/forums/t/7414.aspx

My advice to you would be to just fire up paint or something, and create the basic shapes yourself and use the Content Pipeline.

BFree
+5  A: 

XNA doesn't normally have an idea of a canvas you can paint on. Instead you can either create a circle in your favorite paint program and render it as a sprite or create a series of 3D mesh to approximate a circle and render that.

Jake Pearson
That seems like it will work well. Thanks!
George
A: 

Another option (if you want to use a more complex gradient brush or something) is to draw a quad aligned to the screen and use a pixel shader.

Robert Fraser
+5  A: 

You could also check out the sample framework that Jeff Weber uses in Farseer:
http://www.codeplex.com/FarseerPhysics

The demos have a dynamic texture generator that let's him make circles and rectangles (which the samples then use as the visualization of the physics simulation). You could just re-use that :-)

Joel Martinez
+2  A: 

There seems to be a solution using a pixel shader here - http://www.xnainfo.com/resources.php?view=Code%20snippets

Jim Perry