This commit is contained in:
parent
0cdff1e9c9
commit
e04ad09c18
5 changed files with 196 additions and 51 deletions
|
@ -4,8 +4,18 @@
|
|||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "gl3d.h"
|
||||
#include <gl\gl.h>
|
||||
#include <gl\glu.h>
|
||||
#include <gl\glut.h>
|
||||
#include "GLEnabledView.h"
|
||||
|
||||
#include "MapEditDoc.h"
|
||||
#include "MapEditView.h"
|
||||
|
||||
#include "Core.h"
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -18,6 +28,110 @@ CCore::~CCore()
|
|||
{
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::Init(CMapEditView *Wnd)
|
||||
{
|
||||
ParentWindow=Wnd;
|
||||
// TestLayer.Init();
|
||||
// UpdateView();
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CCore::Render()
|
||||
{
|
||||
// if (RenderMode & RENDER_MODE_GFX) TestLayer.Render();
|
||||
// if (RenderMode & RENDER_MODE_POS) TestLayer.UpdateCursor(this);
|
||||
// RenderMode=0;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::UpdateView(float XOfs,float YOfs,float ZOfs)
|
||||
{
|
||||
// RenderMode|= RENDER_MODE_POS;
|
||||
// RenderMode|= RENDER_MODE_GFX;
|
||||
// ViewPos=ViewPos+Vec(XOfs,YOfs,ZOfs);
|
||||
// if (ViewPos.z>-1) ViewPos.z=-1;
|
||||
|
||||
// ParentWindow->Redraw();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Control *****************************************************************/
|
||||
/*****************************************************************************/
|
||||
void CCore::LButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
// TestLayer.LButtonControl(nFlags,point,DownFlag);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::MButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
if (DownFlag)
|
||||
{
|
||||
LastMousePos=point;
|
||||
ParentWindow->SetCapture();
|
||||
}
|
||||
else
|
||||
{
|
||||
ReleaseCapture();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::RButtonControl(UINT nFlags, CPoint &point,BOOL DownFlag)
|
||||
{
|
||||
// TestLayer.RButtonControl(nFlags,point,DownFlag);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::MouseWheel(UINT nFlags, short zDelta, CPoint &pt)
|
||||
{
|
||||
if (zDelta<0)
|
||||
{
|
||||
UpdateView(0,0,+1.0f);
|
||||
}
|
||||
if (zDelta>0)
|
||||
{
|
||||
UpdateView(0,0,-1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CCore::MouseMove(UINT nFlags, CPoint &Point,BOOL CaptureFlag)
|
||||
{
|
||||
float XOfs=0;
|
||||
float YOfs=0;
|
||||
|
||||
CurrentMousePos=Point;
|
||||
|
||||
if (CaptureFlag)
|
||||
{
|
||||
float XS,YS;
|
||||
RECT ThisRect;
|
||||
|
||||
ParentWindow->GetWindowRect(&ThisRect);
|
||||
|
||||
XS=ViewPos.z/((ThisRect.right-ThisRect.left));
|
||||
YS=ViewPos.z/((ThisRect.bottom-ThisRect.top));
|
||||
|
||||
XOfs=LastMousePos.x-CurrentMousePos.x;
|
||||
YOfs=LastMousePos.y-CurrentMousePos.y;
|
||||
LastMousePos=Point;
|
||||
|
||||
XOfs*=XS;
|
||||
YOfs*=YS;
|
||||
}
|
||||
UpdateView(-XOfs,-YOfs,0);
|
||||
if (nFlags & MK_LBUTTON) LButtonControl(nFlags,Point,TRUE);
|
||||
if (nFlags & MK_RBUTTON) RButtonControl(nFlags,Point,TRUE);
|
||||
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*** Layer Code **************************************************************/
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue