Refactor Tile16Editor for improved data handling and bitmap updates

- Changed the storage of current tile16 data from a static variable to an instance variable for better persistence.
- Added a new method to update the blockset bitmap displayed in the editor, ensuring it reflects the current tile16 data.
- Enhanced the DrawToCurrentTile16 method to include updates to the blockset bitmap after drawing.
- Updated the CMake configuration for the tile edit table to ensure proper initialization.
This commit is contained in:
scawful
2025-09-28 21:06:57 -04:00
parent 5a242c8c6f
commit 76cb817f26
3 changed files with 108 additions and 39 deletions

View File

@@ -117,6 +117,7 @@ class Tile16Editor : public gfx::GfxContext {
absl::Status RefreshTile16Blockset();
gfx::Tile16* GetCurrentTile16Data();
absl::Status RegenerateTile16BitmapFromROM();
absl::Status UpdateBlocksetBitmap();
// Manual tile8 input controls
void DrawManualTile8Inputs();
@@ -219,7 +220,7 @@ class Tile16Editor : public gfx::GfxContext {
gui::CanvasGridSize::k32x32};
gfx::Bitmap current_gfx_bmp_;
gui::Table tile_edit_table_{"##TileEditTable", 3, ImGuiTableFlags_Borders};
gui::Table tile_edit_table_{"##TileEditTable", 3, ImGuiTableFlags_Borders, ImVec2(0, 0)};
gfx::Tilemap* tile16_blockset_ = nullptr;
std::vector<gfx::Bitmap> current_gfx_individual_;
@@ -231,6 +232,9 @@ class Tile16Editor : public gfx::GfxContext {
// Callback to notify parent editor when changes are committed
std::function<absl::Status()> on_changes_committed_;
// Instance variable to store current tile16 data for proper persistence
gfx::Tile16 current_tile16_data_;
};
} // namespace editor