39 lines
934 B
C++
Executable File
39 lines
934 B
C++
Executable File
#include "test_panel.hpp"
|
|
#include "utils.hpp"
|
|
|
|
namespace sandbox
|
|
{
|
|
void test_panel::on_attach()
|
|
{
|
|
VE_CONNECT(test_panel, on_event);
|
|
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", ImVec2(28, 30)))
|
|
{
|
|
VE::event e { "target_id", test_event::TEST_EVEN , std::string("test event message") };
|
|
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");
|
|
}
|
|
}
|
|
}
|
|
|