heavy refactoring
This commit is contained in:
@@ -57,6 +57,7 @@
|
|||||||
-DWINDOW_GLFW \
|
-DWINDOW_GLFW \
|
||||||
-DGUIMODULE \
|
-DGUIMODULE \
|
||||||
-DTESTIMGUI_STATIC \
|
-DTESTIMGUI_STATIC \
|
||||||
|
-DWINDOWMODULE_STATIC \
|
||||||
-I src -I include -I $imgui -I . \
|
-I src -I include -I $imgui -I . \
|
||||||
-lGL -lglfw -lGLEW \
|
-lGL -lglfw -lGLEW \
|
||||||
-Wall \
|
-Wall \
|
||||||
|
|||||||
@@ -126,13 +126,16 @@
|
|||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
clang++ \
|
clang++ \
|
||||||
modules/examples/GuiModules/TestImgui/src/*.cpp \
|
modules/examples/GuiModules/TestImgui/src/*.cpp \
|
||||||
|
modules/WindowModule/src/*.cpp \
|
||||||
$imgui/backends/imgui_impl_glfw.cpp \
|
$imgui/backends/imgui_impl_glfw.cpp \
|
||||||
$imgui/backends/imgui_impl_opengl3.cpp \
|
$imgui/backends/imgui_impl_opengl3.cpp \
|
||||||
$imgui/*.cpp \
|
$imgui/*.cpp \
|
||||||
-DRENDERER_OPENGL \
|
-DRENDERER_OPENGL \
|
||||||
-DWINDOW_GLFW \
|
-DWINDOW_GLFW \
|
||||||
|
-DGUIMODULE \
|
||||||
|
-DWINDOWMODULE_STATIC \
|
||||||
-fpic -shared \
|
-fpic -shared \
|
||||||
-I src -I include -I $imgui \
|
-I src -I include -I $imgui -I . \
|
||||||
-lGL -lglfw -lGLEW \
|
-lGL -lglfw -lGLEW \
|
||||||
-Wall \
|
-Wall \
|
||||||
-o $name
|
-o $name
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
clang++ \
|
clang++ \
|
||||||
modules/Window/src/*.cpp \
|
modules/WindowModule/src/*.cpp \
|
||||||
-fpic -shared \
|
-fpic -shared \
|
||||||
-I src -I include \
|
-I src -I include \
|
||||||
-DRENDERER_OPENGL \
|
-DRENDERER_OPENGL \
|
||||||
|
|||||||
@@ -7,8 +7,9 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
|
#include <any>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <functional>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
//#include <chrono>
|
//#include <chrono>
|
||||||
//#include <thread>
|
//#include <thread>
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ namespace Archimedes {
|
|||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
std::list<Module*> modules;
|
std::unordered_map<std::string, Module*> modules;
|
||||||
|
std::list<std::string> runOrder;
|
||||||
|
|
||||||
std::list<Module*> toClose;
|
std::list<Module*> toClose;
|
||||||
std::list<std::string> toOpen;
|
std::list<std::string> toOpen;
|
||||||
|
|
||||||
@@ -73,53 +75,47 @@ namespace Archimedes {
|
|||||||
return create(h, Get());
|
return create(h, Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::list<Module*>::iterator load(std::string modulePath, std::list<std::string> blacklist = {}) {
|
virtual Module* load(std::string modulePath, std::list<std::string>::iterator ins) {
|
||||||
Module* m = dynamicLoad(modulePath);
|
Module* m = dynamicLoad(modulePath);
|
||||||
return load(m, blacklist);
|
return load(m, ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::list<Module*>::iterator load(Module* m, std::list<std::string> blacklist = {}) {
|
virtual Module* load(Module* m, std::list<std::string>::iterator ins) {
|
||||||
|
|
||||||
if(!m) {
|
if(!m) {
|
||||||
return modules.end();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* h = m->getHandle();
|
void* h = m->getHandle();
|
||||||
for(auto it = blacklist.begin(); it != blacklist.end(); it++) {
|
for(auto it = runOrder.begin(); it != runOrder.end(); it++) {
|
||||||
if(*it == m->getName()) {
|
if(*it == m->getName()) {
|
||||||
std::cout << "Module \"" << *it << "\" is already loaded!\n";
|
std::cout << "Module \"" << *it << "\" is already loaded!\n";
|
||||||
delete m;
|
delete m;
|
||||||
if(h)
|
if(h)
|
||||||
dlclose(h);
|
dlclose(h);
|
||||||
return modules.end();
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blacklist.push_back(m->getName());
|
|
||||||
|
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
for(auto it = m->deps.begin(); it != m->deps.end(); it++) {
|
for(auto it = runOrder.begin(); it != runOrder.end(); it++) {
|
||||||
for(std::string s : blacklist) {
|
|
||||||
if(it->first == s)
|
if(m->deps.find(*it) != m->deps.end()) {
|
||||||
skip = true;
|
skip = true;
|
||||||
|
m->depsInstances[*it] = modules[*it];
|
||||||
}
|
}
|
||||||
if(skip) {
|
if(skip) {
|
||||||
skip = false;
|
skip = false;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if(std::holds_alternative<std::string>(it->second))
|
if(std::holds_alternative<std::string>(m->deps[*it]))
|
||||||
m->depsInstances[it->first] = load(std::get<std::string>(it->second), blacklist);
|
m->depsInstances[*it] = load(std::get<std::string>(m->deps[*it]), ins);
|
||||||
else
|
else
|
||||||
m->depsInstances[it->first] = load(std::get<Module*>(it->second), blacklist);
|
m->depsInstances[*it] = load(std::get<Module*>(m->deps[*it]), ins);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return m;
|
||||||
modules.push_back(m);
|
|
||||||
m->setSelf(--modules.end());
|
|
||||||
modules.end()++;
|
|
||||||
|
|
||||||
return m->self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void unload(std::list<Module*>::iterator it) {
|
virtual void unload(std::list<Module*>::iterator it) {
|
||||||
@@ -135,13 +131,6 @@ namespace Archimedes {
|
|||||||
|
|
||||||
virtual void printHelp() = 0;
|
virtual void printHelp() = 0;
|
||||||
|
|
||||||
std::list<std::string> getBlacklist() {
|
|
||||||
std::list<std::string> l;
|
|
||||||
for(Module* m : modules)
|
|
||||||
l.push_back(m->getName());
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
#include "utils/Module/Module.h"
|
#include "utils/Module/Module.h"
|
||||||
|
|
||||||
|
#ifndef WINDOWMODULE_STATIC
|
||||||
#define WINDOWMODULE_STATIC
|
#define WINDOWMODULE_STATIC
|
||||||
|
#endif
|
||||||
#include "modules/WindowModule/src/WindowModule.h"
|
#include "modules/WindowModule/src/WindowModule.h"
|
||||||
|
|
||||||
namespace Archimedes {
|
namespace Archimedes {
|
||||||
@@ -14,15 +16,15 @@ namespace Archimedes {
|
|||||||
typedef GuiModule* create_t(void*, App*);
|
typedef GuiModule* create_t(void*, App*);
|
||||||
|
|
||||||
GuiModule(void* h, App* a) : Module(h, a) {
|
GuiModule(void* h, App* a) : Module(h, a) {
|
||||||
windowModule = new WindowModule(nullptr, a);
|
//wm = new WindowModule(nullptr, a);
|
||||||
deps["WindowModule"] = windowModule;
|
deps["WindowModule"] = new WindowModule(nullptr, a);
|
||||||
}
|
}
|
||||||
virtual ~GuiModule() {}
|
virtual ~GuiModule() {}
|
||||||
virtual void onLoad() = 0;
|
virtual void onLoad() = 0;
|
||||||
virtual void run() = 0;
|
virtual void run() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WindowModule* windowModule;
|
//WindowModule* wm;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,18 @@ namespace Archimedes {
|
|||||||
std::string getName() const { return name; }
|
std::string getName() const { return name; }
|
||||||
void* getHandle() { return handle; }
|
void* getHandle() { return handle; }
|
||||||
|
|
||||||
void setSelf(std::list<Module*>::iterator s) { self = s; }
|
std::any getData(std::string s) { return data[s.c_str()]; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string name;
|
std::string name;
|
||||||
void* handle;
|
void* handle;
|
||||||
std::list<Module*>::iterator self;
|
|
||||||
|
|
||||||
App* app;
|
App* app;
|
||||||
|
|
||||||
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
std::unordered_map<std::string, std::variant<std::string, Module*>> deps;
|
||||||
std::unordered_map<std::string, std::list<Module*>::iterator> depsInstances;
|
std::unordered_map<std::string, Module*> depsInstances;
|
||||||
|
|
||||||
|
std::unordered_map<std::string, std::any> data;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,21 +13,14 @@ namespace Archimedes {
|
|||||||
|
|
||||||
~Renderer() {}
|
~Renderer() {}
|
||||||
|
|
||||||
void init() { r.init(); }
|
bool init() { return r.init(); }
|
||||||
|
|
||||||
void render() {
|
void render() {
|
||||||
r.render(rc, w, h);
|
r.render(rc, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<renderCmd*>::iterator addRenderCmd(renderCmd* cmd) {
|
std::list<renderCmd*>& getCmdList() {
|
||||||
|
return rc;
|
||||||
auto it = rc.end();
|
|
||||||
rc.push_back(cmd);
|
|
||||||
return it;
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeRenderCmd(std::list<renderCmd*>::iterator cmd) {
|
|
||||||
rc.erase(cmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ namespace Archimedes {
|
|||||||
RendererOpenGL() {};
|
RendererOpenGL() {};
|
||||||
~RendererOpenGL() {};
|
~RendererOpenGL() {};
|
||||||
|
|
||||||
void init() { glewInit(); };
|
bool init() {
|
||||||
|
return glewInit() == GLEW_OK;
|
||||||
|
};
|
||||||
|
|
||||||
void render(std::list<renderCmd*> cmdList, int& w, int& h) {
|
void render(std::list<renderCmd*> cmdList, int& w, int& h) {
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ namespace Archimedes {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~Window() {};
|
Window() { renderer = new Renderer(); }
|
||||||
|
|
||||||
|
~Window() { delete renderer; }
|
||||||
|
|
||||||
bool shouldClose() { return window.shouldClose(); }
|
bool shouldClose() { return window.shouldClose(); }
|
||||||
|
|
||||||
@@ -27,7 +29,7 @@ namespace Archimedes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Renderer* getRenderer() { return renderer; }
|
Renderer* getRenderer() { return renderer; }
|
||||||
void setRenderer(Renderer* r) { renderer = r; }
|
//void setRenderer(Renderer* r) { renderer = r; }
|
||||||
|
|
||||||
WindowImpl& getWindowImpl() { return window; }
|
WindowImpl& getWindowImpl() { return window; }
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Archimedes {
|
|||||||
std::cout << "Window Created!\n";
|
std::cout << "Window Created!\n";
|
||||||
glfwMakeContextCurrent(w);
|
glfwMakeContextCurrent(w);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~WindowGLFW() {
|
~WindowGLFW() {
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
#include "WindowModule.h"
|
#include "WindowModule.h"
|
||||||
|
|
||||||
WindowModule::WindowModule(void* h, Archimedes::App* a) : Module(h, a) {
|
|
||||||
name = "Window";
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowModule::~WindowModule() {
|
WindowModule::~WindowModule() {
|
||||||
if(window)
|
if(window)
|
||||||
delete window;
|
delete window;
|
||||||
@@ -14,11 +10,21 @@ WindowModule::~WindowModule() {
|
|||||||
void WindowModule::onLoad() {
|
void WindowModule::onLoad() {
|
||||||
|
|
||||||
window = new Archimedes::Window();
|
window = new Archimedes::Window();
|
||||||
renderer = new Archimedes::Renderer();
|
//renderer = new Archimedes::Renderer();
|
||||||
|
|
||||||
window->setRenderer(renderer);
|
//window->setRenderer(renderer);
|
||||||
|
|
||||||
renderer->init();
|
renderer = window->getRenderer();
|
||||||
|
|
||||||
|
if(!renderer->init()) {
|
||||||
|
std::cout << "Renderer init failed!\n";
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
data["window"] = window->getWindowImpl().getWindow();
|
||||||
|
data["renderCmdList"] = &renderer->getCmdList();
|
||||||
|
|
||||||
|
std::cout << "WindowModule GLFWwindow*: " << std::any_cast<decltype(window->getWindowImpl().getWindow())>(data["window"]) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowModule::run() {
|
void WindowModule::run() {
|
||||||
|
|||||||
@@ -1,14 +1,24 @@
|
|||||||
#ifndef WINDOWMODULE_H
|
#ifndef WINDOWMODULE_H
|
||||||
#define WINDOWMODULE_H
|
#define WINDOWMODULE_H
|
||||||
|
|
||||||
|
#ifdef GUIMODULE
|
||||||
|
#undef GUIMODULE
|
||||||
#include "Archimedes.h"
|
#include "Archimedes.h"
|
||||||
|
#define GUIMODULE
|
||||||
|
#else
|
||||||
|
#include "Archimedes.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "utils/Window/Window.h"
|
#include "utils/Window/Window.h"
|
||||||
#include "utils/Renderer/Renderer.h"
|
#include "utils/Renderer/Renderer.h"
|
||||||
|
|
||||||
class WindowModule : public Archimedes::Module {
|
class WindowModule : public Archimedes::Module {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WindowModule(void*, Archimedes::App*);
|
WindowModule(void* h, Archimedes::App* a) : Archimedes::Module(h, a) {
|
||||||
|
name = "WindowModule";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
~WindowModule();
|
~WindowModule();
|
||||||
|
|
||||||
@@ -17,20 +27,11 @@ class WindowModule : public Archimedes::Module {
|
|||||||
void onLoad();
|
void onLoad();
|
||||||
|
|
||||||
//interface for other modules
|
//interface for other modules
|
||||||
std::list<Archimedes::Renderer::renderCmd*>::iterator addRenderCmd(Archimedes::Renderer::renderCmd* cmd) {
|
|
||||||
return renderer->addRenderCmd(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void removeRenderCmd(std::list<Archimedes::Renderer::renderCmd*>::iterator cmd) {
|
|
||||||
renderer->removeRenderCmd(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto getWindowImpl() { return window->getWindowImpl(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Archimedes::Window* window;
|
Archimedes::Window* window;
|
||||||
Archimedes::Renderer* renderer;
|
Archimedes::Renderer* renderer;
|
||||||
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ TestImgui::TestImgui(void* h, Archimedes::App* a) : Archimedes::GuiModule(h, a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestImgui::~TestImgui() {
|
TestImgui::~TestImgui() {
|
||||||
windowModule->removeRenderCmd(rcmd);
|
|
||||||
|
std::list<Archimedes::Renderer::renderCmd*>* cmdList =
|
||||||
|
std::any_cast<std::list<Archimedes::Renderer::renderCmd*>*>(depsInstances["WindowModule"]->getData("renderCmdList"));
|
||||||
|
cmdList->erase(rcmd);
|
||||||
ImGui_ImplOpenGL3_Shutdown();
|
ImGui_ImplOpenGL3_Shutdown();
|
||||||
ImGui_ImplGlfw_Shutdown();
|
ImGui_ImplGlfw_Shutdown();
|
||||||
ImGui::DestroyContext();
|
ImGui::DestroyContext();
|
||||||
@@ -20,6 +23,13 @@ TestImgui::~TestImgui() {
|
|||||||
|
|
||||||
void TestImgui::onLoad() {
|
void TestImgui::onLoad() {
|
||||||
|
|
||||||
|
Archimedes::Module* wm = depsInstances["WindowModule"];
|
||||||
|
|
||||||
|
if(!wm) {
|
||||||
|
std::cout << "No WindowModule for TestImgui!\n";
|
||||||
|
std::abort();
|
||||||
|
}
|
||||||
|
|
||||||
IMGUI_CHECKVERSION();
|
IMGUI_CHECKVERSION();
|
||||||
ImGui::CreateContext();
|
ImGui::CreateContext();
|
||||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||||
@@ -27,26 +37,45 @@ void TestImgui::onLoad() {
|
|||||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
|
||||||
|
|
||||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
||||||
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
//io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; // Enable Multi-Viewport / Platform Windows
|
||||||
|
|
||||||
// Setup Dear ImGui style
|
// Setup Dear ImGui style
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
//ImGui::StyleColorsLight();
|
//ImGui::StyleColorsLight();
|
||||||
|
|
||||||
|
std::cout << "init backends\n";
|
||||||
// Setup Platform/Renderer backends
|
// Setup Platform/Renderer backends
|
||||||
ImGui_ImplGlfw_InitForOpenGL(windowModule->getWindowImpl().getWindow(), true);
|
std::cout << wm->getName() << std::endl;
|
||||||
ImGui_ImplOpenGL3_Init("#version 330");
|
GLFWwindow* w = std::any_cast<GLFWwindow*>(wm->getData("window"));
|
||||||
|
|
||||||
rcmd = windowModule->addRenderCmd([](){
|
std::cout << "TestImgui GLFWwindow*: " << w << std::endl;
|
||||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
|
||||||
|
|
||||||
/*if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
if(!ImGui_ImplGlfw_InitForOpenGL(w, true))
|
||||||
{
|
std::cout << "GLFWImpl failed\n";
|
||||||
ImGui::UpdatePlatformWindows();
|
if(!ImGui_ImplOpenGL3_Init("#version 330")) {
|
||||||
ImGui::RenderPlatformWindowsDefault();
|
std::cout << "ImGui_ImplOpenGL3_Init failed!\n" << std::endl;
|
||||||
}*/
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
std::cout << "register renderCmd\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
std::list<Archimedes::Renderer::renderCmd*>* cmdList =
|
||||||
|
std::any_cast<std::list<Archimedes::Renderer::renderCmd*>*>(wm->getData("renderCmdList"));
|
||||||
|
|
||||||
|
cmdList->push_back([](){
|
||||||
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
});
|
||||||
|
|
||||||
|
rcmd = --cmdList->end();
|
||||||
|
cmdList->end()++;
|
||||||
|
|
||||||
|
//Compute first frame ahead of first WindowModule->run()
|
||||||
|
ImGui_ImplOpenGL3_NewFrame();
|
||||||
|
ImGui_ImplGlfw_NewFrame();
|
||||||
|
ImGui::NewFrame();
|
||||||
|
|
||||||
|
ImGui::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestImgui::run() {
|
void TestImgui::run() {
|
||||||
@@ -60,5 +89,4 @@ void TestImgui::run() {
|
|||||||
app->end();
|
app->end();
|
||||||
|
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "Archimedes.h"
|
#include "Archimedes.h"
|
||||||
|
|
||||||
|
#include "utils/Window/Window.h"
|
||||||
|
|
||||||
class TestImgui : public Archimedes::GuiModule {
|
class TestImgui : public Archimedes::GuiModule {
|
||||||
|
|
||||||
@@ -16,9 +17,12 @@ class TestImgui : public Archimedes::GuiModule {
|
|||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool demo = true;
|
bool demo = true;
|
||||||
std::list<Archimedes::Renderer::renderCmd*>::iterator rcmd;
|
std::list<Archimedes::Renderer::renderCmd*>::iterator rcmd;
|
||||||
|
|
||||||
|
Archimedes::Window* window;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef TESTIMGUI_STATIC
|
#ifndef TESTIMGUI_STATIC
|
||||||
|
|||||||
@@ -2,14 +2,19 @@
|
|||||||
|
|
||||||
void ImguiEmbed::run() {
|
void ImguiEmbed::run() {
|
||||||
|
|
||||||
for(auto* m : modules)
|
for(auto* m : modules) {
|
||||||
m->onLoad();
|
std::cout << "Loading Module: " << m->getName() << std::endl;
|
||||||
|
//if(m->getName() != "WindowModule")
|
||||||
|
m->onLoad();
|
||||||
|
}
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (!done && !modules.empty()) {
|
while (!done && !modules.empty()) {
|
||||||
|
|
||||||
for(auto* m : modules) {
|
for(auto* m : modules) {
|
||||||
m->run();
|
//std::cout << "Running Module: " << m->getName() << std::endl;
|
||||||
|
//if(m->getName() != "WindowModule")
|
||||||
|
m->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto it = toClose.begin(); it != toClose.end(); it++) {
|
for(auto it = toClose.begin(); it != toClose.end(); it++) {
|
||||||
@@ -18,7 +23,7 @@ void ImguiEmbed::run() {
|
|||||||
toClose.clear();
|
toClose.clear();
|
||||||
|
|
||||||
for(std::string s : toOpen) {
|
for(std::string s : toOpen) {
|
||||||
load(s, getBlacklist());
|
load(s, modules.begin());
|
||||||
}
|
}
|
||||||
toOpen.clear();
|
toOpen.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ void MinimalApp::run() {
|
|||||||
toClose.clear();
|
toClose.clear();
|
||||||
|
|
||||||
for(std::string s : toOpen) {
|
for(std::string s : toOpen) {
|
||||||
load(s, getBlacklist());
|
load(s, modules.begin());
|
||||||
}
|
}
|
||||||
toOpen.clear();
|
toOpen.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class MinimalApp : public Archimedes::App {
|
|||||||
void handleArgs(const int& argc, char* argv[]) {
|
void handleArgs(const int& argc, char* argv[]) {
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
for(int i = 1; i < argc; i++)
|
for(int i = 1; i < argc; i++)
|
||||||
load(dynamicLoad(argv[i]), getBlacklist());
|
load(dynamicLoad(argv[i]), modules.begin());
|
||||||
} else {
|
} else {
|
||||||
std::cout << "No modules to load\n";
|
std::cout << "No modules to load\n";
|
||||||
end();
|
end();
|
||||||
|
|||||||
Reference in New Issue
Block a user