From 941a8e98dc0168da34b2622ddef2de13cbfb880f Mon Sep 17 00:00:00 2001 From: Pcornat Date: Tue, 11 Jan 2022 22:01:57 +0100 Subject: [PATCH] Perfect window now :D --- src/gui.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 005948a..c898401 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -24,16 +24,25 @@ gui::Gui::~Gui() noexcept { void gui::Gui::render_gui() { if (initialized) { + constexpr ImGuiWindowFlags flags = ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoTitleBar; + ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplGlfw_NewFrame(); ImGui::NewFrame(); //TODO GUI - if (!ImGui::Begin("Billy")) { - ImGui::End(); - ImGui::Render(); - return; + { + const ImGuiViewport &viewport = *ImGui::GetMainViewport(); + ImGui::SetNextWindowPos(viewport.Pos); + ImGui::SetNextWindowSize(viewport.Size); } + + // Never collapsed. + ImGui::Begin("Billy", nullptr, flags); + ImGui::Text("Hello world!"); ImGui::Text("Average framerate: %.3f ms/frame (%.1f FPS)", 1000.f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);