restructure modules. make GuiModules depend on WindowModule

This commit is contained in:
2025-03-31 10:30:55 -05:00
parent d6f769d2dd
commit 22350ed54d
15 changed files with 13 additions and 11 deletions

View File

@@ -0,0 +1,16 @@
#include "DependsOnPrint.h"
DependsOnPrint::DependsOnPrint(void* h, Archimedes::App* a) : Module(h, a) {
name = "DependsOnPrint";
deps["Print"] = "/home/nathan/Projects/Archimedes/result-1/bin/Print";
}
DependsOnPrint::~DependsOnPrint() {
std::cout << "DependsOnPrint Destroyed!\n";
}
void DependsOnPrint::run() {
std::cout << "DependsOnPrint lib loaded and run!\n";
app->stopModule(self);
}

View File

@@ -0,0 +1,16 @@
#include "Archimedes.h"
class DependsOnPrint : public Archimedes::Module {
public:
DependsOnPrint(void*, Archimedes::App*);
~DependsOnPrint();
void run();
void onLoad() {}
};
#ifndef DEPENDSONPRINT_STATIC
#define MODULE_TYPE DependsOnPrint
#include "endModule.h"
#endif

View File

@@ -0,0 +1,17 @@
#include "DependsOnPrintStatic.h"
#include "modules/Print/src/Print.h"
DependsOnPrintStatic::DependsOnPrintStatic(void* h, Archimedes::App* a) : Module(h, a) {
name = "DependsOnPrintStatic";
deps["Print"] = new Print(nullptr, a);
}
DependsOnPrintStatic::~DependsOnPrintStatic() {
std::cout << "DependsOnPrintStatic Destroyed!\n";
}
void DependsOnPrintStatic::run() {
std::cout << "DependsOnPrintStatic lib loaded and run!\n";
app->stopModule(self);
}

View File

@@ -0,0 +1,16 @@
#include "Archimedes.h"
class DependsOnPrintStatic : public Archimedes::Module {
public:
DependsOnPrintStatic(void*, Archimedes::App*);
~DependsOnPrintStatic();
void run();
void onLoad() {}
};
#ifndef DEPENDSONPRINTSTATIC_STATIC
#define MODULE_TYPE DependsOnPrintStatic
#include "endModule.h"
#endif

View File

@@ -0,0 +1,15 @@
#include "Print.h"
Print::Print(void* h, Archimedes::App* a) : Archimedes::Module(h, a) {
name = "Print";
}
Print::~Print() {
std::cout << "Print Destroyed!\n";
}
void Print::run() {
std::cout << "Print lib loaded and run!\n";
app->stopModule(self);
}

View File

@@ -0,0 +1,16 @@
#include "Archimedes.h"
class Print : public Archimedes::Module {
public:
Print(void*, Archimedes::App*);
~Print();
void run();
void onLoad() {}
};
#ifndef PRINT_STATIC
#define MODULE_TYPE Print
#include "endModule.h"
#endif

View File

@@ -0,0 +1,37 @@
#include "TestMenu.h"
TestMenu::TestMenu(void* h, App& a) : Module(h, a) {
name = "TestMenu";
}
TestMenu::~TestMenu() {
std::cout << "TestMenu Destroyed!\n";
}
void TestMenu::run() {
std::cout << "Your number is: " << num << "\n"
<< "1. Add 1\n"
<< "2. Subtract 1\n"
<< "3. Unload Module\n\n"
<< "4. Quit\n\n";
std::cin >> choice;
switch(choice) {
case 1:
num++;
break;
case 2:
num--;
break;
case 3:
app.stopModule(self);
break;
case 4:
app.end();
break;
default:
break;
}
}

View File

@@ -0,0 +1,20 @@
#include "Archimedes.h"
class TestMenu : public Module {
public:
TestMenu(void*, App&);
~TestMenu();
void run();
void onLoad() {}
private:
int choice;
int num = 5;
};
extern "C" {
Module* create(void* handle, App& app) {
return new TestMenu(handle, app);
}
}