Refactor graphics sheet management with singleton class
Refactor the handling of graphics sheets by introducing a singleton class `GraphicsSheetManager`. This centralizes the management of graphics sheets, replacing direct access through the `Rom` object. Key changes include: - Updated various methods across multiple classes to use `GraphicsSheetManager::GetInstance()` for accessing and manipulating graphics sheets. - Introduced standalone functions `LoadLinkGraphics`, `LoadAllGraphicsData`, and `SaveAllGraphicsData` for loading and saving graphics data. - Refactored the `Rom` class to remove methods and member variables related to graphics sheet management. - Updated `OverworldEditor` to use `std::array` for `maps_bmp_` and added error handling for `std::bad_alloc` exceptions. - Improved code modularity and error handling throughout the application.
This commit is contained in:
@@ -102,7 +102,7 @@ void DungeonObjectRenderer::UpdateObjectBitmap() {
|
||||
int x = column * 8;
|
||||
int y = row * 8;
|
||||
|
||||
auto sheet = rom()->mutable_gfx_sheets()->at(vram_.sheets[sheet_number]);
|
||||
auto sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(vram_.sheets[sheet_number]);
|
||||
|
||||
// Copy the tile from VRAM using the read tile_id
|
||||
sheet.Get8x8Tile(tile_id, x, y, tilemap_, tilemap_offset);
|
||||
|
||||
Reference in New Issue
Block a user