update gfx group editor
This commit is contained in:
@@ -24,70 +24,85 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
|
using ImGui::BeginChild;
|
||||||
|
using ImGui::BeginGroup;
|
||||||
|
using ImGui::BeginTabBar;
|
||||||
|
using ImGui::BeginTabItem;
|
||||||
|
using ImGui::BeginTable;
|
||||||
|
using ImGui::ColorButton;
|
||||||
|
using ImGui::EndChild;
|
||||||
|
using ImGui::EndGroup;
|
||||||
|
using ImGui::EndTabBar;
|
||||||
|
using ImGui::EndTabItem;
|
||||||
|
using ImGui::EndTable;
|
||||||
|
using ImGui::GetContentRegionAvail;
|
||||||
|
using ImGui::GetStyle;
|
||||||
|
using ImGui::IsItemClicked;
|
||||||
|
using ImGui::PopID;
|
||||||
|
using ImGui::PushID;
|
||||||
using ImGui::SameLine;
|
using ImGui::SameLine;
|
||||||
|
using ImGui::Selectable;
|
||||||
using ImGui::Separator;
|
using ImGui::Separator;
|
||||||
|
using ImGui::SetNextItemWidth;
|
||||||
using ImGui::TableHeadersRow;
|
using ImGui::TableHeadersRow;
|
||||||
using ImGui::TableNextColumn;
|
using ImGui::TableNextColumn;
|
||||||
using ImGui::TableNextRow;
|
using ImGui::TableNextRow;
|
||||||
using ImGui::TableSetupColumn;
|
using ImGui::TableSetupColumn;
|
||||||
|
using ImGui::Text;
|
||||||
|
|
||||||
using gfx::kPaletteGroupNames;
|
using gfx::kPaletteGroupNames;
|
||||||
using gfx::PaletteCategory;
|
using gfx::PaletteCategory;
|
||||||
|
|
||||||
absl::Status GfxGroupEditor::Update() {
|
absl::Status GfxGroupEditor::Update() {
|
||||||
if (ImGui::BeginTabBar("GfxGroupEditor")) {
|
if (BeginTabBar("GfxGroupEditor")) {
|
||||||
if (ImGui::BeginTabItem("Main")) {
|
if (BeginTabItem("Main")) {
|
||||||
gui::InputHexByte("Selected Blockset", &selected_blockset_);
|
gui::InputHexByte("Selected Blockset", &selected_blockset_,
|
||||||
if (selected_blockset_ >= 0x24) {
|
(uint8_t)0x24);
|
||||||
selected_blockset_ = 0x24;
|
|
||||||
}
|
|
||||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
false, "blockset", "0x" + std::to_string(selected_blockset_),
|
false, "blockset", "0x" + std::to_string(selected_blockset_),
|
||||||
"Blockset " + std::to_string(selected_blockset_));
|
"Blockset " + std::to_string(selected_blockset_));
|
||||||
DrawBlocksetViewer();
|
DrawBlocksetViewer();
|
||||||
ImGui::EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("Rooms")) {
|
if (BeginTabItem("Rooms")) {
|
||||||
gui::InputHexByte("Selected Blockset", &selected_roomset_);
|
gui::InputHexByte("Selected Blockset", &selected_roomset_, (uint8_t)81);
|
||||||
if (selected_roomset_ >= 81) {
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
selected_roomset_ = 81;
|
false, "roomset", "0x" + std::to_string(selected_roomset_),
|
||||||
}
|
"Roomset " + std::to_string(selected_roomset_));
|
||||||
DrawRoomsetViewer();
|
DrawRoomsetViewer();
|
||||||
ImGui::EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("Sprites")) {
|
if (BeginTabItem("Sprites")) {
|
||||||
gui::InputHexByte("Selected Spriteset", &selected_spriteset_);
|
gui::InputHexByte("Selected Spriteset", &selected_spriteset_,
|
||||||
if (selected_spriteset_ >= 143) {
|
(uint8_t)143);
|
||||||
selected_spriteset_ = 143;
|
|
||||||
}
|
|
||||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
false, "spriteset", "0x" + std::to_string(selected_spriteset_),
|
false, "spriteset", "0x" + std::to_string(selected_spriteset_),
|
||||||
"Spriteset " + std::to_string(selected_spriteset_));
|
"Spriteset " + std::to_string(selected_spriteset_));
|
||||||
ImGui::Text("Values");
|
Text("Values");
|
||||||
DrawSpritesetViewer();
|
DrawSpritesetViewer();
|
||||||
ImGui::EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginTabItem("Palettes")) {
|
if (BeginTabItem("Palettes")) {
|
||||||
DrawPaletteViewer();
|
DrawPaletteViewer();
|
||||||
ImGui::EndTabItem();
|
EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndTabBar();
|
EndTabBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxGroupEditor::DrawBlocksetViewer(bool sheet_only) {
|
void GfxGroupEditor::DrawBlocksetViewer(bool sheet_only) {
|
||||||
if (ImGui::BeginTable("##BlocksetTable", sheet_only ? 1 : 2,
|
if (BeginTable("##BlocksetTable", sheet_only ? 1 : 2,
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
if (!sheet_only) {
|
if (!sheet_only) {
|
||||||
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
||||||
ImGui::GetContentRegionAvail().x);
|
GetContentRegionAvail().x);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
||||||
@@ -96,90 +111,90 @@ void GfxGroupEditor::DrawBlocksetViewer(bool sheet_only) {
|
|||||||
if (!sheet_only) {
|
if (!sheet_only) {
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
ImGui::SetNextItemWidth(100.f);
|
SetNextItemWidth(100.f);
|
||||||
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
||||||
&rom()->main_blockset_ids[selected_blockset_][i]);
|
&rom()->main_blockset_ids[selected_blockset_][i]);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
int sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
|
int sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
|
||||||
auto sheet = rom()->bitmap_manager()[sheet_id];
|
auto sheet = rom()->bitmap_manager()[sheet_id];
|
||||||
gui::BitmapCanvasPipeline(blockset_canvas_, sheet, 256, 0x10 * 0x04,
|
gui::BitmapCanvasPipeline(blockset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||||
0x20, true, false, 22);
|
0x20, true, false, 22);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxGroupEditor::DrawRoomsetViewer() {
|
void GfxGroupEditor::DrawRoomsetViewer() {
|
||||||
ImGui::Text("Values - Overwrites 4 of main blockset");
|
Text("Values - Overwrites 4 of main blockset");
|
||||||
if (ImGui::BeginTable("##Roomstable", 3,
|
if (BeginTable("##Roomstable", 3,
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
TableSetupColumn("List", ImGuiTableColumnFlags_WidthFixed, 100);
|
TableSetupColumn("List", ImGuiTableColumnFlags_WidthFixed, 100);
|
||||||
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
||||||
ImGui::GetContentRegionAvail().x);
|
GetContentRegionAvail().x);
|
||||||
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
||||||
TableHeadersRow();
|
TableHeadersRow();
|
||||||
TableNextRow();
|
TableNextRow();
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginChild("##RoomsetList");
|
BeginChild("##RoomsetList");
|
||||||
for (int i = 0; i < 0x51; i++) {
|
for (int i = 0; i < 0x51; i++) {
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
std::string roomset_label = absl::StrFormat("0x%02X", i);
|
std::string roomset_label = absl::StrFormat("0x%02X", i);
|
||||||
rom()->resource_label()->SelectableLabelWithNameEdit(
|
rom()->resource_label()->SelectableLabelWithNameEdit(
|
||||||
false, "roomset", roomset_label, "Roomset " + roomset_label);
|
false, "roomset", roomset_label, "Roomset " + roomset_label);
|
||||||
if (ImGui::IsItemClicked()) {
|
if (IsItemClicked()) {
|
||||||
selected_roomset_ = i;
|
selected_roomset_ = i;
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
ImGui::SetNextItemWidth(100.f);
|
SetNextItemWidth(100.f);
|
||||||
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
||||||
&rom()->room_blockset_ids[selected_roomset_][i]);
|
&rom()->room_blockset_ids[selected_roomset_][i]);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int sheet_id = rom()->room_blockset_ids[selected_roomset_][i];
|
int sheet_id = rom()->room_blockset_ids[selected_roomset_][i];
|
||||||
auto sheet = rom()->bitmap_manager()[sheet_id];
|
auto sheet = rom()->bitmap_manager()[sheet_id];
|
||||||
gui::BitmapCanvasPipeline(roomset_canvas_, sheet, 256, 0x10 * 0x04,
|
gui::BitmapCanvasPipeline(roomset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||||
0x20, true, false, 23);
|
0x20, true, false, 23);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxGroupEditor::DrawSpritesetViewer(bool sheet_only) {
|
void GfxGroupEditor::DrawSpritesetViewer(bool sheet_only) {
|
||||||
if (ImGui::BeginTable("##SpritesTable", sheet_only ? 1 : 2,
|
if (BeginTable("##SpritesTable", sheet_only ? 1 : 2,
|
||||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
if (!sheet_only) {
|
if (!sheet_only) {
|
||||||
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
||||||
ImGui::GetContentRegionAvail().x);
|
GetContentRegionAvail().x);
|
||||||
}
|
}
|
||||||
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed, 256);
|
||||||
TableHeadersRow();
|
TableHeadersRow();
|
||||||
@@ -187,35 +202,35 @@ void GfxGroupEditor::DrawSpritesetViewer(bool sheet_only) {
|
|||||||
if (!sheet_only) {
|
if (!sheet_only) {
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
ImGui::SetNextItemWidth(100.f);
|
SetNextItemWidth(100.f);
|
||||||
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
gui::InputHexByte(("0x" + std::to_string(i)).c_str(),
|
||||||
&rom()->spriteset_ids[selected_spriteset_][i]);
|
&rom()->spriteset_ids[selected_spriteset_][i]);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TableNextColumn();
|
TableNextColumn();
|
||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
BeginGroup();
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
int sheet_id = rom()->spriteset_ids[selected_spriteset_][i];
|
int sheet_id = rom()->spriteset_ids[selected_spriteset_][i];
|
||||||
auto sheet = rom()->bitmap_manager()[115 + sheet_id];
|
auto sheet = rom()->bitmap_manager()[115 + sheet_id];
|
||||||
gui::BitmapCanvasPipeline(spriteset_canvas_, sheet, 256, 0x10 * 0x04,
|
gui::BitmapCanvasPipeline(spriteset_canvas_, sheet, 256, 0x10 * 0x04,
|
||||||
0x20, true, false, 24);
|
0x20, true, false, 24);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
EndGroup();
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void DrawPaletteFromPaletteGroup(gfx::SnesPalette &palette) {
|
void DrawPaletteFromPaletteGroup(gfx::SnesPalette &palette) {
|
||||||
for (int n = 0; n < palette.size(); n++) {
|
for (int n = 0; n < palette.size(); n++) {
|
||||||
ImGui::PushID(n);
|
PushID(n);
|
||||||
if ((n % 8) != 0) ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.y);
|
if ((n % 8) != 0) SameLine(0.0f, GetStyle().ItemSpacing.y);
|
||||||
|
|
||||||
// Small icon of the color in the palette
|
// Small icon of the color in the palette
|
||||||
if (gui::SnesColorButton(absl::StrCat("Palette", n), palette[n],
|
if (gui::SnesColorButton(absl::StrCat("Palette", n), palette[n],
|
||||||
@@ -224,7 +239,7 @@ void DrawPaletteFromPaletteGroup(gfx::SnesPalette &palette) {
|
|||||||
ImGuiColorEditFlags_NoTooltip)) {
|
ImGuiColorEditFlags_NoTooltip)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
PopID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user