add ExtensionManager implementation
This commit is contained in:
@@ -16,4 +16,5 @@ set(
|
|||||||
app/editor/utils/gfx_context.cc
|
app/editor/utils/gfx_context.cc
|
||||||
app/editor/overworld/refresh.cc
|
app/editor/overworld/refresh.cc
|
||||||
app/editor/overworld/entity.cc
|
app/editor/overworld/entity.cc
|
||||||
|
app/editor/system/extension_manager.cc
|
||||||
)
|
)
|
||||||
37
src/app/editor/system/extension_manager.cc
Normal file
37
src/app/editor/system/extension_manager.cc
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#include "extension_manager.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ext/extension.h"
|
||||||
|
|
||||||
|
namespace yaze {
|
||||||
|
namespace app {
|
||||||
|
namespace editor {
|
||||||
|
|
||||||
|
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(yaze_editor_context* context) {
|
||||||
|
for (auto& extension : extensions_) {
|
||||||
|
if (extension->extend_ui) {
|
||||||
|
extension->extend_ui(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace editor
|
||||||
|
} // namespace app
|
||||||
|
} // namespace yaze
|
||||||
@@ -14,36 +14,14 @@ class ExtensionManager {
|
|||||||
void RegisterExtension(yaze_extension* extension);
|
void RegisterExtension(yaze_extension* extension);
|
||||||
void InitializeExtensions(yaze_editor_context* context);
|
void InitializeExtensions(yaze_editor_context* context);
|
||||||
void ShutdownExtensions();
|
void ShutdownExtensions();
|
||||||
void ExecuteExtensionUI();
|
void ExecuteExtensionUI(yaze_editor_context* context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<yaze_extension*> extensions_;
|
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 editor
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
#endif // YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H
|
||||||
@@ -7,7 +7,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include "yaze.h"
|
#include "yaze.h"
|
||||||
|
|
||||||
typedef void (*yaze_initialize_func)(void);
|
typedef void (*yaze_initialize_func)(yaze_editor_context* context);
|
||||||
typedef void (*yaze_cleanup_func)(void);
|
typedef void (*yaze_cleanup_func)(void);
|
||||||
typedef void (*yaze_extend_ui_func)(yaze_editor_context* context);
|
typedef void (*yaze_extend_ui_func)(yaze_editor_context* context);
|
||||||
typedef void (*yaze_manipulate_rom_func)(z3_rom* rom);
|
typedef void (*yaze_manipulate_rom_func)(z3_rom* rom);
|
||||||
|
|||||||
Reference in New Issue
Block a user