Game Development Reference
In-Depth Information
immediate modeā€”just the outline will be drawn. The sine and cosine functions
are used to determine where to plot each vertex that will make up the circle's
perimeter.
To test the drawing function in the CircleIntersectionState , add a
_circle member to the class.
Circle _circle = new Circle(Vector.Zero, 200);
This creates a circle of radius 200 around the origin. To see the circle, the render
method needs to be modified.
public void Render()
{
_circle.Draw();
}
Run the program and you should see something similar to Figure 8.18.
The circle is made from only 10 vertices so it doesn't appear very smooth. To
increase the smoothness increase the number of vertices used in the Draw
method of the Circle class.
Figure 8.18
Rendering a circle.
 
Search WWH ::




Custom Search