editor setup

This commit is contained in:
Erris
2026-02-05 17:05:33 +01:00
parent 60bf9550cd
commit 40152fafff
10 changed files with 1206 additions and 6 deletions

View File

@@ -0,0 +1,44 @@
#include <open_engine/core.hpp>
#include <control_layer.hpp>
#include <sandbox2d.hpp>
#include <editor.hpp>
ControlLayer::ControlLayer(OpenEngine::Ref<OpenEngine::Layer> layer)
: active_layer(layer), OpenEngine::Layer("control_layer")
{
}
void ControlLayer::OnUpdate()
{
}
bool ControlLayer::StopRunning(OpenEngine::KeyPressedEvent& event)
{
if (event.GetKeyCode() == OE_KEY_ESCAPE) {
OpenEngine::Application::Get().StopRunning();
return true;
}
return false;
}
void ControlLayer::OnEvent(OpenEngine::Event& event)
{
OpenEngine::EventDispatcher dispatcher(event);
dispatcher.Dispatch<OpenEngine::KeyPressedEvent>(BIND_EVENT_FN(ControlLayer::StopRunning));
}
void ControlLayer::OnImGuiRender()
{
}
void ControlLayer::OnAttach()
{
}
void ControlLayer::OnDetach()
{
}

31
editor/src/editor.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include <open_engine/entry_point.hpp>
#include <open_engine.hpp>
#include <editor.hpp>
#include <control_layer.hpp>
#include <overlay.hpp>
#include <modding.hpp>
#include <editor.hpp>
EditorApp::EditorApp()
{
OpenEngine::Ref<OpenEngine::Layer> initial_layer = std::make_shared<EditorLayer>();
OpenEngine::Ref<OpenEngine::Layer> control_layer = std::make_shared<ControlLayer>(initial_layer);
OpenEngine::Ref<OpenEngine::Layer> modding_layer = std::make_shared<Modding>();
QueueLayerPush(initial_layer);
QueueLayerPush(control_layer);
QueueLayerPush(modding_layer);
}
EditorApp::~EditorApp()
{
}
OpenEngine::Application* OpenEngine::CreateApplication()
{
OE_INFO("Editor Starting...");
return new EditorApp();
}