Files
XCEngine/editor/src/Layers/EditorLayer.cpp

41 lines
721 B
C++
Raw Normal View History

#include "EditorLayer.h"
#include "Core/EditorContext.h"
namespace XCEngine {
namespace Editor {
EditorLayer::EditorLayer() : Layer("Editor") {}
void EditorLayer::SetContext(std::shared_ptr<IEditorContext> context) {
m_context = context;
}
void EditorLayer::onAttach() {
if (!m_context) {
m_context = std::make_shared<EditorContext>();
}
2026-03-26 21:18:33 +08:00
2026-03-26 23:52:05 +08:00
m_workspace.Attach(*m_context);
}
void EditorLayer::onDetach() {
2026-03-26 21:18:33 +08:00
if (m_context) {
2026-03-26 23:52:05 +08:00
m_workspace.Detach(*m_context);
}
}
void EditorLayer::onUpdate(float dt) {
2026-03-26 23:52:05 +08:00
m_workspace.Update(dt);
}
void EditorLayer::onEvent(void* event) {
2026-03-26 23:52:05 +08:00
m_workspace.DispatchEvent(event);
}
2026-04-05 01:25:09 +08:00
void EditorLayer::onUIRender() {
2026-03-26 23:52:05 +08:00
m_workspace.Render();
}
}
}