48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
#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) {}
|
|
|
|
virtual ~Module() {}
|
|
|
|
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()]; };
|
|
|
|
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;
|
|
|
|
//std::unordered_map<std::string, std::any> data;
|
|
};
|
|
}
|
|
|
|
#endif
|