From 0f74a5c3a4274beadf9df32101d89cb26968a925 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 9 Nov 2019 14:05:52 +0100 Subject: [PATCH] - make the ImGui popup close on request. --- source/build/src/engine.cpp | 3 ++- source/duke3d/src/menus.cpp | 7 ++++++- source/glbackend/glbackend.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index d9d1b8bc2..e35f25402 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -10233,10 +10233,11 @@ void videoNextPage(void) videoEndDrawing(); //}}} // Draw the ImGui menu on top of the game content, but below the console (if open.) - if (GUICapture & 2) + if (GUICapture & 6) { ImGui::Render(); GLInterface.DrawImGui(ImGui::GetDrawData()); + GUICapture &= ~4; } // Draw the console plus debug output on top of everything else. diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 5e0f4e56e..c76611de0 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -7069,8 +7069,13 @@ void M_DisplayMenus(void) if (GUICapture & 2) { ImGui_Begin_Frame(); - bool b; + bool b = true; ImGui::ShowDemoWindow(&b); + if (!b) + { + GUICapture &= ~2; + GUICapture |= 4; + } return; } diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 3d0d85abc..84f93f0ae 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -40,6 +40,7 @@ #include "textures.h" #include "palette.h" #include "imgui.h" +#include "gamecontrol.h" #include "imgui_impl_sdl.h" #include "imgui_impl_opengl3.h" #include "baselayer.h" @@ -101,7 +102,11 @@ void GLInstance::Init(int ydim) ImGui::StyleColorsDark(); ImGui_Init_Backend(); ImGui_ImplOpenGL3_Init(); - if (!ttf.Size()) ttf = kloadfile("demolition/Roboto-Regular.ttf", 0); + if (!ttf.Size()) + { + //ttf = kloadfile("demolition/Capsmall_clean.ttf", 0); + ttf = kloadfile("demolition/Roboto-Regular.ttf", 0); + } if (ttf.Size()) io.Fonts->AddFontFromMemoryTTF(ttf.Data(), ttf.Size(), std::clamp(ydim / 40, 10, 30)); }