cleanup and instrumentation

This commit is contained in:
Erris
2026-01-25 16:12:32 +01:00
parent c8cfed58da
commit 736591415c
61 changed files with 845 additions and 383 deletions

View File

@@ -1,7 +1,7 @@
#include "open_engine/core.hpp"
#include <open_engine/core.hpp>
#include <control_layer.hpp>
#include <sandbox2d.hpp>
#include <sandbox.hpp>
#include <control_layer.hpp>
ControlLayer::ControlLayer(OpenEngine::Ref<OpenEngine::Layer> layer)
: active_layer(layer), OpenEngine::Layer("control_layer")
@@ -14,12 +14,19 @@ void ControlLayer::OnUpdate()
bool ControlLayer::SwitchLayer(OpenEngine::KeyPressedEvent& event)
{
OE_PROFILE_FUNCTION();
auto& app = OpenEngine::Application::Get();
OpenEngine::Ref<Layer> layer;
if (event.GetKeyCode() == OE_KEY_1) {
OE_PROFILE_SCOPE("Press Key 1");
OE_DEBUG("Sandbox2D Layer");
layer = OpenEngine::CreateRef<Sandbox2DLayer>();
{
OE_PROFILE_SCOPE("Creating SB2D");
layer = OpenEngine::CreateRef<Sandbox2DLayer>();
}
app.QueueLayerPush(layer);
app.QueueLayerPop(active_layer);
@@ -27,8 +34,13 @@ bool ControlLayer::SwitchLayer(OpenEngine::KeyPressedEvent& event)
return true;
} else if (event.GetKeyCode() == OE_KEY_2) {
OE_PROFILE_SCOPE("Press Key 2");
OE_DEBUG("Sandbox Layer");
layer = OpenEngine::CreateRef<SandboxLayer>();
{
OE_PROFILE_SCOPE("Creating SB");
layer = OpenEngine::CreateRef<SandboxLayer>();
}
app.QueueLayerPush(layer);
app.QueueLayerPop(active_layer);