72 lines
1.6 KiB
C++
Executable File
72 lines
1.6 KiB
C++
Executable File
#include "ui_layer_double.hpp"
|
|
|
|
#include "utils.hpp"
|
|
|
|
namespace example
|
|
{
|
|
void ui_layer_double::on_attach()
|
|
{
|
|
CONNECT(this);
|
|
|
|
hack::log()("on_attach");
|
|
}
|
|
|
|
void ui_layer_double::on_detach()
|
|
{
|
|
DISCONNECT();
|
|
hack::log()("on_detach");
|
|
}
|
|
|
|
void ui_layer_double::render()
|
|
{
|
|
ImGui::SetNextWindowPos(ImVec2{ 100.f, 800.f });
|
|
ImGui::SetNextWindowSize(m_size);
|
|
|
|
if (!ImGui::Begin(VE_NAME("Test signal_double"), nullptr, m_win_flags)) ImGui::End();
|
|
|
|
VE_PUSH_FONT(REGULAR, 20);
|
|
if (ImGui::Button("Test signal_double", ImVec2(128, 130)))
|
|
{
|
|
VE::event e { test_event::TEST_EVEN_2, std::string("test event message ui_layer_double") };
|
|
EMIT(e);
|
|
}
|
|
|
|
if (ImGui::Button("Test on_detach", ImVec2(128, 130))) on_detach();
|
|
if (ImGui::Button("Test on_attach", ImVec2(128, 130))) on_attach();
|
|
VE_POP_FONT();
|
|
|
|
VE_PUSH_FONT(ICON, 12);
|
|
ImGui::Button(VE::style::icon::ICON_ALIGN_RIGHT, ImVec2{20, 20});
|
|
VE_POP_FONT();
|
|
|
|
ImGui::End();
|
|
}
|
|
|
|
void ui_layer_double::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_2)
|
|
{
|
|
hack::log()(std::any_cast<std::string>(e.m_data));
|
|
e.m_result = std::string("test_event_2");
|
|
}
|
|
}
|
|
}
|
|
|
|
void ui_layer_double::update()
|
|
{
|
|
|
|
}
|
|
}
|
|
|