flake parts
This commit is contained in:
48
src/include/utils/Module/Module.h
Normal file
48
src/include/utils/Module/Module.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef MODULE_H
|
||||
#define MODULE_H
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
namespace Archimedes {
|
||||
|
||||
class App;
|
||||
|
||||
class Event;
|
||||
|
||||
class Module {
|
||||
|
||||
friend class App;
|
||||
|
||||
public:
|
||||
|
||||
typedef Module* create_t(App*, void*);
|
||||
|
||||
Module(App* a, void* h) : app(a), handle(h) {}
|
||||
|
||||
Module() : app(nullptr), handle(nullptr) {}
|
||||
|
||||
virtual ~Module() {}
|
||||
|
||||
virtual void run() {}
|
||||
virtual bool onEvent(const Event& e) { return false; }
|
||||
|
||||
virtual void onLoad() {}
|
||||
virtual void onUnload() {}
|
||||
|
||||
operator std::string() const { return name; }
|
||||
void* getHandle() { return handle; }
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
|
||||
App* app;
|
||||
void* handle;
|
||||
|
||||
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
||||
std::unordered_map<std::string, std::variant<std::string, Module*>> exts;
|
||||
std::unordered_map<std::string, Module*> moduleInstances;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user