blocky/playground/initiator.hh
2022-06-22 11:48:52 +09:00

40 lines
669 B
C++

#pragma once
#include <memory>
#include <vector>
#include <imgui.h>
#include "app.hh"
namespace pg {
class Initiator final : App {
public:
Initiator() noexcept {
}
void Update() noexcept override {
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("Apps")) {
for (const auto& type : registry()) {
if (ImGui::MenuItem(type.first.c_str())) {
apps_.push_back(type.second->Create());
}
}
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
for (auto& app : apps_) {
app->Update();
}
}
private:
std::vector<std::unique_ptr<App>> apps_;
};
} // namespace pg