From 53604dc2401b4a93b3e8e5767d5cb78ce6ffca60 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 20 Jul 2024 10:31:22 -0400 Subject: [PATCH] update FlagsMenu --- src/app/editor/master_editor.cc | 7 ++- src/app/editor/settings_editor.cc | 13 ++++- src/app/editor/utils/flags.h | 81 +++++++++++++++---------------- 3 files changed, 55 insertions(+), 46 deletions(-) diff --git a/src/app/editor/master_editor.cc b/src/app/editor/master_editor.cc index 44dee397..f0ef573f 100644 --- a/src/app/editor/master_editor.cc +++ b/src/app/editor/master_editor.cc @@ -540,8 +540,11 @@ void MasterEditor::DrawFileMenu() { MenuItem("Backup ROM", "", &backup_rom_); MenuItem("Save New Auto", "", &save_new_auto_); Separator(); - static FlagsMenu flags_menu; - flags_menu.Draw(); + if (BeginMenu("Experiment Flags")) { + static FlagsMenu flags_menu; + flags_menu.Draw(); + ImGui::EndMenu(); + } ImGui::EndMenu(); } diff --git a/src/app/editor/settings_editor.cc b/src/app/editor/settings_editor.cc index 34774a29..6627ef84 100644 --- a/src/app/editor/settings_editor.cc +++ b/src/app/editor/settings_editor.cc @@ -8,8 +8,13 @@ namespace yaze { namespace app { namespace editor { +using ImGui::BeginChild; +using ImGui::BeginMenu; using ImGui::BeginTabBar; using ImGui::BeginTabItem; +using ImGui::Checkbox; +using ImGui::EndChild; +using ImGui::EndMenu; using ImGui::EndTabBar; using ImGui::EndTabItem; using ImGui::Text; @@ -17,8 +22,12 @@ using ImGui::Text; absl::Status SettingsEditor::Update() { if (BeginTabBar("Settings", ImGuiTabBarFlags_None)) { if (BeginTabItem("General")) { - static FlagsMenu flags; - flags.Draw(); + if (BeginChild("##GeneralSettingsStyleWrapper", ImVec2(0, 0), + ImGuiChildFlags_FrameStyle)) { + static FlagsMenu flags; + flags.Draw(); + } + EndChild(); EndTabItem(); } if (BeginTabItem("Keyboard Shortcuts")) { diff --git a/src/app/editor/utils/flags.h b/src/app/editor/utils/flags.h index 985d27ec..1102ab03 100644 --- a/src/app/editor/utils/flags.h +++ b/src/app/editor/utils/flags.h @@ -16,50 +16,47 @@ using ImGui::Separator; struct FlagsMenu : public core::ExperimentFlags { void Draw() { - if (BeginMenu("Experiment Flags")) { - if (BeginMenu("Overworld Flags")) { - Checkbox("Enable Overworld Sprites", - &mutable_flags()->overworld.kDrawOverworldSprites); - Separator(); - Checkbox("Save Overworld Maps", - &mutable_flags()->overworld.kSaveOverworldMaps); - Checkbox("Save Overworld Entrances", - &mutable_flags()->overworld.kSaveOverworldEntrances); - Checkbox("Save Overworld Exits", - &mutable_flags()->overworld.kSaveOverworldExits); - Checkbox("Save Overworld Items", - &mutable_flags()->overworld.kSaveOverworldItems); - Checkbox("Save Overworld Properties", - &mutable_flags()->overworld.kSaveOverworldProperties); - ImGui::EndMenu(); - } - - if (BeginMenu("Dungeon Flags")) { - Checkbox("Draw Dungeon Room Graphics", - &mutable_flags()->kDrawDungeonRoomGraphics); - Separator(); - Checkbox("Save Dungeon Maps", &mutable_flags()->kSaveDungeonMaps); - ImGui::EndMenu(); - } - - if (BeginMenu("Emulator Flags")) { - Checkbox("Load Audio Device", &mutable_flags()->kLoadAudioDevice); - ImGui::EndMenu(); - } - - Checkbox("Use built-in file dialog", - &mutable_flags()->kNewFileDialogWrapper); - Checkbox("Enable Console Logging", &mutable_flags()->kLogToConsole); - Checkbox("Enable Texture Streaming", - &mutable_flags()->kLoadTexturesAsStreaming); - Checkbox("Use Bitmap Manager", &mutable_flags()->kUseBitmapManager); - Checkbox("Log Instructions to Debugger", - &mutable_flags()->kLogInstructions); - Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); - Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups); - Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput); + if (BeginMenu("Overworld Flags")) { + Checkbox("Enable Overworld Sprites", + &mutable_flags()->overworld.kDrawOverworldSprites); + Separator(); + Checkbox("Save Overworld Maps", + &mutable_flags()->overworld.kSaveOverworldMaps); + Checkbox("Save Overworld Entrances", + &mutable_flags()->overworld.kSaveOverworldEntrances); + Checkbox("Save Overworld Exits", + &mutable_flags()->overworld.kSaveOverworldExits); + Checkbox("Save Overworld Items", + &mutable_flags()->overworld.kSaveOverworldItems); + Checkbox("Save Overworld Properties", + &mutable_flags()->overworld.kSaveOverworldProperties); ImGui::EndMenu(); } + + if (BeginMenu("Dungeon Flags")) { + Checkbox("Draw Dungeon Room Graphics", + &mutable_flags()->kDrawDungeonRoomGraphics); + Separator(); + Checkbox("Save Dungeon Maps", &mutable_flags()->kSaveDungeonMaps); + ImGui::EndMenu(); + } + + if (BeginMenu("Emulator Flags")) { + Checkbox("Load Audio Device", &mutable_flags()->kLoadAudioDevice); + ImGui::EndMenu(); + } + + Checkbox("Use built-in file dialog", + &mutable_flags()->kNewFileDialogWrapper); + Checkbox("Enable Console Logging", &mutable_flags()->kLogToConsole); + Checkbox("Enable Texture Streaming", + &mutable_flags()->kLoadTexturesAsStreaming); + Checkbox("Use Bitmap Manager", &mutable_flags()->kUseBitmapManager); + Checkbox("Log Instructions to Debugger", + &mutable_flags()->kLogInstructions); + Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes); + Checkbox("Save Gfx Groups", &mutable_flags()->kSaveGfxGroups); + Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput); } };