41 lines
721 B
C++
41 lines
721 B
C++
#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>();
|
|
}
|
|
|
|
m_workspace.Attach(*m_context);
|
|
}
|
|
|
|
void EditorLayer::onDetach() {
|
|
if (m_context) {
|
|
m_workspace.Detach(*m_context);
|
|
}
|
|
}
|
|
|
|
void EditorLayer::onUpdate(float dt) {
|
|
m_workspace.Update(dt);
|
|
}
|
|
|
|
void EditorLayer::onEvent(void* event) {
|
|
m_workspace.DispatchEvent(event);
|
|
}
|
|
|
|
void EditorLayer::onUIRender() {
|
|
m_workspace.Render();
|
|
}
|
|
|
|
}
|
|
}
|