This commit is contained in:
Daveo 2000-11-03 22:40:41 +00:00
parent 46791b36f4
commit 84eb6ded52
15 changed files with 243 additions and 108 deletions

View file

@ -37,6 +37,7 @@ BEGIN_MESSAGE_MAP(CMapEditView, CGLEnabledView)
ON_WM_MOUSEMOVE()
ON_COMMAND(ID_TOOLBAR_LAYERBAR, OnToolbarLayerbar)
ON_COMMAND(ID_TOOLBAR_TILEPALETTE, OnToolbarTilepalette)
ON_UPDATE_COMMAND_UI(ID_INDICATOR_CURSORXY, OnStatusCursorXY)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -80,12 +81,35 @@ void CMapEditView::OnCreateGL()
}
/////////////////////////////////////////////////////////////////////////////
void CMapEditView::OnDrawGL()
{
Core.Render();
}
/////////////////////////////////////////////////////////////////////////////
void CMapEditView::OnSizeGL(int cx, int cy)
{
glViewport(0,0,cx,cy);
// update the camera
glPushMatrix();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
SetupPersMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
Core.Redraw();
}
/////////////////////////////////////////////////////////////////////////////
void CMapEditView::SetupPersMatrix()
{
gluPerspective(40.0,m_dAspectRatio,0.1f, 100.0f);
glTranslatef(0.0f,0.0f,-4.f);
}
/////////////////////////////////////////////////////////////////////////////
// CMapEditView diagnostics
@ -126,6 +150,17 @@ void CMapEditView::UpdateAll()
Core.UpdateAll();
}
/*********************************************************************************/
void CMapEditView::OnStatusCursorXY(CCmdUI *pCmdUI)
{
CPoint &XY=Core.GetCursorPos();
CString XYStr;
pCmdUI->Enable();
if (XY.x!=-1 && XY.y!=-1)
XYStr.Format( "%d\t%d", XY.x,XY.y);
pCmdUI->SetText(XYStr);
}
/*********************************************************************************/
/*********************************************************************************/
/*********************************************************************************/
@ -140,3 +175,5 @@ void CMapEditView::OnMouseMove(UINT nFlags, CPoint point) {Core.MouseMove(nFl
void CMapEditView::OnToolbarLayerbar() {Core.ToggleLayerView();}
void CMapEditView::OnToolbarTilepalette() {Core.ToggleTileView();}