replace old renderer access pattern

This commit is contained in:
scawful
2024-08-09 18:58:07 -04:00
parent a37f3bbd43
commit 9a2c8ae17a
16 changed files with 129 additions and 154 deletions

View File

@@ -1,9 +1,12 @@
#include "app/core/platform/renderer.h"
#include "app/editor/overworld_editor.h"
namespace yaze {
namespace app {
namespace editor {
using core::Renderer;
void OverworldEditor::RefreshChildMap(int map_index) {
overworld_.mutable_overworld_map(map_index)->LoadAreaGraphics();
status_ = overworld_.mutable_overworld_map(map_index)->BuildTileset();
@@ -50,7 +53,7 @@ void OverworldEditor::RefreshOverworldMap() {
int n = is_large ? 4 : 1;
// We do texture updating on the main thread
for (int i = 0; i < n; ++i) {
rom()->UpdateBitmap(&maps_bmp_[indices[i]]);
Renderer::GetInstance().UpdateBitmap(&maps_bmp_[indices[i]]);
}
}
@@ -106,7 +109,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
overworld_.set_current_map(current_map_);
palette_ = overworld_.AreaPalette();
// Create the tile16 blockset image
rom()->UpdateBitmap(&tile16_blockset_bmp_);
Renderer::GetInstance().UpdateBitmap(&tile16_blockset_bmp_);
RETURN_IF_ERROR(tile16_blockset_bmp_.ApplyPalette(palette_));
// Copy the tile16 data into individual tiles.
@@ -146,7 +149,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
// Render the bitmaps of each tile.
for (int id = 0; id < 4096; id++) {
RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_));
rom()->UpdateBitmap(&tile16_individual_[id]);
Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]);
}
return absl::OkStatus();