mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
improv: ImGui test engine window can now be opened and closed from debug menu (#2310)
This commit is contained in:
@@ -362,6 +362,12 @@ namespace ImGuiExt {
|
||||
else static_assert(hex::always_false<T>::value, "Invalid data type!");
|
||||
}
|
||||
|
||||
struct ImGuiTestEngine {
|
||||
ImGuiTestEngine() = delete;
|
||||
|
||||
static void setEnabled(bool enabled);
|
||||
[[nodiscard]] static bool isEnabled();
|
||||
};
|
||||
}
|
||||
|
||||
// these functions are exception because they just allow conversion from string to char*, they do not really add anything
|
||||
|
||||
@@ -1443,6 +1443,16 @@ namespace ImGuiExt {
|
||||
// Return the button press state
|
||||
ImGui::PopClipRect();
|
||||
}
|
||||
|
||||
static bool s_imguiTestEngineEnabled = false;
|
||||
|
||||
void ImGuiTestEngine::setEnabled(bool enabled) {
|
||||
s_imguiTestEngineEnabled = enabled;
|
||||
}
|
||||
|
||||
bool ImGuiTestEngine::isEnabled() {
|
||||
return s_imguiTestEngineEnabled;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ImGui {
|
||||
|
||||
@@ -407,9 +407,9 @@ namespace hex {
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
||||
#if defined(IMGUI_TEST_ENGINE)
|
||||
if (ImGuiExt::ImGuiTestEngine::isEnabled())
|
||||
ImGuiTestEngine_ShowTestEngineWindows(m_testEngine, nullptr);
|
||||
#endif
|
||||
|
||||
|
||||
TutorialManager::drawTutorial();
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace hex::plugin::builtin {
|
||||
static bool showImGuiDemo = false;
|
||||
static bool showImPlotDemo = false;
|
||||
static bool showImPlot3DDemo = false;
|
||||
static bool showTestEngine = false;
|
||||
|
||||
ImGui::SetNextWindowSize(scaled({ 300, 150 }), ImGuiCond_Always);
|
||||
if (ImGui::BeginPopup("DebugMenu")) {
|
||||
@@ -109,6 +110,7 @@ namespace hex::plugin::builtin {
|
||||
if (ImGui::BeginChild("Scrolling", ImGui::GetContentRegionAvail())) {
|
||||
auto ctx = ImGui::GetCurrentContext();
|
||||
ImGui::Checkbox("Show ImGui Demo", &showImGuiDemo);
|
||||
ImGui::Checkbox("Show ImGui Test Engine",&showTestEngine);
|
||||
ImGui::Checkbox("Show ImPlot Demo", &showImPlotDemo);
|
||||
ImGui::Checkbox("Show ImPlot3D Demo", &showImPlot3DDemo);
|
||||
|
||||
@@ -158,6 +160,7 @@ namespace hex::plugin::builtin {
|
||||
|
||||
if (showImGuiDemo)
|
||||
ImGui::ShowDemoWindow(&showImGuiDemo);
|
||||
ImGuiExt::ImGuiTestEngine::setEnabled(showTestEngine);
|
||||
if (showImPlotDemo)
|
||||
ImPlot::ShowDemoWindow(&showImPlotDemo);
|
||||
if (showImPlot3DDemo)
|
||||
|
||||
Reference in New Issue
Block a user