SBSPSS/Utils/MapEdit/MapEditView.cpp

128 lines
3.6 KiB
C++
Raw Normal View History

2000-09-22 17:11:29 +02:00
// MapEditView.cpp : implementation of the CMapEditView class
//
2000-09-22 18:56:20 +02:00
#include "stdafx.h"
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glut.h>
#include "GLEnabledView.h"
#include "MapEdit.h"
#include "MapEditDoc.h"
#include "MapEditView.h"
2000-09-22 17:11:29 +02:00
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMapEditView
2000-09-22 18:56:20 +02:00
IMPLEMENT_DYNCREATE(CMapEditView, CGLEnabledView)
2000-09-22 17:11:29 +02:00
2000-09-22 18:56:20 +02:00
BEGIN_MESSAGE_MAP(CMapEditView, CGLEnabledView)
2000-09-22 17:11:29 +02:00
//{{AFX_MSG_MAP(CMapEditView)
ON_WM_SETFOCUS()
2000-09-22 23:19:46 +02:00
ON_WM_LBUTTONUP()
ON_WM_LBUTTONDOWN()
ON_WM_MBUTTONDOWN()
ON_WM_MBUTTONUP()
ON_WM_MOUSEWHEEL()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
2000-09-22 17:11:29 +02:00
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMapEditView construction/destruction
CMapEditView::CMapEditView()
{
}
CMapEditView::~CMapEditView()
{
}
/////////////////////////////////////////////////////////////////////////////
2000-09-22 23:19:46 +02:00
void CMapEditView::VideoMode(ColorsNumber & c, ZAccuracy & z, BOOL & dbuf)
2000-09-22 17:11:29 +02:00
{
2000-09-22 23:19:46 +02:00
c=THOUSANDS; // ask for 65355 colors...
z=NORMAL; // ...16 bit Z-buffer...
dbuf=TRUE; // ...double-buffering
2000-09-22 17:11:29 +02:00
}
2000-09-22 23:19:46 +02:00
/////////////////////////////////////////////////////////////////////////////
void CMapEditView::OnCreateGL()
2000-09-22 17:11:29 +02:00
{
2000-09-22 23:19:46 +02:00
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glEnable(GL_LIGHT0); // Quick And Dirty Lighting (Assumes Light0 Is SetUp)
glEnable(GL_LIGHTING); // Enable Lighting
glEnable(GL_COLOR_MATERIAL); // Enable Material Coloring
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
//Core.Init(this);
2000-09-22 17:11:29 +02:00
}
2000-09-22 23:19:46 +02:00
/////////////////////////////////////////////////////////////////////////////
void CMapEditView::OnDrawGL()
2000-09-22 17:11:29 +02:00
{
2000-09-22 23:19:46 +02:00
// Core.Render();
2000-09-22 17:11:29 +02:00
}
/////////////////////////////////////////////////////////////////////////////
// CMapEditView diagnostics
#ifdef _DEBUG
void CMapEditView::AssertValid() const
{
2000-09-22 18:56:20 +02:00
CGLEnabledView::AssertValid();
2000-09-22 17:11:29 +02:00
}
void CMapEditView::Dump(CDumpContext& dc) const
{
2000-09-22 18:56:20 +02:00
CGLEnabledView::Dump(dc);
2000-09-22 17:11:29 +02:00
}
CMapEditDoc* CMapEditView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMapEditDoc)));
return (CMapEditDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMapEditView message handlers
void CMapEditView::OnSetFocus(CWnd* pOldWnd)
{
2000-09-22 18:56:20 +02:00
2000-09-22 17:11:29 +02:00
CMapEditDoc *CurDoc=GetDocument();
2000-09-22 18:56:20 +02:00
CGLEnabledView::OnSetFocus(pOldWnd);
2000-09-22 17:11:29 +02:00
theApp.SetCurrent(CurDoc);
CurDoc->UpdateAll(); // woohoo, that was easy
}
2000-09-22 23:19:46 +02:00
/*********************************************************************************/
/*********************************************************************************/
/*********************************************************************************/
void CMapEditView::OnLButtonDown(UINT nFlags, CPoint point) {}
void CMapEditView::OnLButtonUp(UINT nFlags, CPoint point) {}
void CMapEditView::OnMButtonDown(UINT nFlags, CPoint point) {}
void CMapEditView::OnMButtonUp(UINT nFlags, CPoint point) {}
BOOL CMapEditView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) {return(0);}
void CMapEditView::OnRButtonDown(UINT nFlags, CPoint point) {}
void CMapEditView::OnRButtonUp(UINT nFlags, CPoint point) {}
/*********************************************************************************/