Refactor graphics handling to utilize Arena for graphics sheets management

Update various editors to replace instances of GraphicsSheetManager with gfx::Arena for accessing graphics sheets. This change enhances memory management and performance by centralizing graphics data handling within the Arena class. Clean up related code for improved clarity and maintainability.
This commit is contained in:
scawful
2025-05-02 12:06:46 -04:00
parent 4f8d765c48
commit d6551f84d2
7 changed files with 35 additions and 58 deletions

View File

@@ -26,6 +26,11 @@ class Arena {
SDL_Surface* AllocateSurface(int width, int height, int depth, int format);
void FreeSurface(SDL_Surface* surface);
std::array<gfx::Bitmap, 223>& gfx_sheets() { return gfx_sheets_; }
auto gfx_sheet(int i) { return gfx_sheets_[i]; }
auto mutable_gfx_sheet(int i) { return &gfx_sheets_[i]; }
auto mutable_gfx_sheets() { return &gfx_sheets_; }
auto& bg1() { return bg1_; }
auto& bg2() { return bg2_; }
@@ -42,6 +47,8 @@ class Arena {
std::array<uint16_t, kTotalTiles> layer1_buffer_;
std::array<uint16_t, kTotalTiles> layer2_buffer_;
std::array<gfx::Bitmap, 223> gfx_sheets_;
std::unordered_map<SDL_Texture*,
std::unique_ptr<SDL_Texture, core::SDL_Texture_Deleter>>
textures_;