feat(editor): enhance screen editor with on-demand tilemap caching

- Implemented a new tilemap system for 8x8 tiles in the ScreenEditor, allowing for on-demand texture creation and caching of tiles.
- Combined multiple sheets into a single tilemap, improving memory efficiency and rendering performance.
- Updated tile drawing logic to extract and cache tiles from the atlas, ensuring textures are created only when needed.

Benefits:
- Enhances performance by reducing unnecessary texture creation.
- Improves user experience with faster tile rendering and management in the editor.
This commit is contained in:
scawful
2025-10-13 15:37:32 -04:00
parent c95e5ac7ef
commit 360406bd4c
3 changed files with 121 additions and 34 deletions

View File

@@ -97,12 +97,12 @@ class ScreenEditor : public Editor {
bool copy_button_pressed = false;
bool paste_button_pressed = false;
std::vector<gfx::Bitmap> tile8_individual_;
zelda3::DungeonMapLabels dungeon_map_labels_;
gfx::SnesPalette palette_;
gfx::BitmapTable sheets_;
gfx::Tilemap tile16_blockset_;
gfx::Tilemap tile8_tilemap_; // Tilemap for 8x8 tiles with on-demand caching
std::array<gfx::TileInfo, 4> current_tile16_info;
gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),