Graphics Reference
In-Depth Information
class
CModel {
public
:
// Draws the square and the circle
void
Draw();
Source files.
Model.h/.cpp
files in the
Model
folder of the
D3D
_
ModelView
project.
// For interaction with the radius control slider bar
float
GetCircleRadius()
const
;
void
SetCircleRadius(
float
radius);
private
:
// content of the world: a square and a circle
UWBD3D
_
RectangleGeometry m
_
LargeSquare;
UWBD3D
_
CircleGeometry
m
_
SmallCircle;
};
Listing 5.6.
The
CModel
class (Tutorial 5.1).
class
CDrawOnlyHandler :
public
UWBD3D
_
WindowHandler {
public
:
Source file.
DrawOnlyHandler.h
file in
the
WindowHandler
folder of
the
D3D
_
ModelView
project.
.
bool
Initialize(...
control
_
id
...);
// Place m
_
window into the application main window
void
DrawGraphics();
// Invoke CModel to redraw into the m
_
window
private
:
UWBMFC
_
UIWindow m
_
window;
// This is the GUI drawing area
};
Listing 5.7.
CDrawOnlyHandler
(Tutorial 5.1).
•
CModel
.
In this case, the model is a very simple scene of a square and a
circle. From Listing 5.6, we notice that the public interface of the
CModel
class is driven completely by the functionality of the application, where the
only requirements are the ability of getting and setting the radius of the
circle.
The
CModel
object is defined as an instance variable in the
CTutorialApp
class. Because the
CTutorialApp
class represents the running process,
there can only be one instance, and thus there can only be a single instance
of the model.
•
CDrawOnlyHandler
.
This a subclass of the
UWBD3D
_
WindowHandler
.As
the name of the class suggests, this class can only support drawing (the
Search WWH ::
Custom Search