diff --git a/SakuraCore/src/Application.cpp b/SakuraCore/src/Application.cpp index 2bc35d2..468be10 100644 --- a/SakuraCore/src/Application.cpp +++ b/SakuraCore/src/Application.cpp @@ -3,6 +3,7 @@ #include "Layer.h" #include "Log.h" #include "SDL3/SDL_events.h" +#include "SDL3/SDL_hints.h" #include "SDL3/SDL_main.h" #include "SDL3/SDL_render.h" #include "SDL3/SDL_stdinc.h" @@ -136,6 +137,11 @@ void Application::Run() { } // Rendering + + for (auto &layer : m_LayerStack) { + layer->OnRender(); + } + m_ImGui->Begin(); SDL_SetRenderScale(m_Renderer, io.DisplayFramebufferScale.x, io.DisplayFramebufferScale.y); @@ -148,6 +154,11 @@ void Application::Run() { m_ImGui->End(); + if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) { + ImGui::UpdatePlatformWindows(); + ImGui::RenderPlatformWindowsDefault(); + } + SDL_RenderPresent(m_Renderer); } } diff --git a/SakuraCore/src/Layer.h b/SakuraCore/src/Layer.h index 695a0e4..a24e6e9 100644 --- a/SakuraCore/src/Layer.h +++ b/SakuraCore/src/Layer.h @@ -17,6 +17,7 @@ public: virtual void OnAttach() {} virtual void OnDetach() {} virtual void OnImGuiRender() {} + virtual void OnRender() {} virtual void Suspend() { m_isActive = false; } virtual void Activate() { m_isActive = true; } diff --git a/SakuraCore/src/imguiinit.cpp b/SakuraCore/src/imguiinit.cpp index 4b562a8..d739c58 100644 --- a/SakuraCore/src/imguiinit.cpp +++ b/SakuraCore/src/imguiinit.cpp @@ -17,6 +17,7 @@ void ImGuiInit::Init() { ImGuiIO &io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; + io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; ImGui::StyleColorsDark();