add App& member to Module class

This commit is contained in:
2025-03-14 16:13:26 -05:00
parent e7286caa20
commit 2b1293d414
4 changed files with 13 additions and 9 deletions

View File

@@ -63,7 +63,7 @@ void App::load(std::string lib) {
std::cout << "error finding create function in file: " << lib << std::endl;
}
Module* m = create(h);
Module* m = create(h, App::Get());
for(auto it = modules.begin(); it != modules.end(); it++) {

View File

@@ -3,13 +3,15 @@
#include "pch.hpp"
class App;
class Module {
public:
typedef Module* create_t(void*);
typedef Module* create_t(void*, App&);
typedef void* destroy_t(Module*);
Module(void* h, App& a) : handle(h), app(a) {};
virtual ~Module() {}
virtual void run() = 0;
std::string getName() const { return name; }
@@ -21,6 +23,9 @@ class Module {
std::string name;
void* handle;
std::list<Module*>::iterator self;
App& app;
};
#endif