add ExtensionManager
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include "app/editor/overworld/overworld_editor.h"
|
#include "app/editor/overworld/overworld_editor.h"
|
||||||
#include "app/editor/settings_editor.h"
|
#include "app/editor/settings_editor.h"
|
||||||
#include "app/editor/sprite/sprite_editor.h"
|
#include "app/editor/sprite/sprite_editor.h"
|
||||||
|
#include "app/editor/system/extension_manager.h"
|
||||||
#include "app/editor/utils/gfx_context.h"
|
#include "app/editor/utils/gfx_context.h"
|
||||||
#include "app/emu/emulator.h"
|
#include "app/emu/emulator.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
@@ -110,7 +111,7 @@ class EditorManager : public SharedRom,
|
|||||||
|
|
||||||
Project current_project_;
|
Project current_project_;
|
||||||
yaze_editor_context editor_context_;
|
yaze_editor_context editor_context_;
|
||||||
std::vector<yaze_extension*> extensions_;
|
ExtensionManager extension_manager_;
|
||||||
|
|
||||||
AssemblyEditor assembly_editor_;
|
AssemblyEditor assembly_editor_;
|
||||||
DungeonEditor dungeon_editor_;
|
DungeonEditor dungeon_editor_;
|
||||||
|
|||||||
49
src/app/editor/system/extension_manager.h
Normal file
49
src/app/editor/system/extension_manager.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#ifndef YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||||
|
#define YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ext/extension.h"
|
||||||
|
|
||||||
|
namespace yaze {
|
||||||
|
namespace app {
|
||||||
|
namespace editor {
|
||||||
|
|
||||||
|
class ExtensionManager {
|
||||||
|
public:
|
||||||
|
void RegisterExtension(yaze_extension* extension);
|
||||||
|
void InitializeExtensions(yaze_editor_context* context);
|
||||||
|
void ShutdownExtensions();
|
||||||
|
void ExecuteExtensionUI();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<yaze_extension*> extensions_;
|
||||||
|
};
|
||||||
|
|
||||||
|
void ExtensionManager::RegisterExtension(yaze_extension* extension) {
|
||||||
|
extensions_.push_back(extension);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExtensionManager::InitializeExtensions(yaze_editor_context* context) {
|
||||||
|
for (auto& extension : extensions_) {
|
||||||
|
extension->initialize(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExtensionManager::ShutdownExtensions() {
|
||||||
|
for (auto& extension : extensions_) {
|
||||||
|
extension->cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExtensionManager::ExecuteExtensionUI() {
|
||||||
|
for (auto& extension : extensions_) {
|
||||||
|
if (extension->extend_ui) {
|
||||||
|
extension->extend_ui();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace editor
|
||||||
|
} // namespace app
|
||||||
|
} // namespace yaze
|
||||||
Reference in New Issue
Block a user