layers are redundant

This commit is contained in:
2025-04-09 14:16:38 -05:00
parent 42b5a53b89
commit 908b00db62
11 changed files with 68 additions and 191 deletions

View File

@@ -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;
};
}