added onrender function to use sdl render in client, enabled multiviewports in imgui
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user