introduce active and passive events
This commit is contained in:
@@ -14,8 +14,25 @@ ChatClient::ChatClient(Archimedes::App* a, void* h) : Module(a, h) {
|
||||
deps[*im] = im;
|
||||
}
|
||||
|
||||
ChatClient::~ChatClient() {
|
||||
if(app) {
|
||||
|
||||
ImguiModule* im; { im = (ImguiModule*) moduleInstances[ImguiModule()]; }
|
||||
|
||||
im->releaseContext(ImGui::GetCurrentContext());
|
||||
}
|
||||
}
|
||||
|
||||
void ChatClient::onLoad() {
|
||||
|
||||
ImguiModule* im; { im = (ImguiModule*) moduleInstances[ImguiModule()]; }
|
||||
|
||||
if(!im) {
|
||||
std::cout << "No ImguiModule for TestImgui!\n";
|
||||
std::abort();
|
||||
}
|
||||
|
||||
ImGui::SetCurrentContext(im->aquireContext());
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +75,7 @@ void ChatClient::run() {
|
||||
|
||||
ImGui::End();
|
||||
} else {
|
||||
app->stopModule(name);
|
||||
app->emitEvent(new Archimedes::DoUnloadModuleEvent(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ class ChatClient : public Archimedes::Module {
|
||||
|
||||
ChatClient() { name = "ChatClient"; }
|
||||
|
||||
~ChatClient() {
|
||||
if(app) {}
|
||||
}
|
||||
~ChatClient();
|
||||
|
||||
void onLoad();
|
||||
|
||||
|
||||
@@ -12,5 +12,5 @@ DependsOnPrint::~DependsOnPrint() {
|
||||
|
||||
void DependsOnPrint::run() {
|
||||
std::cout << "DependsOnPrint lib loaded and run!\n";
|
||||
app->stopModule(name);
|
||||
app->emitEvent(new Archimedes::DoUnloadModuleEvent(name));
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ DependsOnPrintStatic::~DependsOnPrintStatic() {
|
||||
|
||||
void DependsOnPrintStatic::run() {
|
||||
std::cout << "DependsOnPrintStatic lib loaded and run!\n";
|
||||
app->stopModule(name);
|
||||
app->emitEvent(new Archimedes::DoUnloadModuleEvent(name));
|
||||
}
|
||||
|
||||
@@ -10,19 +10,21 @@ TestImgui::TestImgui(Archimedes::App* a, void* h) : Archimedes::Module(a, h) {
|
||||
}
|
||||
|
||||
TestImgui::~TestImgui() {
|
||||
|
||||
|
||||
ImguiModule* im; { im = (ImguiModule*) moduleInstances[ImguiModule()]; }
|
||||
im->releaseContext(ImGui::GetCurrentContext());
|
||||
}
|
||||
|
||||
void TestImgui::onLoad() {
|
||||
|
||||
ImguiModule* im = (ImguiModule*) moduleInstances["ImguiModule"];
|
||||
ImguiModule* im; { im = (ImguiModule*) moduleInstances[ImguiModule()]; }
|
||||
|
||||
if(!im) {
|
||||
std::cout << "No ImguiModule for TestImgui!\n";
|
||||
std::abort();
|
||||
}
|
||||
|
||||
ImGui::SetCurrentContext(im->getContext());
|
||||
ImGui::SetCurrentContext(im->aquireContext());
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ void TestImgui::run() {
|
||||
if(demo)
|
||||
ImGui::ShowDemoWindow(&this->demo);
|
||||
else
|
||||
app->stopModule(name);
|
||||
app->emitEvent(new Archimedes::DoUnloadModuleEvent(name));
|
||||
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
@@ -26,7 +26,7 @@ void TestMenu::run() {
|
||||
num--;
|
||||
break;
|
||||
case 3:
|
||||
app->stopModule(name);
|
||||
app->emitEvent(new Archimedes::DoUnloadModuleEvent(name));
|
||||
break;
|
||||
case 4:
|
||||
app->end();
|
||||
|
||||
Reference in New Issue
Block a user