This commit is contained in:
Daveo 2000-12-11 22:42:19 +00:00
parent 9576f3dc94
commit 124a15101b
4 changed files with 22 additions and 23 deletions

View File

@ -281,7 +281,6 @@ BOOL RedrawFlag=FALSE;
/*****************************************************************************/ /*****************************************************************************/
void CCore::MButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag) void CCore::MButtonControl(CMapEditView *View,UINT nFlags, CPoint &point,BOOL DownFlag)
{ {
LastMousePos=point;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -324,7 +323,7 @@ void CCore::MouseWheel(CMapEditView *View,UINT nFlags, short zDelta, CPoint &pt)
if (zDelta>0) if (zDelta>0)
Zoom(View,+1.0f); Zoom(View,+1.0f);
else else
Zoom(View,+1.0f); Zoom(View,-1.0f);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -336,23 +335,23 @@ Vector3 &ThisCam=GetCam();
Ofs.Zero(); Ofs.Zero();
if (theApp.GetCurrent()!=View->GetDocument()) return; if (theApp.GetCurrent()!=View->GetDocument()) return;
CurrentMousePos=point; CurrentMousePos=point;
// Handle Drag Movement // Handle Drag Movement
if (nFlags & MK_MBUTTON) if (nFlags & MK_MBUTTON || nFlags & MK_SHIFT)
{ {
float XS,YS; float XS,YS;
RECT ThisRect; RECT ThisRect;
View->GetWindowRect(&ThisRect); View->GetWindowRect(&ThisRect);
XS=ThisCam.z*4;//*Layer[ActiveLayer]->GetLayerZPos(); XS=ThisCam.z*4;
YS=ThisCam.z*4;//*Layer[ActiveLayer]->GetLayerZPos(); YS=ThisCam.z*4;
XS/=((ThisRect.right-ThisRect.left)); XS/=((ThisRect.right-ThisRect.left));
YS/=((ThisRect.bottom-ThisRect.top)); YS/=((ThisRect.bottom-ThisRect.top));
Ofs.x=LastMousePos.x-CurrentMousePos.x; Ofs.x=LastMousePos.x-CurrentMousePos.x;
Ofs.y=LastMousePos.y-CurrentMousePos.y; Ofs.y=LastMousePos.y-CurrentMousePos.y;
LastMousePos=CurrentMousePos;
Ofs.x*=XS; Ofs.x*=XS;
Ofs.y*=YS; Ofs.y*=YS;
@ -382,7 +381,7 @@ Vector3 &ThisCam=GetCam();
} }
View->Invalidate(); // Mouse still moved, so need to redraw windows, to get CursorPos (And pos render) View->Invalidate(); // Mouse still moved, so need to redraw windows, to get CursorPos (And pos render)
} }
LastMousePos=CurrentMousePos;
} }

View File

@ -2,7 +2,7 @@
[General Info] [General Info]
Version=1 Version=1
LastClass=CMapEditDoc LastClass=CMapEditView
LastTemplate=CDialog LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h" NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "mapedit.h" NewFileInclude2=#include "mapedit.h"
@ -77,7 +77,7 @@ Type=0
BaseClass=CDocument BaseClass=CDocument
HeaderFile=MapEditDoc.h HeaderFile=MapEditDoc.h
ImplementationFile=MapEditDoc.cpp ImplementationFile=MapEditDoc.cpp
LastObject=ID_ZOOM_OUT LastObject=CMapEditDoc
Filter=N Filter=N
VirtualFilter=DC VirtualFilter=DC
@ -86,7 +86,7 @@ Type=0
BaseClass=CGLEnabledView BaseClass=CGLEnabledView
HeaderFile=MapEditView.h HeaderFile=MapEditView.h
ImplementationFile=MapEditView.cpp ImplementationFile=MapEditView.cpp
LastObject=ID_TOOLBAR_TILEPALETTE LastObject=CMapEditView
Filter=C Filter=C
VirtualFilter=VWC VirtualFilter=VWC

View File

@ -180,4 +180,3 @@ void CMapEditView::OnActivebrushRight() {GetDocument()->ActiveBrushRight
void CMapEditView::OnMapSetSize() {GetDocument()->MapSetSize(this);} void CMapEditView::OnMapSetSize() {GetDocument()->MapSetSize(this);}
void CMapEditView::On2d3dToggle() {GetDocument()->Toggle2d3d(this);} void CMapEditView::On2d3dToggle() {GetDocument()->Toggle2d3d(this);}

View File

@ -3,11 +3,10 @@
/*********************/ /*********************/
#include "stdafx.h" #include "stdafx.h"
//#include "gl3d.h"
#include <gl\gl.h> #include <gl\gl.h>
#include <gl\glu.h> #include <gl\glu.h>
#include <gl\glut.h> #include <gl\glut.h>
#include <gl\glaux.h> // Header File For The Glaux Library #include <frame.hpp>
#include <Vector> #include <Vector>
#include "TexCache.h" #include "TexCache.h"
@ -80,14 +79,15 @@ int CTexCache::AlignSize(int Size)
/**************************************************************************************/ /**************************************************************************************/
void CTexCache::LoadBMP(char *Filename,sRGBData &RGBData) void CTexCache::LoadBMP(char *Filename,sRGBData &RGBData)
{ {
FILE *File=NULL; Frame ThisFrame;
AUX_RGBImageRec *Aux;
Aux=auxDIBImageLoad(Filename); ThisFrame.LoadBMP(Filename);
RGBData.Width=Aux->sizeX;
RGBData.Height=Aux->sizeY; RGBData.Width=ThisFrame.GetWidth();
RGBData.RGB=Aux->data; RGBData.Height=ThisFrame.GetHeight();
free(Aux); // Safe to free aux now, contents copied (I HATE AUX) RGBData.RGB=(u8*)malloc(RGBData.Width*RGBData.Height*3);
ThisFrame.FlipY();
ThisFrame.MakeRGB(RGBData.RGB);
} }
/**************************************************************************************/ /**************************************************************************************/
@ -95,14 +95,14 @@ void CTexCache::FreeBMP(sRGBData &RGBData)
{ {
if (RGBData.RGB) if (RGBData.RGB)
{ {
free((unsigned char*)RGBData.RGB); free(RGBData.RGB);
} }
} }
/**************************************************************************************/ /**************************************************************************************/
void CTexCache::LoadTex(sTex &ThisTex,sRGBData *TexData) void CTexCache::LoadTex(sTex &ThisTex,sRGBData *TexData)
{ {
std::vector<u8> Buffer; u8 *Buffer;
int TexWidth=TexData->Width; int TexWidth=TexData->Width;
int TexHeight=TexData->Height; int TexHeight=TexData->Height;
int GLWidth=AlignSize(TexWidth); int GLWidth=AlignSize(TexWidth);
@ -111,7 +111,7 @@ u8 *Src,*Dst;
// create RGB & alpha texture & ensuse texture is correct size for GL // create RGB & alpha texture & ensuse texture is correct size for GL
Buffer.resize(GLWidth*GLHeight*4); Buffer=(u8*)malloc(GLWidth*GLHeight*4);
Src=TexData->RGB; Src=TexData->RGB;
Dst=&Buffer[0]; Dst=&Buffer[0];
for (int Y=0; Y<TexHeight; Y++) for (int Y=0; Y<TexHeight; Y++)
@ -148,6 +148,7 @@ u8 *Src,*Dst;
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
free(Buffer);
} }
/**************************************************************************************/ /**************************************************************************************/