diff options
Diffstat (limited to 'src/imgui_context.cpp')
-rw-r--r-- | src/imgui_context.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/imgui_context.cpp b/src/imgui_context.cpp index d0f9206..f45b22b 100644 --- a/src/imgui_context.cpp +++ b/src/imgui_context.cpp @@ -1,5 +1,6 @@ #include "imgui_context.hpp" +#include <SDL_opengl.h> #include <imgui/imgui_impl_opengl3.h> #include <imgui/imgui_impl_sdl2.h> @@ -17,6 +18,14 @@ ImguiContext::ImguiContext(GlContext& glContext, SdlContext& sdlContext, SdlMain ImGui::StyleColorsDark(); // ImGui::StyleColorsLight(); + auto& style = ImGui::GetStyle(); + style.WindowRounding = 0.0f;// <- Set this on init or use ImGui::PushStyleVar() + style.ChildRounding = 0.0f; + style.FrameRounding = 0.0f; + style.GrabRounding = 0.0f; + style.PopupRounding = 0.0f; + style.ScrollbarRounding = 0.0f; + ImGui_ImplSDL2_InitForOpenGL(mainWindow.window(), glContext.context()); ImGui_ImplOpenGL3_Init(sdlContext.glslVersion()); } @@ -53,6 +62,15 @@ void ImguiContext::startFrame() const void ImguiContext::render() const { ImGui::Render(); + const auto& imguiIO = getIO(); + const auto width = static_cast<int>(imguiIO.DisplaySize.x); + const auto height = static_cast<int>(imguiIO.DisplaySize.y); + glViewport(0, 0, width, height); + constexpr ImVec4 clearColor{0.45f, 0.55f, 0.60f, 1.00f}; + glClearColor(clearColor.x * clearColor.w, clearColor.y * clearColor.w, clearColor.z * clearColor.w, clearColor.w); + glClear(GL_COLOR_BUFFER_BIT); + + ImGui::Render(); ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); SDL_GL_SwapWindow(m_mainWindow.window()); } |