From a2609bbdc652ce8ff52ebeaf53713b7b6981ba0e Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 10 Jul 2023 20:37:28 +0200 Subject: [PATCH] fix(gui): dont draw two gui separators at the top for lua only tab. (#1677) --- src/lua/lua_manager.cpp | 11 ++++++++++- src/views/core/view_active_view.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lua/lua_manager.cpp b/src/lua/lua_manager.cpp index 6ce724ed..be102100 100644 --- a/src/lua/lua_manager.cpp +++ b/src/lua/lua_manager.cpp @@ -46,14 +46,23 @@ namespace big { std::lock_guard guard(m_module_lock); + bool add_separator = false; + for (const auto& module : m_modules) { if (const auto it = module->m_gui.find(tab_hash); it != module->m_gui.end()) { - ImGui::Separator(); + if (add_separator) + { + ImGui::Separator(); + add_separator = false; + } for (const auto& element : it->second) + { element->draw(); + add_separator = true; + } } } } diff --git a/src/views/core/view_active_view.cpp b/src/views/core/view_active_view.cpp index 7d99c8b5..6fa30579 100644 --- a/src/views/core/view_active_view.cpp +++ b/src/views/core/view_active_view.cpp @@ -36,8 +36,14 @@ namespace big ImGui::Separator(); if (selected->func) + { selected->func(); + const auto has_lua_gui_to_draw = g_lua_manager && g_lua_manager->has_gui_to_draw(selected->hash); + if (has_lua_gui_to_draw) + ImGui::Separator(); + } + if (g_lua_manager) g_lua_manager->draw_gui(selected->hash);