Refactor FlagsMenu to core namespace; remove redundant flags.h file and update references in editor files
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
@@ -100,6 +102,51 @@ class FeatureFlags {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using ImGui::BeginMenu;
|
||||||
|
using ImGui::Checkbox;
|
||||||
|
using ImGui::EndMenu;
|
||||||
|
using ImGui::MenuItem;
|
||||||
|
using ImGui::Separator;
|
||||||
|
|
||||||
|
struct FlagsMenu {
|
||||||
|
void DrawOverworldFlags() {
|
||||||
|
Checkbox("Enable Overworld Sprites",
|
||||||
|
&FeatureFlags::get().overworld.kDrawOverworldSprites);
|
||||||
|
Separator();
|
||||||
|
Checkbox("Save Overworld Maps",
|
||||||
|
&FeatureFlags::get().overworld.kSaveOverworldMaps);
|
||||||
|
Checkbox("Save Overworld Entrances",
|
||||||
|
&FeatureFlags::get().overworld.kSaveOverworldEntrances);
|
||||||
|
Checkbox("Save Overworld Exits",
|
||||||
|
&FeatureFlags::get().overworld.kSaveOverworldExits);
|
||||||
|
Checkbox("Save Overworld Items",
|
||||||
|
&FeatureFlags::get().overworld.kSaveOverworldItems);
|
||||||
|
Checkbox("Save Overworld Properties",
|
||||||
|
&FeatureFlags::get().overworld.kSaveOverworldProperties);
|
||||||
|
Checkbox("Load Custom Overworld",
|
||||||
|
&FeatureFlags::get().overworld.kLoadCustomOverworld);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawDungeonFlags() {
|
||||||
|
Checkbox("Draw Dungeon Room Graphics",
|
||||||
|
&FeatureFlags::get().kDrawDungeonRoomGraphics);
|
||||||
|
Separator();
|
||||||
|
Checkbox("Save Dungeon Maps", &FeatureFlags::get().kSaveDungeonMaps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawResourceFlags() {
|
||||||
|
Checkbox("Save All Palettes", &FeatureFlags::get().kSaveAllPalettes);
|
||||||
|
Checkbox("Save Gfx Groups", &FeatureFlags::get().kSaveGfxGroups);
|
||||||
|
Checkbox("Save Graphics Sheets", &FeatureFlags::get().kSaveGraphicsSheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawSystemFlags() {
|
||||||
|
Checkbox("Enable Console Logging", &FeatureFlags::get().kLogToConsole);
|
||||||
|
Checkbox("Log Instructions to Emulator Debugger",
|
||||||
|
&FeatureFlags::get().kLogInstructions);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace core
|
} // namespace core
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "app/editor/music/music_editor.h"
|
#include "app/editor/music/music_editor.h"
|
||||||
#include "app/editor/overworld/overworld_editor.h"
|
#include "app/editor/overworld/overworld_editor.h"
|
||||||
#include "app/editor/sprite/sprite_editor.h"
|
#include "app/editor/sprite/sprite_editor.h"
|
||||||
#include "app/editor/system/flags.h"
|
|
||||||
#include "app/emu/emulator.h"
|
#include "app/emu/emulator.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/gui/input.h"
|
#include "app/gui/input.h"
|
||||||
@@ -468,7 +467,7 @@ void EditorManager::DrawMenuContent() {
|
|||||||
MenuItem("Backup ROM", "", &backup_rom_);
|
MenuItem("Backup ROM", "", &backup_rom_);
|
||||||
MenuItem("Save New Auto", "", &save_new_auto_);
|
MenuItem("Save New Auto", "", &save_new_auto_);
|
||||||
Separator();
|
Separator();
|
||||||
static FlagsMenu flags_menu;
|
static core::FlagsMenu flags_menu;
|
||||||
if (BeginMenu("System Flags")) {
|
if (BeginMenu("System Flags")) {
|
||||||
flags_menu.DrawSystemFlags();
|
flags_menu.DrawSystemFlags();
|
||||||
EndMenu();
|
EndMenu();
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
#ifndef YAZE_APP_EDITOR_UTILS_FLAGS_H
|
|
||||||
#define YAZE_APP_EDITOR_UTILS_FLAGS_H
|
|
||||||
|
|
||||||
#include "app/core/features.h"
|
|
||||||
#include "core/common.h"
|
|
||||||
#include "imgui/imgui.h"
|
|
||||||
|
|
||||||
namespace yaze {
|
|
||||||
namespace editor {
|
|
||||||
|
|
||||||
using core::FeatureFlags;
|
|
||||||
using ImGui::BeginMenu;
|
|
||||||
using ImGui::Checkbox;
|
|
||||||
using ImGui::EndMenu;
|
|
||||||
using ImGui::MenuItem;
|
|
||||||
using ImGui::Separator;
|
|
||||||
|
|
||||||
struct FlagsMenu {
|
|
||||||
void DrawOverworldFlags() {
|
|
||||||
Checkbox("Enable Overworld Sprites",
|
|
||||||
&FeatureFlags::get().overworld.kDrawOverworldSprites);
|
|
||||||
Separator();
|
|
||||||
Checkbox("Save Overworld Maps",
|
|
||||||
&FeatureFlags::get().overworld.kSaveOverworldMaps);
|
|
||||||
Checkbox("Save Overworld Entrances",
|
|
||||||
&FeatureFlags::get().overworld.kSaveOverworldEntrances);
|
|
||||||
Checkbox("Save Overworld Exits",
|
|
||||||
&FeatureFlags::get().overworld.kSaveOverworldExits);
|
|
||||||
Checkbox("Save Overworld Items",
|
|
||||||
&FeatureFlags::get().overworld.kSaveOverworldItems);
|
|
||||||
Checkbox("Save Overworld Properties",
|
|
||||||
&FeatureFlags::get().overworld.kSaveOverworldProperties);
|
|
||||||
Checkbox("Load Custom Overworld",
|
|
||||||
&FeatureFlags::get().overworld.kLoadCustomOverworld);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawDungeonFlags() {
|
|
||||||
Checkbox("Draw Dungeon Room Graphics",
|
|
||||||
&FeatureFlags::get().kDrawDungeonRoomGraphics);
|
|
||||||
Separator();
|
|
||||||
Checkbox("Save Dungeon Maps", &FeatureFlags::get().kSaveDungeonMaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawResourceFlags() {
|
|
||||||
Checkbox("Save All Palettes", &FeatureFlags::get().kSaveAllPalettes);
|
|
||||||
Checkbox("Save Gfx Groups", &FeatureFlags::get().kSaveGfxGroups);
|
|
||||||
Checkbox("Save Graphics Sheets", &FeatureFlags::get().kSaveGraphicsSheet);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawSystemFlags() {
|
|
||||||
Checkbox("Enable Console Logging", &FeatureFlags::get().kLogToConsole);
|
|
||||||
Checkbox("Log Instructions to Emulator Debugger",
|
|
||||||
&FeatureFlags::get().kLogInstructions);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace editor
|
|
||||||
} // namespace yaze
|
|
||||||
|
|
||||||
#endif // YAZE_APP_EDITOR_UTILS_FLAGS_H_
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
#include "app/editor/system/settings_editor.h"
|
#include "app/editor/system/settings_editor.h"
|
||||||
|
|
||||||
#include "app/gui/style.h"
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "app/editor/system/flags.h"
|
#include "app/core/features.h"
|
||||||
|
#include "app/gui/style.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -49,43 +49,42 @@ absl::Status SettingsEditor::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SettingsEditor::DrawGeneralSettings() {
|
void SettingsEditor::DrawGeneralSettings() {
|
||||||
static FlagsMenu flags;
|
static core::FlagsMenu flags;
|
||||||
|
|
||||||
if (BeginTable("##SettingsTable", 4,
|
if (BeginTable("##SettingsTable", 4,
|
||||||
ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
|
ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
|
||||||
TableSetupColumn("System Flags", ImGuiTableColumnFlags_WidthStretch);
|
TableSetupColumn("System Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||||
TableSetupColumn("Overworld Flags", ImGuiTableColumnFlags_WidthStretch);
|
TableSetupColumn("Overworld Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||||
TableSetupColumn("Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
|
TableSetupColumn("Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||||
TableSetupColumn("Resource Flags", ImGuiTableColumnFlags_WidthStretch,
|
TableSetupColumn("Resource Flags", ImGuiTableColumnFlags_WidthStretch,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
TableHeadersRow();
|
TableHeadersRow();
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
if (BeginChild("##SystemFlags", ImVec2(0, 0),
|
if (BeginChild("##SystemFlags", ImVec2(0, 0), ImGuiChildFlags_FrameStyle)) {
|
||||||
ImGuiChildFlags_FrameStyle)) {
|
|
||||||
flags.DrawSystemFlags();
|
flags.DrawSystemFlags();
|
||||||
EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
if (BeginChild("##OverworldFlags", ImVec2(0, 0),
|
if (BeginChild("##OverworldFlags", ImVec2(0, 0),
|
||||||
ImGuiChildFlags_FrameStyle)) {
|
ImGuiChildFlags_FrameStyle)) {
|
||||||
flags.DrawOverworldFlags();
|
flags.DrawOverworldFlags();
|
||||||
EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
if (BeginChild("##DungeonFlags", ImVec2(0, 0),
|
if (BeginChild("##DungeonFlags", ImVec2(0, 0),
|
||||||
ImGuiChildFlags_FrameStyle)) {
|
ImGuiChildFlags_FrameStyle)) {
|
||||||
flags.DrawDungeonFlags();
|
flags.DrawDungeonFlags();
|
||||||
EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
if (BeginChild("##ResourceFlags", ImVec2(0, 0),
|
if (BeginChild("##ResourceFlags", ImVec2(0, 0),
|
||||||
ImGuiChildFlags_FrameStyle)) {
|
ImGuiChildFlags_FrameStyle)) {
|
||||||
flags.DrawResourceFlags();
|
flags.DrawResourceFlags();
|
||||||
EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user