Refactor FlagsMenu to core namespace; remove redundant flags.h file and update references in editor files
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
#include "app/editor/music/music_editor.h"
|
||||
#include "app/editor/overworld/overworld_editor.h"
|
||||
#include "app/editor/sprite/sprite_editor.h"
|
||||
#include "app/editor/system/flags.h"
|
||||
#include "app/emu/emulator.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
@@ -468,7 +467,7 @@ void EditorManager::DrawMenuContent() {
|
||||
MenuItem("Backup ROM", "", &backup_rom_);
|
||||
MenuItem("Save New Auto", "", &save_new_auto_);
|
||||
Separator();
|
||||
static FlagsMenu flags_menu;
|
||||
static core::FlagsMenu flags_menu;
|
||||
if (BeginMenu("System Flags")) {
|
||||
flags_menu.DrawSystemFlags();
|
||||
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/gui/style.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"
|
||||
|
||||
namespace yaze {
|
||||
@@ -49,43 +49,42 @@ absl::Status SettingsEditor::Update() {
|
||||
}
|
||||
|
||||
void SettingsEditor::DrawGeneralSettings() {
|
||||
static FlagsMenu flags;
|
||||
static core::FlagsMenu flags;
|
||||
|
||||
if (BeginTable("##SettingsTable", 4,
|
||||
ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable)) {
|
||||
TableSetupColumn("System Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||
TableSetupColumn("Overworld Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||
TableSetupColumn("Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||
TableSetupColumn("Dungeon Flags", ImGuiTableColumnFlags_WidthStretch);
|
||||
TableSetupColumn("Resource Flags", ImGuiTableColumnFlags_WidthStretch,
|
||||
0.0f);
|
||||
|
||||
TableHeadersRow();
|
||||
|
||||
TableNextColumn();
|
||||
if (BeginChild("##SystemFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
if (BeginChild("##SystemFlags", ImVec2(0, 0), ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawSystemFlags();
|
||||
EndChild();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
if (BeginChild("##OverworldFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawOverworldFlags();
|
||||
EndChild();
|
||||
}
|
||||
if (BeginChild("##OverworldFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawOverworldFlags();
|
||||
EndChild();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
if (BeginChild("##DungeonFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawDungeonFlags();
|
||||
EndChild();
|
||||
}
|
||||
if (BeginChild("##DungeonFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawDungeonFlags();
|
||||
EndChild();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
if (BeginChild("##ResourceFlags", ImVec2(0, 0),
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
ImGuiChildFlags_FrameStyle)) {
|
||||
flags.DrawResourceFlags();
|
||||
EndChild();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user