fix event func

This commit is contained in:
2025-03-15 12:33:59 +03:00
parent c555c47eb3
commit 3b64a8a337
7 changed files with 44 additions and 43 deletions

View File

@@ -5,7 +5,7 @@ namespace sandbox
{
void local_panel::on_attach()
{
VE_CONNECT(local_panel);
VE::CONNECT(this);
}
void local_panel::render()
@@ -15,8 +15,7 @@ namespace sandbox
{
auto f = []()
{
VE::event e { test_event::TEST_EVEN , std::string("test event message from thread") };
VE_EMIT(e);
VE::EMIT(test_event::TEST_EVEN, std::string("test event message from thread"));
};
std::thread th(f);
th.detach();
@@ -26,8 +25,7 @@ namespace sandbox
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
{
VE::event e { test_event::TEST_EVEN , std::string("test icon button") };
VE_EMIT(e);
VE::EMIT(test_event::TEST_EVEN, std::string("test icon button"));
}
ImGui::Text(VE::style::icon::ICON_PAINT_BRUSH, " Paint" );

View File

@@ -47,7 +47,6 @@ namespace sandbox
void opengl_panel::on_attach()
{
VE_CONNECT(opengl_panel);
hack::log()("on_attach");
}

View File

@@ -5,7 +5,7 @@ namespace sandbox
{
void test_panel::on_attach()
{
VE_CONNECT(test_panel);
VE::CONNECT(this);
hack::log()("on_attach", VE::application::get()->get_glfw()->width());
}
@@ -18,8 +18,7 @@ namespace sandbox
if (ImGui::Button("RUN test_panel_1", ImVec2(128, 130)))
{
VE::event e { test_event::TEST_EVEN , std::string("test event message tp 1") };
VE_EMIT(e);
VE::EMIT(test_event::TEST_EVEN, std::string("test event message tp 1"));
}
ImGui::End();

View File

@@ -5,17 +5,21 @@ namespace sandbox
{
void test_panel_2::on_attach()
{
VE_CONNECT(test_panel_2);
VE::CONNECT(this);
// ATTENTION: активировать сигнальную систему в детях-компонентах
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);
}
// for (int i = 0; i < 200; ++i)
// {
// auto lp = std::make_shared<local_panel>();
// lp->on_attach();
// m_local_panel_hub.push_back(lp);
// }
auto lp = std::make_shared<local_panel>();
lp->on_attach();
m_local_panel_hub.push_back(lp);
hack::log()("on_attach");
}