DDraceNetwork Docs
layer.h
Go to the documentation of this file.
1#ifndef GAME_EDITOR_MAPITEMS_LAYER_H
2#define GAME_EDITOR_MAPITEMS_LAYER_H
3
4#include <base/system.h>
5#include <game/client/ui.h>
7#include <game/mapitems.h>
8
9#include <memory>
10
11using FIndexModifyFunction = std::function<void(int *pIndex)>;
12
13class CLayerGroup;
14
15class CLayer
16{
17public:
19 class IGraphics *Graphics();
20 class ITextRender *TextRender();
21
22 explicit CLayer(CEditor *pEditor)
23 {
25 str_copy(m_aName, "(invalid)");
26 m_Visible = true;
27 m_Readonly = false;
28 m_Flags = 0;
29 m_pEditor = pEditor;
30 }
31
32 CLayer(const CLayer &Other)
33 {
34 str_copy(m_aName, Other.m_aName);
35 m_Flags = Other.m_Flags;
36 m_pEditor = Other.m_pEditor;
37 m_Type = Other.m_Type;
38 m_Visible = true;
39 m_Readonly = false;
40 }
41
42 virtual ~CLayer()
43 {
44 }
45
46 virtual void BrushSelecting(CUIRect Rect) {}
47 virtual int BrushGrab(std::shared_ptr<CLayerGroup> pBrush, CUIRect Rect) { return 0; }
48 virtual void FillSelection(bool Empty, std::shared_ptr<CLayer> pBrush, CUIRect Rect) {}
49 virtual void BrushDraw(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) {}
50 virtual void BrushPlace(std::shared_ptr<CLayer> pBrush, vec2 WorldPos) {}
51 virtual void BrushFlipX() {}
52 virtual void BrushFlipY() {}
53 virtual void BrushRotate(float Amount) {}
54
55 virtual bool IsEntitiesLayer() const { return false; }
56
57 virtual void Render(bool Tileset = false) {}
59
60 virtual void ModifyImageIndex(FIndexModifyFunction pfnFunc) {}
62 virtual void ModifySoundIndex(FIndexModifyFunction pfnFunc) {}
63
64 virtual std::shared_ptr<CLayer> Duplicate() const = 0;
65 virtual const char *TypeName() const = 0;
66
67 virtual void GetSize(float *pWidth, float *pHeight)
68 {
69 *pWidth = 0;
70 *pHeight = 0;
71 }
72
73 char m_aName[12];
74 int m_Type;
76
79};
80
81#endif
Definition: editor.h:276
Definition: layer_group.h:10
Definition: layer.h:16
int m_Type
Definition: layer.h:74
virtual void GetSize(float *pWidth, float *pHeight)
Definition: layer.h:67
class ITextRender * TextRender()
Definition: editor.h:1195
virtual int BrushGrab(std::shared_ptr< CLayerGroup > pBrush, CUIRect Rect)
Definition: layer.h:47
CLayer(const CLayer &Other)
Definition: layer.h:32
virtual std::shared_ptr< CLayer > Duplicate() const =0
virtual void ModifyImageIndex(FIndexModifyFunction pfnFunc)
Definition: layer.h:60
bool m_Readonly
Definition: layer.h:77
virtual void BrushFlipY()
Definition: layer.h:52
virtual void BrushDraw(std::shared_ptr< CLayer > pBrush, vec2 WorldPos)
Definition: layer.h:49
virtual ~CLayer()
Definition: layer.h:42
virtual void ModifyEnvelopeIndex(FIndexModifyFunction pfnFunc)
Definition: layer.h:61
virtual void ModifySoundIndex(FIndexModifyFunction pfnFunc)
Definition: layer.h:62
virtual void BrushPlace(std::shared_ptr< CLayer > pBrush, vec2 WorldPos)
Definition: layer.h:50
virtual bool IsEntitiesLayer() const
Definition: layer.h:55
class CEditor * m_pEditor
Definition: layer.h:18
char m_aName[12]
Definition: layer.h:73
int m_Flags
Definition: layer.h:75
virtual void FillSelection(bool Empty, std::shared_ptr< CLayer > pBrush, CUIRect Rect)
Definition: layer.h:48
class IGraphics * Graphics()
Definition: editor.h:1194
CLayer(CEditor *pEditor)
Definition: layer.h:22
virtual void BrushRotate(float Amount)
Definition: layer.h:53
virtual CUi::EPopupMenuFunctionResult RenderProperties(CUIRect *pToolbox)
Definition: layer.h:58
virtual void Render(bool Tileset=false)
Definition: layer.h:57
virtual void BrushFlipX()
Definition: layer.h:51
virtual const char * TypeName() const =0
bool m_Visible
Definition: layer.h:78
virtual void BrushSelecting(CUIRect Rect)
Definition: layer.h:46
Definition: ui_rect.h:11
EPopupMenuFunctionResult
Definition: ui.h:289
@ POPUP_KEEP_OPEN
Definition: ui.h:293
Definition: graphics.h:183
Definition: textrender.h:312
std::function< void(int *pIndex)> FIndexModifyFunction
Definition: editor.h:52
int str_copy(char *dst, const char *src, int dst_size)
Definition: system.cpp:2720
@ LAYERTYPE_INVALID
Definition: mapitems.h:11