Add table and canvas to UpdateLinkGfxView

This commit is contained in:
scawful
2024-04-13 13:17:25 -04:00
parent a3c27731cd
commit 19ec7b6431
2 changed files with 41 additions and 18 deletions

View File

@@ -51,12 +51,13 @@ absl::Status GraphicsEditor::Update() {
} }
absl::Status GraphicsEditor::UpdateGfxEdit() { absl::Status GraphicsEditor::UpdateGfxEdit() {
TAB_ITEM("Graphics Editor") TAB_ITEM("Sheet Editor")
if (ImGui::BeginTable("##GfxEditTable", 3, kGfxEditTableFlags, if (ImGui::BeginTable("##GfxEditTable", 3, kGfxEditTableFlags,
ImVec2(0, 0))) { ImVec2(0, 0))) {
for (const auto& name : kGfxEditColumnNames) for (const auto& name :
ImGui::TableSetupColumn(name.data()); {"Tilesheets", "Current Graphics", "Palette Controls"})
ImGui::TableSetupColumn(name);
ImGui::TableHeadersRow(); ImGui::TableHeadersRow();
@@ -355,22 +356,44 @@ absl::Status GraphicsEditor::UpdatePaletteColumn() {
absl::Status GraphicsEditor::UpdateLinkGfxView() { absl::Status GraphicsEditor::UpdateLinkGfxView() {
TAB_ITEM("Player Animations") TAB_ITEM("Player Animations")
const auto link_gfx_offset = 0x80000; if (ImGui::BeginTable("##PlayerAnimationTable", 3, kGfxEditTableFlags,
const auto link_gfx_length = 0x7000; ImVec2(0, 0))) {
for (const auto& name : {"Canvas", "Animation Steps", "Properties"})
ImGui::TableSetupColumn(name);
// TODO: Finish Rom::LoadLinkGraphics and implement this ImGui::TableHeadersRow();
if (ImGui::Button("Load Link Graphics (Experimental)")) {
if (rom()->is_loaded()) {
// Load Links graphics from the ROM
rom()->LoadLinkGraphics();
// Split it into the pose data frames NEXT_COLUMN();
// Create an animation step display for the poses link_canvas_.DrawBackground();
// Allow the user to modify the frames used in an anim step link_canvas_.DrawGrid(16.0f);
// LinkOAM_AnimationSteps: int i = 0;
// #_0D85FB for (auto [key, link_sheet] : rom()->link_graphics()) {
int x_offset = 0;
int y_offset = core::kTilesheetHeight * i * 4;
link_canvas_.DrawBitmap(link_sheet, x_offset, y_offset, 4);
i++;
}
link_canvas_.DrawOverlay();
link_canvas_.DrawGrid();
NEXT_COLUMN();
NEXT_COLUMN();
if (ImGui::Button("Load Link Graphics (Experimental)")) {
if (rom()->is_loaded()) {
// Load Links graphics from the ROM
RETURN_IF_ERROR(rom()->LoadLinkGraphics());
// Split it into the pose data frames
// Create an animation step display for the poses
// Allow the user to modify the frames used in an anim step
// LinkOAM_AnimationSteps:
// #_0D85FB
}
} }
} }
ImGui::EndTable();
END_TAB_ITEM() END_TAB_ITEM()
return absl::OkStatus(); return absl::OkStatus();

View File

@@ -50,9 +50,6 @@ constexpr const char* kPaletteGroupAddressesKeys[] = {
"grass", "3d_object", "ow_mini_map", "grass", "3d_object", "ow_mini_map",
}; };
static constexpr std::string_view kGfxEditColumnNames[] = {
"Tilesheets", "Current Graphics", "Palette Controls"};
static constexpr absl::string_view kGfxToolsetColumnNames[] = { static constexpr absl::string_view kGfxToolsetColumnNames[] = {
"#memoryEditor", "#memoryEditor",
"##separator_gfx1", "##separator_gfx1",
@@ -184,6 +181,9 @@ class GraphicsEditor : public SharedROM {
gui::Canvas super_donkey_canvas_; gui::Canvas super_donkey_canvas_;
gui::Canvas current_sheet_canvas_{ImVec2(0x80, 0x20), gui::Canvas current_sheet_canvas_{ImVec2(0x80, 0x20),
gui::CanvasGridSize::k8x8}; gui::CanvasGridSize::k8x8};
gui::Canvas link_canvas_{
ImVec2(core::kTilesheetWidth * 4, core::kTilesheetHeight * 0x10 * 4),
gui::CanvasGridSize::k16x16};
absl::Status status_; absl::Status status_;
}; };