Update GfxGroupEditor
This commit is contained in:
@@ -58,10 +58,17 @@ absl::Status GfxGroupEditor::Update() {
|
|||||||
{
|
{
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
auto sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
|
int sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
|
||||||
|
if (sheet_id != last_sheet_id_) {
|
||||||
|
last_sheet_id_ = sheet_id;
|
||||||
|
auto palette_group = rom()->GetPaletteGroup("ow_main");
|
||||||
|
auto palette = palette_group[preview_palette_id_];
|
||||||
|
graphics_bin_[sheet_id].ApplyPalette(palette);
|
||||||
|
rom()->UpdateBitmap(&graphics_bin_[sheet_id]);
|
||||||
|
}
|
||||||
core::BitmapCanvasPipeline(blockset_canvas_,
|
core::BitmapCanvasPipeline(blockset_canvas_,
|
||||||
graphics_bin_[sheet_id], 256,
|
graphics_bin_[sheet_id], 256,
|
||||||
0x10 * 0x04, 0x20, true, false, 0);
|
0x10 * 0x04, 0x20, true, false, 22);
|
||||||
}
|
}
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
}
|
}
|
||||||
@@ -73,11 +80,85 @@ absl::Status GfxGroupEditor::Update() {
|
|||||||
|
|
||||||
// Rooms tab
|
// Rooms tab
|
||||||
if (ImGui::BeginTabItem("Rooms")) {
|
if (ImGui::BeginTabItem("Rooms")) {
|
||||||
|
gui::InputHexByte("Selected Blockset", &selected_roomset_);
|
||||||
|
|
||||||
|
ImGui::Text("Values - Overwrites 4 of main blockset");
|
||||||
|
if (ImGui::BeginTable("##Roomstable", 2, ImGuiTableFlags_Borders,
|
||||||
|
ImVec2(0, 0))) {
|
||||||
|
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
||||||
|
ImGui::GetContentRegionAvail().x);
|
||||||
|
ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed,
|
||||||
|
256);
|
||||||
|
ImGui::TableHeadersRow();
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
{
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ImGui::SetNextItemWidth(100.f);
|
||||||
|
gui::InputHexByte(("##roomset0" + std::to_string(i)).c_str(),
|
||||||
|
&rom()->room_blockset_ids[selected_roomset_][i]);
|
||||||
|
if (i != 3 && i != 7) {
|
||||||
|
SameLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
{
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
int sheet_id = rom()->room_blockset_ids[selected_roomset_][i];
|
||||||
|
core::BitmapCanvasPipeline(roomset_canvas_, graphics_bin_[sheet_id],
|
||||||
|
256, 0x10 * 0x04, 0x20, true, false, 23);
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sprites tab
|
// Sprites tab
|
||||||
if (ImGui::BeginTabItem("Sprites")) {
|
if (ImGui::BeginTabItem("Sprites")) {
|
||||||
|
gui::InputHexByte("Selected Spriteset", &selected_spriteset_);
|
||||||
|
|
||||||
|
ImGui::Text("Values");
|
||||||
|
if (ImGui::BeginTable("##SpritesTable", 2, ImGuiTableFlags_Borders,
|
||||||
|
ImVec2(0, 0))) {
|
||||||
|
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthStretch,
|
||||||
|
ImGui::GetContentRegionAvail().x);
|
||||||
|
ImGui::TableSetupColumn("Sheets", ImGuiTableColumnFlags_WidthFixed,
|
||||||
|
256);
|
||||||
|
ImGui::TableHeadersRow();
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
{
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
ImGui::SetNextItemWidth(100.f);
|
||||||
|
gui::InputHexByte(("##spriteset0" + std::to_string(i)).c_str(),
|
||||||
|
&rom()->spriteset_ids[selected_spriteset_][i]);
|
||||||
|
if (i != 3 && i != 7) {
|
||||||
|
SameLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
{
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
int sheet_id = rom()->spriteset_ids[selected_spriteset_][i];
|
||||||
|
core::BitmapCanvasPipeline(spriteset_canvas_,
|
||||||
|
graphics_bin_[sheet_id], 256,
|
||||||
|
0x10 * 0x04, 0x20, true, false, 24);
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,12 +177,9 @@ absl::Status GfxGroupEditor::Update() {
|
|||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GfxGroupEditor::InitBlockset(gfx::Bitmap tile16_blockset,
|
void GfxGroupEditor::InitBlockset(gfx::Bitmap tile16_blockset) {
|
||||||
gfx::BitmapTable graphics_bin,
|
|
||||||
gfx::SNESPalette palette) {
|
|
||||||
tile16_blockset_bmp_ = tile16_blockset;
|
tile16_blockset_bmp_ = tile16_blockset;
|
||||||
graphics_bin_ = graphics_bin;
|
graphics_bin_ = rom()->GetGraphicsBin();
|
||||||
palette_ = palette;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|||||||
@@ -27,16 +27,21 @@ class GfxGroupEditor : public SharedROM {
|
|||||||
public:
|
public:
|
||||||
absl::Status Update();
|
absl::Status Update();
|
||||||
|
|
||||||
void InitBlockset(gfx::Bitmap tile16_blockset, gfx::BitmapTable graphics_bin,
|
void InitBlockset(gfx::Bitmap tile16_blockset);
|
||||||
gfx::SNESPalette palette);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int preview_palette_id_;
|
int preview_palette_id_ = 0;
|
||||||
|
int last_sheet_id_ = 0;
|
||||||
uint8_t selected_blockset_ = 0;
|
uint8_t selected_blockset_ = 0;
|
||||||
|
uint8_t selected_roomset_ = 0;
|
||||||
|
uint8_t selected_spriteset_ = 0;
|
||||||
|
|
||||||
gui::Canvas blockset_canvas_;
|
gui::Canvas blockset_canvas_;
|
||||||
|
gui::Canvas roomset_canvas_;
|
||||||
|
gui::Canvas spriteset_canvas_;
|
||||||
|
|
||||||
gfx::SNESPalette palette_;
|
gfx::SNESPalette palette_;
|
||||||
|
gfx::PaletteGroup palette_group_;
|
||||||
gfx::Bitmap tile16_blockset_bmp_;
|
gfx::Bitmap tile16_blockset_bmp_;
|
||||||
gfx::BitmapTable graphics_bin_;
|
gfx::BitmapTable graphics_bin_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user