added queuing push and pop logic and having fun with c# integration

This commit is contained in:
Erris
2026-01-22 09:33:35 +01:00
parent 14134c7d2f
commit 58ea4554c7
34 changed files with 338 additions and 126 deletions

View File

@@ -1,42 +1,51 @@
#include <pch.hpp>
#include <core.hpp>
#include <events/application_event.hpp>
#include <imgui/imgui_layer.hpp>
#include <core/time.hpp>
#include <renderer/renderer.hpp>
#include <application.hpp>
#include <input/input_system.hpp>
#include <core.hpp>
#include <core/time.hpp>
#include <events/application_event.hpp>
#include <renderer/renderer2d.hpp>
#include <renderer/renderer.hpp>
#include <input/input_system.hpp>
#include <imgui/imgui_layer.hpp>
#include <memory>
#include <imgui.h>
namespace OpenEngine {
Application::Application()
{
OE_CORE_ASSERT(!instance, "Application already exists!");
instance = this;
window = std::unique_ptr<Window>(Window::Create());
window = Window::Create();
window->SetEventCallback(BIND_EVENT_FN(Application::OnEvent));
Renderer::Init();
Renderer2D::Init();
imgui_layer = new ImGuiLayer();
PushOverlay(imgui_layer);
imgui_layer = std::make_shared<ImGuiLayer>();
QueueOverlayPush(imgui_layer);
}
Application::~Application()
{
Renderer2D::Shutdown();
}
void Application::Run()
{
while(running) {
Time::Get().Update();
layer_stack.UpdateLayers();
for (Layer* layer : layer_stack)
for (auto layer : layer_stack)
layer->OnUpdate();
imgui_layer->Begin();
for (Layer* layer : layer_stack)
for (auto layer : layer_stack)
layer->OnImGuiRender();
imgui_layer->End();
@@ -72,13 +81,23 @@ namespace OpenEngine {
return false;
}
void Application::PushLayer(Layer* layer)
void Application::QueueLayerPush(Ref<Layer> layer)
{
layer_stack.PushLayer(layer);
layer_stack.QueueLayerPush(layer);
}
void Application::PushOverlay(Layer* overlay)
void Application::QueueLayerPop(Ref<Layer> layer)
{
layer_stack.PushOverlay(overlay);
layer_stack.QueueLayerPop(layer);
}
void Application::QueueOverlayPush(Ref<Layer> overlay)
{
layer_stack.QueueOverlayPush(overlay);
}
void Application::QueueOverlayPop(Ref<Layer> overlay)
{
layer_stack.QueueOverlayPop(overlay);
}
}