From 7006e5555855572e9750d99f0de98799ba6e55c4 Mon Sep 17 00:00:00 2001 From: Yimura Date: Fri, 21 May 2021 02:28:14 +0200 Subject: [PATCH] feat(TopBar): Toggle main window --- BigBaseV2/src/core/globals.hpp | 5 +++++ BigBaseV2/src/gui/window/window_main.cpp | 2 +- BigBaseV2/src/gui/window/window_top_bar.cpp | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index 9ac4a131..e69b8e50 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -26,9 +26,14 @@ struct globals { char vehicle_gun_model[12] = "bus"; }; + struct window { + bool main = true; + }; + self self{}; vehicle vehicle{}; weapons weapons{}; + window window{}; void from_json(const nlohmann::json& j) { diff --git a/BigBaseV2/src/gui/window/window_main.cpp b/BigBaseV2/src/gui/window/window_main.cpp index 96636562..192ad01f 100644 --- a/BigBaseV2/src/gui/window/window_main.cpp +++ b/BigBaseV2/src/gui/window/window_main.cpp @@ -7,7 +7,7 @@ namespace big void window::main() { ImGui::SetNextWindowSize({ 800, 840 }, ImGuiCond_FirstUseEver); - if (ImGui::Begin("Yimura's Mod Menu")) + if (g.window.main && ImGui::Begin("Yimura's Mod Menu", &g.window.main)) { ImGui::BeginTabBar("tabbar"); tab_main::tab_self(); diff --git a/BigBaseV2/src/gui/window/window_top_bar.cpp b/BigBaseV2/src/gui/window/window_top_bar.cpp index f4812381..0f86dcec 100644 --- a/BigBaseV2/src/gui/window/window_top_bar.cpp +++ b/BigBaseV2/src/gui/window/window_top_bar.cpp @@ -51,6 +51,13 @@ namespace big ImGui::EndMenu(); } + if (ImGui::BeginMenu("Windows")) + { + ImGui::MenuItem("Main Window", nullptr, &g.window.main); + + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("Quit")) { if (ImGui::MenuItem("Unload Menu (may crash)"))