mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
let CEditorImage
inherit CEditorComponent
This commit is contained in:
parent
07fd8e6712
commit
12d0608dfd
|
@ -76,19 +76,19 @@ public:
|
|||
|
||||
/* Variable: width
|
||||
Contains the width of the image */
|
||||
int m_Width;
|
||||
int m_Width = 0;
|
||||
|
||||
/* Variable: height
|
||||
Contains the height of the image */
|
||||
int m_Height;
|
||||
int m_Height = 0;
|
||||
|
||||
/* Variable: format
|
||||
Contains the format of the image. See <Image Formats> for more information. */
|
||||
int m_Format;
|
||||
int m_Format = FORMAT_RGB;
|
||||
|
||||
/* Variable: data
|
||||
Pointer to the image data. */
|
||||
void *m_pData;
|
||||
void *m_pData = nullptr;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,14 +1,28 @@
|
|||
#include "image.h"
|
||||
|
||||
#include <game/editor/editor.h>
|
||||
#include <game/mapitems.h>
|
||||
|
||||
CEditorImage::CEditorImage(CEditor *pEditor) :
|
||||
m_AutoMapper(pEditor)
|
||||
{
|
||||
Init(pEditor);
|
||||
m_Texture.Invalidate();
|
||||
}
|
||||
|
||||
CEditorImage::~CEditorImage()
|
||||
{
|
||||
m_pEditor->Graphics()->UnloadTexture(&m_Texture);
|
||||
Graphics()->UnloadTexture(&m_Texture);
|
||||
free(m_pData);
|
||||
m_pData = nullptr;
|
||||
}
|
||||
|
||||
void CEditorImage::Init(CEditor *pEditor)
|
||||
{
|
||||
CEditorComponent::Init(pEditor);
|
||||
RegisterSubComponent(m_AutoMapper);
|
||||
InitSubComponents();
|
||||
}
|
||||
|
||||
void CEditorImage::AnalyseTileFlags()
|
||||
{
|
||||
mem_zero(m_aTileFlags, sizeof(m_aTileFlags));
|
||||
|
|
|
@ -4,35 +4,22 @@
|
|||
#include <engine/graphics.h>
|
||||
|
||||
#include <game/editor/auto_map.h>
|
||||
#include <game/editor/component.h>
|
||||
|
||||
class CEditor;
|
||||
|
||||
class CEditorImage : public CImageInfo
|
||||
class CEditorImage : public CImageInfo, public CEditorComponent
|
||||
{
|
||||
public:
|
||||
CEditor *m_pEditor;
|
||||
|
||||
CEditorImage(CEditor *pEditor): m_AutoMapper(pEditor)
|
||||
{
|
||||
m_pEditor = pEditor;
|
||||
m_aName[0] = 0;
|
||||
m_Texture.Invalidate();
|
||||
m_External = 0;
|
||||
m_Width = 0;
|
||||
m_Height = 0;
|
||||
m_pData = nullptr;
|
||||
m_Format = 0;
|
||||
}
|
||||
|
||||
explicit CEditorImage(CEditor *pEditor);
|
||||
~CEditorImage();
|
||||
|
||||
void Init(CEditor *pEditor) override;
|
||||
void AnalyseTileFlags();
|
||||
|
||||
IGraphics::CTextureHandle m_Texture;
|
||||
int m_External;
|
||||
char m_aName[IO_MAX_PATH_LENGTH];
|
||||
int m_External = 0;
|
||||
char m_aName[IO_MAX_PATH_LENGTH] = "";
|
||||
unsigned char m_aTileFlags[256];
|
||||
class CAutoMapper m_AutoMapper;
|
||||
CAutoMapper m_AutoMapper;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue