mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-06-19 11:16:37 +02:00
adopt engine stuff to new update strategy
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
#include "mm/services/service.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <mm/engine.hpp>
|
||||
@ -7,6 +8,8 @@
|
||||
#include <mm/services/imgui_s.hpp>
|
||||
#include <mm/opengl/render_tasks/imgui.hpp>
|
||||
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
TEST(imgui_render_task, demowindow) {
|
||||
@ -22,19 +25,26 @@ TEST(imgui_render_task, demowindow) {
|
||||
engine.addService<MM::Services::ImGuiService>();
|
||||
ASSERT_TRUE(engine.enableService<MM::Services::ImGuiService>());
|
||||
|
||||
class ImGuiDemoWindowService : public MM::Services::Service {
|
||||
public:
|
||||
const char* name(void) override { return "ImGuiDemoWindowService"; }
|
||||
bool enable(MM::Engine&) override { return true; }
|
||||
void disable(MM::Engine&) override {}
|
||||
|
||||
std::vector<MM::UpdateStrategies::UpdateCreationInfo> registerUpdates(void) override {
|
||||
return {{
|
||||
"ImGuiDemoWindow"_hs,
|
||||
"ImGuiDemoWindow",
|
||||
[](MM::Engine&) { ImGui::ShowDemoWindow(); }
|
||||
}};
|
||||
}
|
||||
|
||||
};
|
||||
engine.addService<ImGuiDemoWindowService>();
|
||||
ASSERT_TRUE(engine.enableService<ImGuiDemoWindowService>());
|
||||
|
||||
rs.addRenderTask<MM::OpenGL::RenderTasks::ImGuiRT>(engine);
|
||||
|
||||
auto handle = engine.addUpdate([](MM::Engine&) {
|
||||
ImGui::ShowDemoWindow();
|
||||
}
|
||||
);
|
||||
|
||||
{
|
||||
auto tmp_lock = handle.lock();
|
||||
tmp_lock->priority = 0;
|
||||
tmp_lock->name = "imgui demo window";
|
||||
}
|
||||
|
||||
engine.run();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user