diff --git a/bin/layers/local_panel/local_panel.hpp b/bin/layers/local_panel/local_panel.hpp index 94c739c..fbdd9da 100755 --- a/bin/layers/local_panel/local_panel.hpp +++ b/bin/layers/local_panel/local_panel.hpp @@ -6,6 +6,14 @@ namespace sandbox { class local_panel : public VE::layer { + public: + local_panel() = default; + local_panel(const local_panel& lp) + { + m_size = lp.m_size; + m_pos = lp.m_pos; + } + VE_FN_OVERIDE(); ImVec2 m_size = ImVec2{ 800.f, 400.f }; diff --git a/bin/layers/test_panel_2/test_panel_2.cpp b/bin/layers/test_panel_2/test_panel_2.cpp index cd52c23..7a9a19d 100755 --- a/bin/layers/test_panel_2/test_panel_2.cpp +++ b/bin/layers/test_panel_2/test_panel_2.cpp @@ -9,6 +9,14 @@ namespace sandbox // ATTENTION: активировать сигнальную систему в детях-компонентах m_local_panel.on_attach(); + + for (int i = 0; i < 200; ++i) + { + auto lp = std::make_shared(); + lp->on_attach(); + m_local_panel_hub.push_back(lp); + } + hack::log()("on_attach"); } @@ -21,6 +29,8 @@ namespace sandbox m_local_panel.render(); + for(auto& lp : m_local_panel_hub) lp->render(); + ImGui::End(); } diff --git a/bin/layers/test_panel_2/test_panel_2.hpp b/bin/layers/test_panel_2/test_panel_2.hpp index 5595326..0f6488e 100755 --- a/bin/layers/test_panel_2/test_panel_2.hpp +++ b/bin/layers/test_panel_2/test_panel_2.hpp @@ -14,6 +14,8 @@ namespace sandbox ImVec2 m_pos = ImVec2{ 400.f, 400.f }; local_panel m_local_panel; + + std::vector> m_local_panel_hub; }; } diff --git a/src/event/event.hpp b/src/event/event.hpp index 1b7e6e6..94699e9 100755 --- a/src/event/event.hpp +++ b/src/event/event.hpp @@ -38,11 +38,11 @@ namespace VE struct event_manager : public hack::patterns::singleton { - std::vector> funcs; - void connect(event_fn fn) { funcs.push_back(fn); }; + std::vector> m_funcs; + void connect(event_fn fn) { m_funcs.push_back(fn); }; void emit(event e) { - for(auto& f : funcs) + for(auto& f : m_funcs) { try { @@ -51,10 +51,11 @@ namespace VE catch(std::exception& e) { hack::error()(e.what()); + hack::log()("size funcs", m_funcs.size()); } catch(...) { - hack::error()("ooops"); + hack::error()("ooops..."); } } }