remove debug prints

This commit is contained in:
2025-05-02 10:44:52 -05:00
parent 2ef95d6e90
commit 1a098daf9d
3 changed files with 4 additions and 61 deletions

View File

@@ -107,36 +107,7 @@ namespace Archimedes {
virtual void startModule(std::variant<std::string, Module*> m) { toOpen.push_back(m); }
virtual bool onEvent(const 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;
}
virtual bool onEvent(const Event& event) = 0;
void handleEvents() {
static bool handled;
@@ -213,8 +184,6 @@ namespace Archimedes {
return nullptr;
}
std::cout << "Load: " << (std::string) *m << "1\n";
void* h = m->getHandle();
for(auto it = runOrder.begin(); it != runOrder.end(); it++) {
if(*it == static_cast<std::string>(*m)) {
@@ -227,13 +196,9 @@ namespace Archimedes {
}
}
std::cout << "Load: " << (std::string) *m << "2\n";
if(modules.find(*m) == modules.end())
modules[*m] = m;
std::cout << "Load: " << (std::string) *m << "3\n";
for(auto it = runOrder.begin(); it != runOrder.end(); it++) {
if(m->deps.find(*it) != m->deps.end()) {
@@ -245,8 +210,6 @@ namespace Archimedes {
}
}
std::cout << "Load: " << (std::string) *m << "4\n";
//insert temporarily to avoid circular dependencies
runOrder.insert(roInsert, *m);
@@ -268,21 +231,13 @@ namespace Archimedes {
m->moduleInstances[it.first] = load(std::get<Module*>(it.second));
}
std::cout << "Load: " << (std::string) *m << "5\n";
//reinsert once final order has been reached
runOrder.remove(*m);
std::cout << "Load: " << (std::string) *m << "6\n";
runOrder.insert(roInsert, *m);
std::cout << "Load: " << (std::string) *m << "7\n";
emitEvent(new LoadModuleEvent(*m));
std::cout << "Load: " << (std::string) *m << "8\n";
return m;
}

View File

@@ -39,12 +39,8 @@ void ImguiModule::onLoad() {
std::abort();
}
std::cout << "onLoad: " << name << "1\n";
window = wm->aquireWindow();
std::cout << "onLoad: " << name << "2\n";
IMGUI_CHECKVERSION();
context = ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
@@ -61,20 +57,14 @@ void ImguiModule::onLoad() {
ImGui::StyleColorsDark();
//ImGui::StyleColorsLight();
std::cout << "onLoad: " << name << "3\n";
// Setup Platform/Renderer backends
if(!ImGui_ImplGlfw_InitForOpenGL(window->getWindowImpl().getWindow(), true))
std::cout << "GLFWImpl failed\n";
std::cout << "onLoad: " << name << "3.5\n";
if(!ImGui_ImplOpenGL3_Init("#version 330")) {
std::cout << "ImGui_ImplOpenGL3_Init failed!\n" << std::endl;
}
std::cout << "onLoad: " << name << "4\n";
wm->getRenderer()->getCmdList().push_back([](){
ImGui::Render();
@@ -85,16 +75,13 @@ void ImguiModule::onLoad() {
ImGui::NewFrame();
});
std::cout << "onLoad: " << name << "5\n";
rcmd_it = --wm->getRenderer()->getCmdList().end()++;
std::cout << "onLoad: " << name << "6\n";
//Compute first frame ahead of first WindowModule->run()
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
std::cout << "ImguiModule loaded\n";
}
bool ImguiModule::onEvent(const Archimedes::Event &event) {

View File

@@ -42,6 +42,7 @@ class WindowModule : public Archimedes::Module {
}
windowRefs++;
window->getWindowImpl().restoreContext();
return window;
}
@@ -60,8 +61,8 @@ class WindowModule : public Archimedes::Module {
int windowRefs = 0;
Archimedes::Window* window;
Archimedes::Renderer* renderer;
Archimedes::Window* window = nullptr;
Archimedes::Renderer* renderer = nullptr;
};