gui cleanup

This commit is contained in:
scawful
2024-07-13 11:19:04 -04:00
parent cbbc6865aa
commit 6b50b25601
3 changed files with 34 additions and 17 deletions

View File

@@ -173,27 +173,47 @@ absl::Status MasterEditor::Update() {
auto current_tab_bar = ImGui::GetCurrentContext()->CurrentTabBar;
if (overworld_editor_.jump_to_tab() == -1) {
gui::RenderTabItem("Overworld", [&]() {
if (ImGui::BeginTabItem("Overworld")) {
current_editor_ = &overworld_editor_;
status_ = overworld_editor_.Update();
});
ImGui::EndTabItem();
}
}
gui::RenderTabItem("Dungeon", [&]() {
if (ImGui::BeginTabItem("Dungeon")) {
current_editor_ = &dungeon_editor_;
status_ = dungeon_editor_.Update();
if (overworld_editor_.jump_to_tab() != -1) {
dungeon_editor_.add_room(overworld_editor_.jump_to_tab());
overworld_editor_.jump_to_tab_ = -1;
}
});
ImGui::EndTabItem();
}
gui::RenderTabItem("Graphics",
[&]() { status_ = graphics_editor_.Update(); });
gui::RenderTabItem("Sprites", [&]() { status_ = sprite_editor_.Update(); });
gui::RenderTabItem("Palettes", [&]() { status_ = palette_editor_.Update(); });
gui::RenderTabItem("Screens", [&]() { screen_editor_.Update(); });
gui::RenderTabItem("Music", [&]() { music_editor_.Update(); });
if (ImGui::BeginTabItem("Graphics")) {
status_ = graphics_editor_.Update();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Sprites")) {
status_ = sprite_editor_.Update();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Palettes")) {
status_ = palette_editor_.Update();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Screens")) {
screen_editor_.Update();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Music")) {
music_editor_.Update();
ImGui::EndTabItem();
}
END_TAB_BAR()
ImGui::End();

View File

@@ -293,13 +293,7 @@ void ScreenEditor::DrawDungeonMapsTabs() {
std::string label =
dungeon_map_labels_[selected_dungeon][floor_number][j];
screen_canvas_.DrawText(label, (posX * 2), (posY * 2));
// GFX.drawText(
// e.Graphics, 16 + ((i % 5) * 32), 20 + ((i / 5) * 32),
}
// if (dungmapSelectedTile == i)
// Constants.AzurePen2,
// 10 + ((i % 5) * 32), 12 + ((i / 5) * 32), 32, 32));
}
screen_canvas_.DrawGrid(64.f, 5);
@@ -369,6 +363,9 @@ void ScreenEditor::DrawDungeonMapsEditor() {
rom()->resource_label()->SelectableLabelWithNameEdit(
selected_dungeon == i, "Dungeon Names", absl::StrFormat("%d", i),
dungeon_names[i]);
if (ImGui::IsItemClicked()) {
selected_dungeon = i;
}
}
// Map column

View File

@@ -43,7 +43,7 @@ using ItemLabelFlags = enum ItemLabelFlag {
IMGUI_API void ItemLabel(absl::string_view title, ItemLabelFlags flags);
IMGUI_API ImGuiID GetID(const std::string &id);
IMGUI_API ImGuiID GetID(const std::string& id);
} // namespace gui
} // namespace app