feat: Implement lazy initialization for Emulator and Renderer
- Updated Emulator to support optional lazy initialization of the renderer, enhancing flexibility during runtime. - Introduced a new method in IRenderer for creating textures with specific pixel formats, improving texture management for the emulator. - Refactored texture command processing in Arena to handle empty queues more gracefully. - Enhanced SDL2Renderer to support the new texture creation method, ensuring compatibility with emulator requirements.
This commit is contained in:
@@ -233,6 +233,9 @@ constexpr const char* kMusicEditorName = ICON_MD_MUSIC_NOTE " Music Editor";
|
||||
void EditorManager::Initialize(gfx::IRenderer* renderer, const std::string& filename) {
|
||||
renderer_ = renderer;
|
||||
|
||||
// NOTE: Emulator will be initialized later when a ROM is loaded
|
||||
// We just store the renderer for now
|
||||
|
||||
// Point to a blank editor set when no ROM is loaded
|
||||
current_editor_set_ = &blank_editor_set_;
|
||||
|
||||
@@ -2097,6 +2100,11 @@ absl::Status EditorManager::LoadAssets() {
|
||||
|
||||
auto start_time = std::chrono::steady_clock::now();
|
||||
|
||||
// Set renderer for emulator (lazy initialization happens in Run())
|
||||
if (renderer_) {
|
||||
emulator_.set_renderer(renderer_);
|
||||
}
|
||||
|
||||
current_editor_set_->overworld_editor_.Initialize();
|
||||
current_editor_set_->message_editor_.Initialize();
|
||||
// Initialize the dungeon editor with the renderer
|
||||
|
||||
Reference in New Issue
Block a user