add shared test
This commit is contained in:
@@ -6,6 +6,14 @@ namespace sandbox
|
|||||||
{
|
{
|
||||||
class local_panel : public VE::layer
|
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();
|
VE_FN_OVERIDE();
|
||||||
|
|
||||||
ImVec2 m_size = ImVec2{ 800.f, 400.f };
|
ImVec2 m_size = ImVec2{ 800.f, 400.f };
|
||||||
|
|||||||
@@ -9,6 +9,14 @@ namespace sandbox
|
|||||||
|
|
||||||
// ATTENTION: активировать сигнальную систему в детях-компонентах
|
// ATTENTION: активировать сигнальную систему в детях-компонентах
|
||||||
m_local_panel.on_attach();
|
m_local_panel.on_attach();
|
||||||
|
|
||||||
|
for (int i = 0; i < 200; ++i)
|
||||||
|
{
|
||||||
|
auto lp = std::make_shared<local_panel>();
|
||||||
|
lp->on_attach();
|
||||||
|
m_local_panel_hub.push_back(lp);
|
||||||
|
}
|
||||||
|
|
||||||
hack::log()("on_attach");
|
hack::log()("on_attach");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,6 +29,8 @@ namespace sandbox
|
|||||||
|
|
||||||
m_local_panel.render();
|
m_local_panel.render();
|
||||||
|
|
||||||
|
for(auto& lp : m_local_panel_hub) lp->render();
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ namespace sandbox
|
|||||||
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
||||||
|
|
||||||
local_panel m_local_panel;
|
local_panel m_local_panel;
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<local_panel>> m_local_panel_hub;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ namespace VE
|
|||||||
|
|
||||||
struct event_manager : public hack::patterns::singleton<event_manager>
|
struct event_manager : public hack::patterns::singleton<event_manager>
|
||||||
{
|
{
|
||||||
std::vector<VE::event_fn<VE::event>> funcs;
|
std::vector<VE::event_fn<VE::event>> m_funcs;
|
||||||
void connect(event_fn<event> fn) { funcs.push_back(fn); };
|
void connect(event_fn<event> fn) { m_funcs.push_back(fn); };
|
||||||
void emit(event e)
|
void emit(event e)
|
||||||
{
|
{
|
||||||
for(auto& f : funcs)
|
for(auto& f : m_funcs)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -51,10 +51,11 @@ namespace VE
|
|||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::error()(e.what());
|
hack::error()(e.what());
|
||||||
|
hack::log()("size funcs", m_funcs.size());
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
hack::error()("ooops");
|
hack::error()("ooops...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user