SBSPSS/Utils/MapEdit/LayerRGB.h

107 lines
2.3 KiB
C
Raw Normal View History

2001-07-26 22:16:11 +02:00
/*******************/
2001-07-28 18:33:48 +02:00
/*** Layer RGB ***/
2001-07-26 22:16:11 +02:00
/*******************/
2001-07-28 18:33:48 +02:00
#ifndef __LAYER_RGB_HEADER__
#define __LAYER_RGB_HEADER__
2001-07-26 22:16:11 +02:00
#include "Layer.h"
#include "MapEdit.h"
2001-07-28 18:33:48 +02:00
#include "GUILayerRGB.h"
2001-07-26 22:16:11 +02:00
#include "Elem.h"
#include "ExportHdr.h"
2001-07-28 18:33:48 +02:00
struct sRGBElem
2001-07-26 22:16:11 +02:00
{
2001-07-28 18:33:48 +02:00
u8 R,G,B;
2001-07-26 22:16:11 +02:00
};
/*****************************************************************************/
class CCore;
2001-07-28 18:33:48 +02:00
class CLayerRGB : public CLayer
2001-07-26 22:16:11 +02:00
{
public:
enum
{
2001-07-28 18:33:48 +02:00
GUI_MODE_PAINT=0,
GUI_MODE_TINT,
GUI_MODE_LIGHTEN,
GUI_MODE_DARKEN,
GUI_MODE_MAX
};
enum
{
RGB_BRUSH_MAX=8,
};
struct sRGBBrush
{
int WH;
int XYOfs;
u8 *Gfx;
2001-07-26 22:16:11 +02:00
};
2001-07-28 18:33:48 +02:00
CLayerRGB(sLayerDef &Def);
CLayerRGB(CFile *File,int Version) {Load(File,Version);}
~CLayerRGB();
2001-07-26 22:16:11 +02:00
void InitLayer(sLayerDef &Def);
void Render(CCore *Core,Vector3 &CamPos,bool Is3d);
void RenderGrid(CCore *Core,Vector3 &CamPos,bool Active){};
void RenderSelection(CCore *Core,Vector3 &ThisCam){};
void RenderCursor(CCore *Core,Vector3 &CamPos,bool Is3d);
void GUIInit(CCore *Core);
void GUIKill(CCore *Core);
void GUIUpdate(CCore *Core);
void GUIChanged(CCore *Core);
void CheckLayerSize(int Width,int Height);
bool Resize(int Width,int Height);
void Load(CFile *File,int Version);
void Save(CFile *File);
void Export(CCore *Core,CExport &Exp);
2001-07-28 18:33:48 +02:00
virtual void LoadGfx(CCore *Core){}
void SetSize(int Width,int Height,BOOL ClearFlag);
void Clear();
2001-07-26 22:16:11 +02:00
// Functions
bool LButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
bool RButtonControl(CCore *Core,UINT nFlags, CPoint &CursorPos,bool DownFlag);
bool MouseMove(CCore *Core,UINT nFlags, CPoint &CursorPos);
protected:
void Render(CCore *Core,Vector3 &CamPos,CMap &ThisMap,bool Render3d,float Alpha=1.0f,Vector3 *Ofs=0);
2001-07-28 18:33:48 +02:00
void Paint(CCore *Core,CPoint &CursorPos);
void Grab(CCore *Core,CPoint &CursorPos);
sRGBElem const &GetRGB(int X,int Y) {return(Map[X][Y]);}
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
CGUILayerRGB GUIRGB;
sRGBElem CurrentRGB;
int CurrentBrush;
int CurrentMode;
bool ShadeFlag;
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
int MapWidth,MapHeight;
std::vector< std::vector<sRGBElem> > Map;
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
CPoint LastCursPos;
static char *RGBModeName[GUI_MODE_MAX];
static sRGBBrush RGBBrushTable[CLayerRGB::RGB_BRUSH_MAX];
2001-07-26 22:16:11 +02:00
2001-07-28 18:33:48 +02:00
2001-07-26 22:16:11 +02:00
};
/*****************************************************************************/
#endif