fix revert

This commit is contained in:
2025-02-26 14:20:46 +03:00
parent 1bdf330eb8
commit 121d4af325
8 changed files with 88 additions and 34 deletions

View File

@@ -0,0 +1,58 @@
#include "local_panel.hpp"
#include "utils.hpp"
namespace sandbox
{
void local_panel::on_attach()
{
hack::log()("on_attach");
}
void local_panel::on_detach()
{
hack::log()("on_attach");
}
void local_panel::render()
{
if (ImGui::Button("RUN", ImVec2(28, 30)))
{
VE::event e { "target_id", 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 { "target_id", 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();
}
void local_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_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));
}
}
}

View File

@@ -0,0 +1,15 @@
#pragma once
#include <VE.hpp>
namespace sandbox
{
class local_panel : public VE::layer
{
VE_FN_OVERIDE();
ImVec2 m_size = ImVec2{ 400.f, 400.f };
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
};
}

View File

@@ -3,12 +3,14 @@ inc += include_directories('.')
headers = [
'test_panel/test_panel.hpp',
'test_panel_2/test_panel_2.hpp',
'local_panel/local_panel.hpp',
'opengl_panel/opengl_panel.hpp',
]
sources = [
'test_panel/test_panel.cpp',
'test_panel_2/test_panel_2.cpp',
'local_panel/local_panel.cpp',
'opengl_panel/opengl_panel.cpp',
]

View File

@@ -6,9 +6,6 @@ namespace sandbox
void test_panel_2::on_attach()
{
hack::log()("on_attach");
// set layer params
// m_passport.m_name = "test_panel";
}
void test_panel_2::on_detach()
@@ -22,24 +19,8 @@ namespace sandbox
ImGui::SetNextWindowSize(m_size);
if (!ImGui::Begin("#test_panel_2", &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") };
execute(e);
}
VE_PUSH_FONT(ICON, 18);
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
{
VE::event e { "target_id", 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();
m_local_panel.render();
ImGui::End();
}

View File

@@ -2,6 +2,8 @@
#include <VE.hpp>
#include "local_panel/local_panel.hpp"
namespace sandbox
{
class test_panel_2 : public VE::layer
@@ -10,6 +12,8 @@ namespace sandbox
ImVec2 m_size = ImVec2{ 400.f, 400.f };
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
local_panel m_local_panel;
};
}