mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Merge pull request #7698 from archimede67/use-editor-components
Use `CEditorComponent` methods instead of only `CMapView`
This commit is contained in:
commit
8f3d09eb29
|
@ -8164,6 +8164,9 @@ void CEditor::Render()
|
|||
MapView()->Zoom()->ChangeValue(-20.0f);
|
||||
}
|
||||
|
||||
for(CEditorComponent &Component : m_vComponents)
|
||||
Component.OnRender(View);
|
||||
|
||||
MapView()->UpdateZoom();
|
||||
|
||||
UI()->RenderPopupMenus();
|
||||
|
@ -8259,7 +8262,9 @@ void CEditor::Reset(bool CreateDefault)
|
|||
UI()->ClosePopupMenus();
|
||||
m_Map.Clean();
|
||||
|
||||
m_MapView.OnReset();
|
||||
for(CEditorComponent &Component : m_vComponents)
|
||||
Component.OnReset();
|
||||
|
||||
// create default layers
|
||||
if(CreateDefault)
|
||||
{
|
||||
|
@ -8633,6 +8638,9 @@ void CEditor::OnUpdate()
|
|||
DispatchInputEvents();
|
||||
HandleAutosave();
|
||||
HandleWriterFinishJobs();
|
||||
|
||||
for(CEditorComponent &Component : m_vComponents)
|
||||
Component.OnUpdate();
|
||||
}
|
||||
|
||||
void CEditor::OnRender()
|
||||
|
@ -8760,7 +8768,9 @@ bool CEditor::Load(const char *pFileName, int StorageType)
|
|||
str_copy(m_aFileName, pFileName);
|
||||
SortImages();
|
||||
SelectGameLayer();
|
||||
MapView()->OnMapLoad();
|
||||
|
||||
for(CEditorComponent &Component : m_vComponents)
|
||||
Component.OnMapLoad();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,9 +8,8 @@ void CEditorObject::Init(CEditor *pEditor)
|
|||
OnReset();
|
||||
}
|
||||
|
||||
void CEditorObject::OnUpdate(CUIRect View)
|
||||
void CEditorObject::OnUpdate()
|
||||
{
|
||||
OnRender(View);
|
||||
if(IsActive())
|
||||
OnActive();
|
||||
else if(IsHot())
|
||||
|
|
|
@ -31,9 +31,9 @@ public:
|
|||
virtual void Init(CEditor *pEditor);
|
||||
|
||||
/**
|
||||
* Calls `OnRender` and then maybe `OnHot` or `OnActive`.
|
||||
* Maybe calls `OnHot` or `OnActive`.
|
||||
*/
|
||||
void OnUpdate(CUIRect View);
|
||||
virtual void OnUpdate();
|
||||
|
||||
/**
|
||||
* Gets called before `OnRender`. Should return true
|
||||
|
|
Loading…
Reference in a new issue