64 lines
1.5 KiB
C++
Executable File
64 lines
1.5 KiB
C++
Executable File
#include "test_panel_2.hpp"
|
|
#include "utils.hpp"
|
|
|
|
namespace sandbox
|
|
{
|
|
void test_panel_2::on_attach()
|
|
{
|
|
hack::log()("on_attach");
|
|
|
|
// set layer params
|
|
// m_passport.m_name = "test_panel";
|
|
m_passport.m_size = mt::vec2{ 400.f, 400.f };
|
|
m_passport.m_pos = mt::vec2{ 400.f, 400.f };
|
|
}
|
|
|
|
void test_panel_2::on_detach()
|
|
{
|
|
hack::log()("on_attach");
|
|
}
|
|
|
|
void test_panel_2::render()
|
|
{
|
|
begin();
|
|
if (ImGui::Button("RUN", ImVec2(28, 30)))
|
|
{
|
|
VE::event e { test_event::TEST_EVEN , std::string("test event message") };
|
|
execute(e);
|
|
}
|
|
|
|
VE_PUSH_FONT(ICON, 18);
|
|
|
|
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
|
|
{
|
|
VE::event e { test_event::TEST_EVEN , std::string("test icon button") };
|
|
execute(e);
|
|
}
|
|
|
|
ImGui::Text(VE::style::icon::ICON_PAINT_BRUSH, " Paint" );
|
|
ImGui::Text("\xef\x87\xbc");
|
|
|
|
VE_POP_FONT();
|
|
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));
|
|
}
|
|
}
|
|
}
|
|
|