Game Development Reference
to select different parts of the document. Middle left is an image view, to
display bitmaps. Bottom left is a debug view for scripts. The biggest view
is the OpenGL window on the right. Each of these views is handled by a
completely different view class. This architecture structures the source
code in a logical and easy to use way.
The default implementation has just one view. The sample project
'Examples\AppendixB\MFCSingleDoc' is a very simple SDI application.
The document stores a rectangle and the view draws it. If you click on the
view and drag you can draw a new rectangle. The file menu allows you to
save the square or load another square. So how is this all achieved?
First, we add a CRect member variable to the document. A CRect is
an MFC class that stores a rectangle structure. We can use this class to
store the position on the view of the top left corner of a rectangle and
the bottom left. The default values for the rectangle are initialized in the
function OnNewDocument() , which is created for you by Visual C++ for
all CDocument derived classes. A CRect class has a member function
SetRect , which can set the left ,
Figure B.8 Toon3D is an SDI application.