Files
vertex_engine/bin/layers/test_panel_2/test_panel_2.cpp
2025-03-06 09:20:46 +03:00

61 lines
1.3 KiB
C++
Executable File

#include "test_panel_2.hpp"
#include "utils.hpp"
namespace sandbox
{
void test_panel_2::on_attach()
{
VE_CONNECT("test_panel_2", test_panel_2);
// 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);
}
hack::log()("on_attach");
}
void test_panel_2::render()
{
ImGui::SetNextWindowPos(m_pos);
ImGui::SetNextWindowSize(m_size);
if (!ImGui::Begin("#test_panel_2", &m_p_open, m_window_flags)) ImGui::End();
m_local_panel.render();
for(auto& lp : m_local_panel_hub) lp->render();
ImGui::End();
}
void test_panel_2::on_event(VE::event e)
{
// для событий от перефирии
// if (e.m_type.type() == typeid(VE::event_type))
// {
// auto t = std::any_cast<VE::event_type>(e.m_type);
// if (t != VE::event_type::MOUSE_CURSOR_POSITION)
// hack::log()((int)t);
// }
if (e.m_type.type() == typeid(test_event))
{
auto t = std::any_cast<test_event>(e.m_type);
if (t == test_event::TEST_EVEN)
hack::log()(std::any_cast<std::string>(e.m_data));
}
}
void test_panel_2::update()
{
}
}