mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-12-07 12:56:34 +01:00
reworked the general update strategy interface
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include "./sound_tools.hpp"
|
||||
#include "mm/imgui/sound_info.hpp"
|
||||
#include <mm/imgui/sound_info.hpp>
|
||||
|
||||
#include <mm/engine.hpp>
|
||||
#include <entt/core/hashed_string.hpp>
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace MM::Services {
|
||||
|
||||
bool ImGuiSoundTools::enable(Engine& engine) {
|
||||
bool ImGuiSoundTools::enable(Engine& engine, std::vector<UpdateStrategies::TaskInfo>& task_array) {
|
||||
auto& menu_bar = engine.getService<MM::Services::ImGuiMenuBar>();
|
||||
|
||||
//menu_bar.menu_tree["Engine"]["Stop Engine"] = [](Engine& e) {
|
||||
@@ -35,6 +35,13 @@ namespace MM::Services {
|
||||
ImGui::MenuItem("Info", NULL, &_show_info);
|
||||
};
|
||||
|
||||
// add task
|
||||
task_array.push_back(
|
||||
UpdateStrategies::TaskInfo{"ImGuiSoundTools::render"}
|
||||
.fn([this](Engine& e){ renderImGui(e); })
|
||||
.succeed("ImGuiMenuBar::render")
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,22 +52,6 @@ namespace MM::Services {
|
||||
menu_bar.menu_tree["Sound"].erase("Info");
|
||||
}
|
||||
|
||||
std::vector<UpdateStrategies::UpdateCreationInfo> ImGuiSoundTools::registerUpdates(void) {
|
||||
using namespace entt::literals;
|
||||
return {
|
||||
{
|
||||
"ImGuiSoundTools::render"_hs,
|
||||
"ImGuiSoundTools::render",
|
||||
[this](Engine& e){ renderImGui(e); },
|
||||
UpdateStrategies::update_phase_t::MAIN,
|
||||
true,
|
||||
{
|
||||
"ImGuiMenuBar::render"_hs
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void ImGuiSoundTools::renderImGui(Engine& engine) {
|
||||
if (_show_info) {
|
||||
MM::ImGuiSoundInfo(engine, &_show_info);
|
||||
|
||||
Reference in New Issue
Block a user