Graphics Reference
In-Depth Information
A:
void
CModel::SetObjectColor(
const
UWB
_
Color& color) {
if
(gotCircle == m
_
CurrentObjectType) m
_
Circle.SetColor(color);
else if
(gotPoint == m
_
CurrentObjectType)
m
_
Point.SetColor(color);
.
B:
void
CModel::StartDefineGraphicsObject(
float
world
_
x,
float
world
_
y) {
if
(gotCircle == m
_
CurrentObjectType) {
m
_
Circle.SetCenter(world
_
x, world
_
y);
m
_
Circle.SetRadius(0);
}
else if
(gotPoint == m
_
CurrentObjectType)
.
Source file.
Model.cpp
file in the
Model
folder of the
D3D
_
ObjectsAndAttributes
project.
void
CModel::EndDefineGraphicsObject(
float
world
_
x,
float
world
_
y) {
if
(gotCircle == m
_
CurrentObjectType) {
.
}
else if
(gotPoint == m
_
CurrentObjectType) {
.
C:
void
CModel::DrawModel() {
m
_
Circle.Draw(&m
_
DrawHelper);
m
_
Line.Draw(&m
_
DrawHelper);
.
Listing 7.6.
Example implementation of
CModel
(Tutorial 7.1).
class
CTutorialDlg :
public
CDialog {
A:
afx
_
msg void
OnTimer(UINT nIDEvent);
afx
_
msg void
OnHScroll(UINT nSBCode, UINT nPos, CScrollBar
*
pScrollBar);
afx
_
msg void
OnBnClickedColorButton();
Source file.
CTutorialDlg.cpp
file in
the
Source Files
folders of the
D3D
_
ObjectsAndAttributes
project.
private
:
.
// Control variables for GUI elements
UWBMFC
_
SliderCtrlWithEcho m
_
PointSizeSlider;
BOOL
m
_
bFillCircle, m
_
Shading;
B:
CDrawAndMouseHandler m
_
view;
C:
};
Listing 7.7.
The
CTutorialDlg
class (Tutorial 7.1).
Search WWH ::
Custom Search