40 lines
669 B
C++
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
|