introduce active and passive events

This commit is contained in:
2025-04-23 13:51:09 -05:00
parent a3fb96abb7
commit b4ac013f18
17 changed files with 197 additions and 42 deletions

View File

@@ -36,3 +36,34 @@ void MinimalApp::run() {
}
}
bool MinimalApp::onEvent(const Archimedes::Event& event) {
unsigned int type = getEventType(event);
if(type == getEventType(Archimedes::DoLoadModuleEvent())) {
Archimedes::DoLoadModuleEvent& e = (Archimedes::DoLoadModuleEvent&) event;
startModule(e.module);
return true;
} else if(type == getEventType(Archimedes::DoUnloadModuleEvent())) {
Archimedes::DoUnloadModuleEvent& e = (Archimedes::DoUnloadModuleEvent&) event;
stopModule(e.module);
return true;
} else if(type == getEventType(Archimedes::LoadModuleEvent())) {
return true;
} else if(type == getEventType(Archimedes::UnloadModuleEvent())) {
return true;
}
return false;
}

View File

@@ -5,13 +5,15 @@ class MinimalApp : public Archimedes::App {
private:
void printHelp() {};
void printHelp() override {};
bool onEvent(const Archimedes::Event&) override;
public:
MinimalApp() {};
~MinimalApp() {};
void handleArgs(const int& argc, char* argv[]) {
void handleArgs(const int& argc, char* argv[]) override {
if(argc > 1) {
for(int i = 1; i < argc; i++) {
load(dynamicLoad(argv[i]));
@@ -22,7 +24,7 @@ class MinimalApp : public Archimedes::App {
}
};
void run();
void run() override;
};