umbra/projs/shadow/shadow-engine/src/core/ModuleManager.h
Curle 3bf44e8985
CMake Build System (#4) and some code form the old codebase
* added test game, moved engine projects under "shadow" folder

* More work on build files

* fix git ignore

* working game folder setup

* Work on game rule

* [SYNC] work on the shadow engine rule

* [SYNC] Added wrapper c sript

* Work on wrapper

* Working wrapper

* Add Vulkan sdk rules

* First working build using the CMake toolchain

* updates

* fix tests

* remove .clwb

Co-authored-by: dpeter99 <dpeter99@gmail.com>
2022-07-19 19:34:21 +02:00

52 lines
1007 B
C++

#ifndef UMBRA_MODULEMANAGER_H
#define UMBRA_MODULEMANAGER_H
#include <memory>
#include <list>
#include "Module.h"
namespace ShadowEngine {
class ModuleRef{
std::unique_ptr<Module> module;
std::string domain;
};
class ModuleManager {
public:
static ModuleManager *instance;
std::list<ModuleRef> modules;
ModuleManager();
~ModuleManager();
void PushModule(Module *module);
Module &GetModule(std::string name);
template<typename T>
T *GetModuleByType() {
for (auto &module: modules) {
if (module->GetTypeId() == T::TypeId())
return dynamic_cast<T *>(module.get());
}
//SH_CORE_ERROR("Can't find the module {0}", T::Type());
return nullptr;
}
void Init();
void Update();
void LateRender();
void Render();
void AfterFrameEnd();
};
}
#endif //UMBRA_MODULEMANAGER_H