mirror of
https://github.com/ddnet/ddnet.git
synced 2024-10-21 00:08:19 +00:00
719b2bdadd
This class is slightly more light-weight than a CEditorComponent and its naming makes it more natural to inherit for envelope points, proof-mode positions etc.
80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
#include "editor_object.h"
|
|
|
|
#include "editor.h"
|
|
|
|
void CEditorObject::Init(CEditor *pEditor)
|
|
{
|
|
m_pEditor = pEditor;
|
|
OnReset();
|
|
}
|
|
|
|
void CEditorObject::OnUpdate(CUIRect View)
|
|
{
|
|
OnRender(View);
|
|
if(IsActive())
|
|
OnActive();
|
|
else if(IsHot())
|
|
OnHot();
|
|
}
|
|
|
|
bool CEditorObject::OnInput(const IInput::CEvent &Event)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
void CEditorObject::OnRender(CUIRect View) {}
|
|
|
|
void CEditorObject::OnReset() {}
|
|
void CEditorObject::OnMapLoad() {}
|
|
|
|
bool CEditorObject::IsHot()
|
|
{
|
|
return UI()->HotItem() == this;
|
|
}
|
|
|
|
void CEditorObject::SetHot()
|
|
{
|
|
UI()->SetHotItem(this);
|
|
}
|
|
|
|
void CEditorObject::UnsetHot()
|
|
{
|
|
if(IsHot())
|
|
UI()->SetHotItem(nullptr);
|
|
}
|
|
|
|
void CEditorObject::OnHot() {}
|
|
|
|
bool CEditorObject::IsActive()
|
|
{
|
|
return UI()->CheckActiveItem(this);
|
|
}
|
|
|
|
void CEditorObject::SetActive()
|
|
{
|
|
SetHot();
|
|
UI()->SetActiveItem(this);
|
|
}
|
|
|
|
void CEditorObject::SetInactive()
|
|
{
|
|
if(IsActive())
|
|
UI()->SetActiveItem(nullptr);
|
|
}
|
|
|
|
void CEditorObject::OnActive() {}
|
|
|
|
CEditor *CEditorObject::Editor() { return m_pEditor; }
|
|
const CEditor *CEditorObject::Editor() const { return m_pEditor; }
|
|
IInput *CEditorObject::Input() { return m_pEditor->Input(); }
|
|
IClient *CEditorObject::Client() { return m_pEditor->Client(); }
|
|
CConfig *CEditorObject::Config() { return m_pEditor->Config(); }
|
|
IConsole *CEditorObject::Console() { return m_pEditor->Console(); }
|
|
IEngine *CEditorObject::Engine() { return m_pEditor->Engine(); }
|
|
IGraphics *CEditorObject::Graphics() { return m_pEditor->Graphics(); }
|
|
ISound *CEditorObject::Sound() { return m_pEditor->Sound(); }
|
|
ITextRender *CEditorObject::TextRender() { return m_pEditor->TextRender(); }
|
|
IStorage *CEditorObject::Storage() { return m_pEditor->Storage(); }
|
|
CUI *CEditorObject::UI() { return m_pEditor->UI(); }
|
|
CRenderTools *CEditorObject::RenderTools() { return m_pEditor->RenderTools(); }
|