layers are redundant
This commit is contained in:
@@ -7,36 +7,39 @@ namespace Archimedes {
|
||||
|
||||
class App;
|
||||
|
||||
class Event;
|
||||
|
||||
class Module {
|
||||
|
||||
friend class App;
|
||||
|
||||
public:
|
||||
|
||||
typedef Module* create_t(void*, App*);
|
||||
typedef Module* create_t(App*, void*);
|
||||
|
||||
Module(void* h, App* a) : handle(h), app(a) {}
|
||||
Module(App* a, void* h) : app(a), handle(h) {}
|
||||
|
||||
virtual ~Module() {}
|
||||
|
||||
virtual void run() = 0;
|
||||
virtual void onLoad() = 0;
|
||||
virtual void run() {}
|
||||
virtual bool onEvent(const Event& e) { return false; }
|
||||
virtual void onLoad() {};
|
||||
|
||||
std::string getName() const { return name; }
|
||||
void* getHandle() { return handle; }
|
||||
|
||||
std::any getData(std::string s) { return data[s.c_str()]; };
|
||||
//std::any getData(std::string s) { return data[s.c_str()]; };
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
void* handle;
|
||||
|
||||
|
||||
App* app;
|
||||
void* handle;
|
||||
|
||||
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
||||
std::unordered_map<std::string, Module*> depsInstances;
|
||||
|
||||
std::unordered_map<std::string, std::any> data;
|
||||
//std::unordered_map<std::string, std::any> data;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user