Tile16Editor housekeeping
This commit is contained in:
@@ -21,33 +21,83 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
|
using ImGui::BeginChild;
|
||||||
|
using ImGui::BeginTabBar;
|
||||||
|
using ImGui::BeginTabItem;
|
||||||
|
using ImGui::BeginTable;
|
||||||
|
using ImGui::Combo;
|
||||||
|
using ImGui::EndChild;
|
||||||
|
using ImGui::EndTabBar;
|
||||||
|
using ImGui::EndTabItem;
|
||||||
|
using ImGui::TableHeadersRow;
|
||||||
|
using ImGui::TableNextColumn;
|
||||||
|
using ImGui::TableNextRow;
|
||||||
|
using ImGui::TableSetupColumn;
|
||||||
|
|
||||||
absl::Status Tile16Editor::Update() {
|
absl::Status Tile16Editor::Update() {
|
||||||
// Create a tab bar for Tile16 Editing and Tile16 Transfer
|
// Create a tab bar for Tile16 Editing and Tile16 Transfer
|
||||||
if (ImGui::BeginTabBar("Tile16 Editor Tabs")) {
|
if (BeginTabBar("Tile16 Editor Tabs")) {
|
||||||
// Create a tab for Tile16 Editing
|
// Create a tab for Tile16 Editing
|
||||||
if (ImGui::BeginTabItem("Tile16 Editing")) {
|
if (BeginTabItem("Tile16 Editing")) {
|
||||||
if (ImGui::BeginTable("#Tile16EditorTable", 2,
|
if (BeginTable("#Tile16EditorTable", 2, TABLE_BORDERS_RESIZABLE,
|
||||||
|
ImVec2(0, 0))) {
|
||||||
|
TableSetupColumn("Tiles", ImGuiTableColumnFlags_WidthFixed,
|
||||||
|
ImGui::GetContentRegionAvail().x);
|
||||||
|
TableSetupColumn("Properties", ImGuiTableColumnFlags_WidthStretch,
|
||||||
|
ImGui::GetContentRegionAvail().x);
|
||||||
|
TableHeadersRow();
|
||||||
|
TableNextRow();
|
||||||
|
TableNextColumn();
|
||||||
|
RETURN_IF_ERROR(UpdateBlockset());
|
||||||
|
|
||||||
|
TableNextColumn();
|
||||||
|
RETURN_IF_ERROR(UpdateTile16Edit());
|
||||||
|
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a tab for Tile16 Transfer
|
||||||
|
if (BeginTabItem("Tile16 Transfer")) {
|
||||||
|
if (BeginTable("#Tile16TransferTable", 2,
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
ImGui::TableSetupColumn("Tiles", ImGuiTableColumnFlags_WidthFixed,
|
TableSetupColumn("Current ROM Tiles", ImGuiTableColumnFlags_WidthFixed,
|
||||||
ImGui::GetContentRegionAvail().x);
|
ImGui::GetContentRegionAvail().x / 2);
|
||||||
ImGui::TableSetupColumn("Properties",
|
TableSetupColumn("Transfer ROM Tiles", ImGuiTableColumnFlags_WidthFixed,
|
||||||
ImGuiTableColumnFlags_WidthStretch,
|
ImGui::GetContentRegionAvail().x / 2);
|
||||||
ImGui::GetContentRegionAvail().x);
|
TableHeadersRow();
|
||||||
ImGui::TableHeadersRow();
|
TableNextRow();
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
RETURN_IF_ERROR(UpdateBlockset());
|
||||||
// Create a canvas for the Tile16
|
|
||||||
core::BitmapCanvasPipeline(blockset_canvas_, tile16_blockset_bmp_,
|
TableNextColumn();
|
||||||
0x100, (8192 * 2), 0x20,
|
RETURN_IF_ERROR(UpdateTransferTileCanvas());
|
||||||
map_blockset_loaded_, true, 1);
|
|
||||||
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::TableNextColumn();
|
|
||||||
{
|
ImGui::EndTabItem();
|
||||||
// Create various options for the Tile16 Editor
|
}
|
||||||
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)27);
|
|
||||||
ImGui::BeginChild(child_id,
|
ImGui::EndTabBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status Tile16Editor::UpdateBlockset() { // Create a canvas for the Tile16
|
||||||
|
core::BitmapCanvasPipeline(blockset_canvas_, tile16_blockset_bmp_, 0x100,
|
||||||
|
(8192 * 2), 0x20, map_blockset_loaded_, true, 1);
|
||||||
|
return absl::OkStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
absl::Status Tile16Editor::UpdateTile16Edit() { // Create various options for
|
||||||
|
// the Tile16 Editor
|
||||||
|
if (ImGui::BeginChild(core::ImGuiIdIssuer::GetNewID(),
|
||||||
ImVec2(ImGui::GetContentRegionAvail().x, 0x100),
|
ImVec2(ImGui::GetContentRegionAvail().x, 0x100),
|
||||||
true)) {
|
true)) {
|
||||||
tile16_edit_canvas_.DrawBackground(ImVec2(0x40, 0x40));
|
tile16_edit_canvas_.DrawBackground(ImVec2(0x40, 0x40));
|
||||||
@@ -71,44 +121,14 @@ absl::Status Tile16Editor::Update() {
|
|||||||
ImGui::Checkbox("X Flip", &x_flip);
|
ImGui::Checkbox("X Flip", &x_flip);
|
||||||
ImGui::Checkbox("Y Flip", &y_flip);
|
ImGui::Checkbox("Y Flip", &y_flip);
|
||||||
ImGui::Checkbox("Priority Tile", &priority_tile);
|
ImGui::Checkbox("Priority Tile", &priority_tile);
|
||||||
ImGui::SliderInt("Tile Size", &tile_size, 8, 16);
|
return absl::OkStatus();
|
||||||
static const char* items[] = {"Item 1", "Item 2", "Item 3"};
|
|
||||||
static int item_current = 0;
|
|
||||||
ImGui::Combo("Combo", &item_current, items, IM_ARRAYSIZE(items));
|
|
||||||
}
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
absl::Status Tile16Editor::UpdateTransferTileCanvas() {
|
||||||
}
|
|
||||||
|
|
||||||
// Create a tab for Tile16 Transfer
|
|
||||||
if (ImGui::BeginTabItem("Tile16 Transfer")) {
|
|
||||||
if (ImGui::BeginTable("#Tile16TransferTable", 2,
|
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
|
||||||
ImVec2(0, 0))) {
|
|
||||||
ImGui::TableSetupColumn("Current ROM Tiles",
|
|
||||||
ImGuiTableColumnFlags_WidthFixed,
|
|
||||||
ImGui::GetContentRegionAvail().x / 2);
|
|
||||||
ImGui::TableSetupColumn("Transfer ROM Tiles",
|
|
||||||
ImGuiTableColumnFlags_WidthFixed,
|
|
||||||
ImGui::GetContentRegionAvail().x / 2);
|
|
||||||
ImGui::TableHeadersRow();
|
|
||||||
ImGui::TableNextRow();
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
{
|
|
||||||
// Create a canvas for holding the tiles which will be imported
|
|
||||||
core::BitmapCanvasPipeline(blockset_canvas_, tile16_blockset_bmp_,
|
|
||||||
0x100, (8192 * 2), 0x20,
|
|
||||||
map_blockset_loaded_, true, 2);
|
|
||||||
}
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
{
|
|
||||||
// Create a button for loading another ROM
|
// Create a button for loading another ROM
|
||||||
if (ImGui::Button("Load ROM")) {
|
if (ImGui::Button("Load ROM")) {
|
||||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseTransferFileDlgKey",
|
ImGuiFileDialog::Instance()->OpenDialog(
|
||||||
"Open Transfer ROM",
|
"ChooseTransferFileDlgKey", "Open Transfer ROM", ".sfc,.smc", ".");
|
||||||
".sfc,.smc", ".");
|
|
||||||
}
|
}
|
||||||
core::FileDialogPipeline(
|
core::FileDialogPipeline(
|
||||||
"ChooseTransferFileDlgKey", ".sfc,.smc", std::nullopt, [&]() {
|
"ChooseTransferFileDlgKey", ".sfc,.smc", std::nullopt, [&]() {
|
||||||
@@ -129,24 +149,15 @@ absl::Status Tile16Editor::Update() {
|
|||||||
|
|
||||||
// Create the tile16 blockset image
|
// Create the tile16 blockset image
|
||||||
core::BuildAndRenderBitmapPipeline(
|
core::BuildAndRenderBitmapPipeline(
|
||||||
0x80, 0x2000, 0x80, transfer_overworld_.Tile16Blockset(),
|
0x80, 0x2000, 0x80, transfer_overworld_.Tile16Blockset(), *rom(),
|
||||||
*rom(), transfer_blockset_bmp_, palette_);
|
transfer_blockset_bmp_, palette_);
|
||||||
transfer_blockset_loaded_ = true;
|
transfer_blockset_loaded_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a canvas for holding the tiles which will be exported
|
// Create a canvas for holding the tiles which will be exported
|
||||||
core::BitmapCanvasPipeline(transfer_canvas_, transfer_blockset_bmp_,
|
core::BitmapCanvasPipeline(transfer_canvas_, transfer_blockset_bmp_, 0x100,
|
||||||
0x100, (8192 * 2), 0x20,
|
(8192 * 2), 0x20, transfer_blockset_loaded_, true,
|
||||||
transfer_blockset_loaded_, true, 3);
|
3);
|
||||||
}
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTabBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ class Tile16Editor : public SharedROM {
|
|||||||
public:
|
public:
|
||||||
absl::Status Update();
|
absl::Status Update();
|
||||||
|
|
||||||
|
absl::Status UpdateBlockset();
|
||||||
|
absl::Status UpdateTile16Edit();
|
||||||
|
|
||||||
|
absl::Status UpdateTransferTileCanvas();
|
||||||
|
|
||||||
absl::Status InitBlockset(gfx::Bitmap tile16_blockset_bmp,
|
absl::Status InitBlockset(gfx::Bitmap tile16_blockset_bmp,
|
||||||
std::vector<gfx::Bitmap> tile16_individual,
|
std::vector<gfx::Bitmap> tile16_individual,
|
||||||
std::vector<gfx::Bitmap> tile8_individual_);
|
std::vector<gfx::Bitmap> tile8_individual_);
|
||||||
|
|||||||
Reference in New Issue
Block a user