Game Development Reference
In-Depth Information
boost, since we don't have the overhead of that function call. We could do the same
thing with the UpdateScene() method as well. In this case we didn't though, be-
cause the base class version of that method has a lot more code in it. In your own
projects you may want to copy and paste that code into your override of the Up-
dateScene() method.
The next line of code calls the render target's BeginDraw() method to tell it that
we are ready to begin drawing. Then, we clear the screen on the next line by filling it
with the color stored in the ClearColor property that is defined by our GameWin-
dow base class. The last three lines draw our geometry twice. First, we draw it using
the FillGeometry() method of our render target. This will draw our rectangle filled
in with the specified brush (in this case, solid blue). Then, we draw the rectangle
a second time, but this time with the DrawGeometry() method. This draws only
the lines of our shape but doesn't fill it in, so this draws a border on our rectangle.
The extra parameter on the DrawGeometry() method is optional and specifies the
width of the lines we are drawing. We set it to 1.0f , which means the lines will be
one-pixel wide. And the last line calls the EndDraw() method to tell the render tar-
get that we are finished drawing.
Cleanup
As usual, we need to clean things up after ourselves when the program closes. So,
we need to add override of the base class's Dispose(bool) method, just as we
didinthelastchapter.We'vealreadydonethisafewtimes,soitshouldbesomewhat
familiar and is not shown here. Check out the downloadable code for this chapter to
see this code.
Search WWH ::




Custom Search