- make the ImGui popup close on request.

This commit is contained in:
Christoph Oelckers 2019-11-09 14:05:52 +01:00
parent fd4680c347
commit 0f74a5c3a4
3 changed files with 14 additions and 3 deletions

View file

@ -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.

View file

@ -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;
}

View file

@ -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));
}