toOpen is a list
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Archimedes {
|
||||
|
||||
virtual void stopModule(std::string lib) { toClose.push_back(lib); }
|
||||
|
||||
virtual void startModule(std::string lib, std::variant<std::string, Module*> m) { toOpen[lib] = m; }
|
||||
virtual void startModule(std::variant<std::string, Module*> m) { toOpen.push_back(m); }
|
||||
|
||||
void end() { done = true; }
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Archimedes {
|
||||
std::list<std::string> runOrder;
|
||||
|
||||
std::list<std::string> toClose;
|
||||
std::unordered_map<std::string, std::variant<std::string, Module*>> toOpen;
|
||||
std::list<std::variant<std::string, Module*>> toOpen;
|
||||
|
||||
virtual Module* dynamicLoad(std::string lib) {
|
||||
|
||||
|
||||
@@ -27,23 +27,18 @@ void MainGUI::onLoad() {
|
||||
}
|
||||
|
||||
void MainGUI::run() {
|
||||
{
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
static float f = 0.0f;
|
||||
static int counter = 0;
|
||||
static std::string path;
|
||||
|
||||
ImGui::Begin("MainGUI Module"); // Create a window called "Hello, world!" and append into it.
|
||||
ImGui::Begin("MainGUI Module");
|
||||
|
||||
ImGui::Text("This is some useful text."); // Display some text (you can use a format strings too)
|
||||
ImGui::Text("Enter a module to load:");
|
||||
ImGui::InputText("path: ", path.data(), path.size());
|
||||
|
||||
ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 1 float using a slider from 0.0f to 1.0f
|
||||
|
||||
if (ImGui::Button("Button")) // Buttons return true when clicked (most widgets return true when edited/activated)
|
||||
counter++;
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("counter = %d", counter);
|
||||
if (ImGui::Button("Button"))
|
||||
app->startModule(path);
|
||||
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ void ImguiEmbed::run() {
|
||||
toClose.clear();
|
||||
|
||||
for(auto m : toOpen) {
|
||||
if(std::holds_alternative<std::string>(m.second)) {
|
||||
load(std::get<std::string>(m.second))->onLoad();
|
||||
if(std::holds_alternative<std::string>(m)) {
|
||||
load(std::get<std::string>(m))->onLoad();
|
||||
} else {
|
||||
load(std::get<Archimedes::Module*>(m.second))->onLoad();
|
||||
load(std::get<Archimedes::Module*>(m))->onLoad();
|
||||
}
|
||||
}
|
||||
toOpen.clear();
|
||||
|
||||
@@ -19,10 +19,10 @@ void MinimalApp::run() {
|
||||
toClose.clear();
|
||||
|
||||
for(auto m : toOpen) {
|
||||
if(std::holds_alternative<std::string>(m.second)) {
|
||||
load(std::get<std::string>(m.second))->onLoad();
|
||||
if(std::holds_alternative<std::string>(m)) {
|
||||
load(std::get<std::string>(m))->onLoad();
|
||||
} else {
|
||||
load(std::get<Archimedes::Module*>(m.second))->onLoad();
|
||||
load(std::get<Archimedes::Module*>(m))->onLoad();
|
||||
}
|
||||
}
|
||||
toOpen.clear();
|
||||
|
||||
Reference in New Issue
Block a user