Graphics Reference
In-Depth Information
class
CTutorialDlg :
public
CDialog {
Source Files.
TutorialDlg.h
file
in
the
.
private
:
// Data to be displayed in the application window
CCircleRadiusControls
Header Files
folder
of
the
D3D_ModelView
project.
m
_
controls;
// The is the control class from Tutorial
2.8
m
_
view;
CDrawOnlyHandler
// This is the View/Controller pair
};
Listing 5.9.
CTutorialDlg.h
(Tutorial 5.1).
Source files.
TutorialDlg.cpp
file in the
Source Files
BOOL
CTutorialDlg::OnInitDialog() {
.
A:
Create the graphics context for Graphics API
if
(!UWBD3D
_
GraphicsSystem::GetSystem().CreateGraphicsContext(m
_
hWnd) )
return
FALSE;
folder
of
the
D3D
_
ModelView
project.
B:
Place the circle radius controls at
IDC_PLACEHOLDER
position.
if
(!UWBMFC
_
ReplaceDialogControl(
*
this
, IDC
_
PLACEHOLDER, m
_
controls,
...
))
return
FALSE;
C:
Initialize the WindowHandler and place the drawing area at
IDC_PLACEHODER2
position.
if
(!m
_
view.Initialize(
*
this
, IDC
_
PLACEHOLDER2) )
return
FALSE;
.
D:
Initialize the timer with 40 updates per second (25 milliseconds).
SetTimer(
...
);
// Program the timer to go-off every 25 millisecond
.
}
Listing 5.10.
CTutorialDlg::OnInitDialog()
(Tutorial 5.1).
tions
of
the
class
are
the
initialization
(
OnInitDia
CTutorialDlg
log()
) and servicing of the timer events (
OnTimer()
).
•
CTutorialDlg::OnInitDialog()
.
Listing 5.10 shows that during initial-
ization, the main application window must do the following.
-
(A) Create the graphics context of the graphics API.
-
(B and C) Replace the placeholder GUI elements and place the cir-
cle radius control (
m
_
control
) and the drawing area (wrapped in the
m
_
View
object) into the main application window.
-
(D) Initialize the timer events.
Search WWH ::
Custom Search