Refactor tab handling in Dungeon and Graphics editors for improved readability

This commit is contained in:
scawful
2024-11-13 09:42:54 -05:00
parent 12309f460e
commit e3ed705336
6 changed files with 64 additions and 57 deletions

View File

@@ -49,21 +49,22 @@ absl::Status DungeonEditor::Update() {
refresh_graphics_ = false;
}
TAB_BAR("##DungeonEditorTabBar")
TAB_ITEM("Room Editor")
status_ = UpdateDungeonRoomView();
END_TAB_ITEM()
TAB_ITEM("Usage Statistics")
if (is_loaded_) {
static bool calc_stats = false;
if (!calc_stats) {
CalculateUsageStats();
calc_stats = true;
if (ImGui::BeginTabBar("##DungeonEditorTabBar")) {
TAB_ITEM("Room Editor")
status_ = UpdateDungeonRoomView();
END_TAB_ITEM()
TAB_ITEM("Usage Statistics")
if (is_loaded_) {
static bool calc_stats = false;
if (!calc_stats) {
CalculateUsageStats();
calc_stats = true;
}
DrawUsageStats();
}
DrawUsageStats();
END_TAB_ITEM()
ImGui::EndTabBar();
}
END_TAB_ITEM()
END_TAB_BAR()
return absl::OkStatus();
}
@@ -194,14 +195,15 @@ absl::Status DungeonEditor::UpdateDungeonRoomView() {
TableNextRow();
TableNextColumn();
TAB_BAR("##DungeonRoomTabBar");
TAB_ITEM("Rooms");
DrawRoomSelector();
END_TAB_ITEM();
TAB_ITEM("Entrances");
DrawEntranceSelector();
END_TAB_ITEM();
END_TAB_BAR();
if (ImGui::BeginTabBar("##DungeonRoomTabBar")) {
TAB_ITEM("Rooms");
DrawRoomSelector();
END_TAB_ITEM();
TAB_ITEM("Entrances");
DrawEntranceSelector();
END_TAB_ITEM();
ImGui::EndTabBar();
}
TableNextColumn();
DrawDungeonTabView();