Enhance Dungeon Editor with Room Graphics Management

- Refactored the DungeonEditor class to include new methods for loading and rendering room graphics, improving the overall graphics management system.
- Introduced LoadAndRenderRoomGraphics and ReloadAllRoomGraphics methods to streamline the loading process for room graphics.
- Updated the UI to provide buttons for loading room graphics and reloading all graphics, enhancing user interaction.
- Improved background rendering logic by adding RenderRoomBackgroundLayers, ensuring proper layering of graphics.
- Adjusted data types in UI text displays for better accuracy and consistency in rendering information.
This commit is contained in:
scawful
2025-09-24 23:10:45 -04:00
parent 04909dc3d0
commit 4ae9dc9e0c
2 changed files with 167 additions and 15 deletions

View File

@@ -116,6 +116,12 @@ class DungeonEditor : public Editor {
std::pair<int, int> RoomToCanvasCoordinates(int room_x, int room_y) const;
std::pair<int, int> CanvasToRoomCoordinates(int canvas_x, int canvas_y) const;
bool IsWithinCanvasBounds(int canvas_x, int canvas_y, int margin = 32) const;
// Room graphics management
absl::Status LoadAndRenderRoomGraphics(int room_id);
absl::Status ReloadAllRoomGraphics();
absl::Status UpdateRoomBackgroundLayers(int room_id);
void RenderRoomBackgroundLayers(int room_id);
// Object rendering cache to avoid re-rendering the same objects
struct ObjectRenderCache {