add multi select to gfx sheet list
This commit is contained in:
@@ -25,12 +25,18 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
|
using gfx::kPaletteGroupAddressesKeys;
|
||||||
using ImGui::Button;
|
using ImGui::Button;
|
||||||
using ImGui::InputInt;
|
using ImGui::InputInt;
|
||||||
using ImGui::InputText;
|
using ImGui::InputText;
|
||||||
using ImGui::SameLine;
|
using ImGui::SameLine;
|
||||||
using ImGui::TableNextColumn;
|
using ImGui::TableNextColumn;
|
||||||
|
|
||||||
|
static constexpr absl::string_view kGfxToolsetColumnNames[] = {
|
||||||
|
"#memoryEditor",
|
||||||
|
"##separator_gfx1",
|
||||||
|
};
|
||||||
|
|
||||||
constexpr ImGuiTableFlags kGfxEditTableFlags =
|
constexpr ImGuiTableFlags kGfxEditTableFlags =
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
|
||||||
ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
|
ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable |
|
||||||
@@ -41,6 +47,10 @@ constexpr ImGuiTabBarFlags kGfxEditTabBarFlags =
|
|||||||
ImGuiTabBarFlags_FittingPolicyResizeDown |
|
ImGuiTabBarFlags_FittingPolicyResizeDown |
|
||||||
ImGuiTabBarFlags_TabListPopupButton;
|
ImGuiTabBarFlags_TabListPopupButton;
|
||||||
|
|
||||||
|
constexpr ImGuiTableFlags kGfxEditFlags = ImGuiTableFlags_Reorderable |
|
||||||
|
ImGuiTableFlags_Resizable |
|
||||||
|
ImGuiTableFlags_SizingStretchSame;
|
||||||
|
|
||||||
absl::Status GraphicsEditor::Update() {
|
absl::Status GraphicsEditor::Update() {
|
||||||
TAB_BAR("##TabBar")
|
TAB_BAR("##TabBar")
|
||||||
status_ = UpdateGfxEdit();
|
status_ = UpdateGfxEdit();
|
||||||
@@ -184,17 +194,25 @@ absl::Status GraphicsEditor::UpdateGfxSheetList() {
|
|||||||
"##GfxEditChild", ImVec2(0, 0), true,
|
"##GfxEditChild", ImVec2(0, 0), true,
|
||||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
|
||||||
|
// TODO: Update the interaction for multi select on sheets
|
||||||
|
static ImGuiSelectionBasicStorage selection;
|
||||||
|
ImGuiMultiSelectFlags flags =
|
||||||
|
ImGuiMultiSelectFlags_ClearOnEscape | ImGuiMultiSelectFlags_BoxSelect1d;
|
||||||
|
ImGuiMultiSelectIO* ms_io = ImGui::BeginMultiSelect(
|
||||||
|
flags, selection.Size, rom()->bitmap_manager().size());
|
||||||
|
selection.ApplyRequests(ms_io);
|
||||||
|
ImGuiListClipper clipper;
|
||||||
|
clipper.Begin(rom()->bitmap_manager().size());
|
||||||
|
if (ms_io->RangeSrcItem != -1)
|
||||||
|
clipper.IncludeItemByIndex(
|
||||||
|
(int)ms_io->RangeSrcItem); // Ensure RangeSrc item is not clipped.
|
||||||
|
|
||||||
for (auto& [key, value] : rom()->bitmap_manager()) {
|
for (auto& [key, value] : rom()->bitmap_manager()) {
|
||||||
ImGui::BeginChild(absl::StrFormat("##GfxSheet%02X", key).c_str(),
|
ImGui::BeginChild(absl::StrFormat("##GfxSheet%02X", key).c_str(),
|
||||||
ImVec2(0x100 + 1, 0x40 + 1), true,
|
ImVec2(0x100 + 1, 0x40 + 1), true,
|
||||||
ImGuiWindowFlags_NoDecoration);
|
ImGuiWindowFlags_NoDecoration);
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
gui::Canvas graphics_bin_canvas_;
|
gui::Canvas graphics_bin_canvas_;
|
||||||
// auto select_tile_event = [&]() {
|
|
||||||
// };
|
|
||||||
// graphics_bin_canvas_.UpdateEvent(
|
|
||||||
// select_tile_event, ImVec2(0x100 + 1, 0x40 + 1), 0x20, sheet_scale_,
|
|
||||||
// /*grid_size=*/16.0f);
|
|
||||||
|
|
||||||
graphics_bin_canvas_.DrawBackground(ImVec2(0x100 + 1, 0x40 + 1));
|
graphics_bin_canvas_.DrawBackground(ImVec2(0x100 + 1, 0x40 + 1));
|
||||||
graphics_bin_canvas_.DrawContextMenu();
|
graphics_bin_canvas_.DrawContextMenu();
|
||||||
@@ -236,6 +254,8 @@ absl::Status GraphicsEditor::UpdateGfxSheetList() {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
ms_io = ImGui::EndMultiSelect();
|
||||||
|
selection.ApplyRequests(ms_io);
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,21 +44,6 @@ const std::string kSuperDonkeySprites[] = {
|
|||||||
"BE115", "BE5C2", "BEB63", "BF0CB", "BF607", "BFA55", "BFD71", "C017D",
|
"BE115", "BE5C2", "BEB63", "BF0CB", "BF607", "BFA55", "BFD71", "C017D",
|
||||||
"C0567", "C0981", "C0BA7", "C116D", "C166A", "C1FE0", "C24CE", "C2B19"};
|
"C0567", "C0981", "C0BA7", "C116D", "C166A", "C1FE0", "C24CE", "C2B19"};
|
||||||
|
|
||||||
constexpr const char* kPaletteGroupAddressesKeys[] = {
|
|
||||||
"ow_main", "ow_aux", "ow_animated", "hud",
|
|
||||||
"global_sprites", "armors", "swords", "shields",
|
|
||||||
"sprites_aux1", "sprites_aux2", "sprites_aux3", "dungeon_main",
|
|
||||||
"grass", "3d_object", "ow_mini_map",
|
|
||||||
};
|
|
||||||
|
|
||||||
static constexpr absl::string_view kGfxToolsetColumnNames[] = {
|
|
||||||
"#memoryEditor",
|
|
||||||
"##separator_gfx1",
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr ImGuiTableFlags kGfxEditFlags = ImGuiTableFlags_Reorderable |
|
|
||||||
ImGuiTableFlags_Resizable |
|
|
||||||
ImGuiTableFlags_SizingStretchSame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GraphicsEditor
|
* @class GraphicsEditor
|
||||||
|
|||||||
Reference in New Issue
Block a user