mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-12-06 17:16:36 +01:00
adopt engine stuff to new update strategy
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include <imgui/imgui.h>
|
||||
#include <imgui_impl_sdl.h>
|
||||
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
|
||||
#ifdef MM_OPENGL_3
|
||||
#include <imgui_impl_opengl3.h>
|
||||
#endif
|
||||
@@ -102,12 +104,6 @@ bool ImGuiService::enable(Engine& engine) {
|
||||
return false;
|
||||
});
|
||||
|
||||
_new_frame_handle = engine.addUpdate([this](Engine& e) { this->imgui_new_frame(e); });
|
||||
assert(!_new_frame_handle.expired());
|
||||
auto tmp_lock = _new_frame_handle.lock();
|
||||
tmp_lock->priority = 90; // after sdl events (100)
|
||||
tmp_lock->name = "imgui new frame";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -115,8 +111,6 @@ void ImGuiService::disable(Engine& engine) {
|
||||
auto& sdl_ss = engine.getService<MM::Services::SDLService>();
|
||||
sdl_ss.removeEventHandler(_event_handle);
|
||||
|
||||
engine.removeUpdate(_new_frame_handle);
|
||||
|
||||
ImGui::EndFrame(); // making sure, does not work????
|
||||
|
||||
#ifdef MM_OPENGL_3
|
||||
@@ -126,6 +120,19 @@ void ImGuiService::disable(Engine& engine) {
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
|
||||
std::vector<UpdateStrategies::UpdateCreationInfo> ImGuiService::registerUpdates(void) {
|
||||
return {
|
||||
{
|
||||
"ImGuiService::new_frame"_hs,
|
||||
"ImGuiService::new_frame",
|
||||
[this](Engine& e) { this->imgui_new_frame(e); },
|
||||
UpdateStrategies::update_phase_t::PRE,
|
||||
true,
|
||||
{"SDLService::events"_hs}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ImGuiService::imgui_new_frame(Engine& engine) {
|
||||
ZoneScopedN("MM::Services::ImGuiService::imgui_new_frame");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user