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

51 lines
1.2 KiB
C++
Executable File

#include "test_panel.hpp"
#include "utils.hpp"
namespace sandbox
{
void test_panel::on_attach()
{
VE_CONNECT("test_panel", test_panel);
hack::log()("on_attach", VE::application::get()->get_glfw()->width());
}
void test_panel::render()
{
ImGui::SetNextWindowPos(m_pos);
ImGui::SetNextWindowSize(m_size);
if (!ImGui::Begin("#test_panel_1", &m_p_open, m_window_flags)) ImGui::End();
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);
}
ImGui::End();
}
void test_panel::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_BUTTON_DOUBLE_PRESSED) hack::log()("double");
if (t == VE::event_type::MOUSE_BUTTON_PRESSED) hack::log()("once");
}
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::update()
{
}
}