|
FAQ
Q1) How do I have my screen start up split to show two views?
A1) In childfrm.h comment in the line
//#define STATIC_SPLITTER
Note that you can change the real number in the line below to
affect the size of the two views.
#define LEFT_PANE_PERCENT 0.5
Q2) How do you initialize the right frame so that it starts in
2D, while the left frame remains in 3D?
A2a) Add the following method to CPopView by putting it into popview.cpp
and protyping it in in popview.h.
CPoint CPopView::paneRowCol()
{
/* Return the pane location (row, col), starting with (0,0). This
could be useful,
in cGame::initializeView and cGame::initializeViewpoint. */
CSplitterWnd* psplitter = (CSplitterWnd*)GetParent();
for (int row = 0; row < psplitter->GetColumnCount(); row++)
for (int col = 0; col < psplitter->GetColumnCount(); col++)
{
if (this == psplitter->GetPane(row, col))
return CPoint(row, col);
}
return CPoint(0,0);
}
A2b) Do something like this in your game code
void cGameHallway::initializeView(CPopView *pview)
{
cGame::initializeView(pview);
pview->setUseBackgroundBitmap(FALSE);
pview->setUseSolidBackground(FALSE);
CPoint panepos = pview->paneRowCol();
if (panepos == CPoint(0,0))
{
pview->setGraphicsClass(RUNTIME_CLASS(cGraphicsOpenGL));
pview->pviewpointcritter()->setListener(new cListenerViewerRide());
}
if (panepos == CPoint(0,1))
pview->setGraphicsClass(RUNTIME_CLASS(cGraphicsMFC));
}
Q3) How do I move the initial view of the 2D frame up the screen?
A3) Use a switch on pview() similar to the switch in (A2b), or
do a switch on pviewer->Is3D(), and in the 2D case set your
viewer to be located at the bottom end of your cRealBox _border.
This will make the visual image be higher up. You do this with
a call like the following.
pviewer->setViewpoint(cVector::ZAXIS, cVector(_border.midx(),
_border.loy()));
Recall that the args to setViewpoint are (directiontoviewer, lookatpoint).
Note that directiontoviewer points FROM the origin TOWARDS the
viewer. Depending how your world is set up, you might want + or
- ZAXIS or + or - YAXIS.
|