diff --git a/src/sandbox/layers/test_panel/test_panel.cpp b/src/sandbox/layers/test_panel/test_panel.cpp index 0b637f8..fe33f27 100755 --- a/src/sandbox/layers/test_panel/test_panel.cpp +++ b/src/sandbox/layers/test_panel/test_panel.cpp @@ -23,14 +23,17 @@ namespace tr::layers BEGIN_IMGUI_WIN(); { - if (ImGui::Button("RUN", ImVec2(28, 30))) { + if (ImGui::Button("RUN", ImVec2(28, 30))) + { m_event_manager->execute(std::string("test signal key"), "value params run"); } TR_PUSH_FONT(ICON, 18); - if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30))) { + if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30))) + { m_event_manager->execute(std::string("test signal key"), "value params stop"); + m_event_manager->execute(std::string("test signal win"), m_win); } ImGui::Text(try_engine::style::icon::ICON_PAINT_BRUSH, " Paint" ); @@ -57,6 +60,11 @@ namespace tr::layers { auto b = std::any_cast(e); hack::log()(b); + if (b == "test signal win") + { + auto w = std::any_cast(value); + hack::log()(w.m_name); + } } } diff --git a/src/try_engine/gui/gui.hpp b/src/try_engine/gui/gui.hpp index f588c1f..f5f4bba 100755 --- a/src/try_engine/gui/gui.hpp +++ b/src/try_engine/gui/gui.hpp @@ -4,6 +4,8 @@ namespace try_engine { + struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; }; + class gui { public: diff --git a/src/try_engine/layer/layer.hpp b/src/try_engine/layer/layer.hpp index e77cbf2..76f6f44 100755 --- a/src/try_engine/layer/layer.hpp +++ b/src/try_engine/layer/layer.hpp @@ -16,9 +16,6 @@ namespace try_engine layer(const layer&) = delete; layer(layer&) = delete; - // HERE - // реализовать перемещение слоев - public: virtual void on_attach() {}; virtual void on_detach() {}; diff --git a/src/try_engine/try_engine.hpp b/src/try_engine/try_engine.hpp index 979a85a..97bda57 100755 --- a/src/try_engine/try_engine.hpp +++ b/src/try_engine/try_engine.hpp @@ -2,6 +2,7 @@ #include "try_engine/utils/utils.hpp" +#include "try_engine/gui/gui.hpp" #include "try_engine/gui/style/style.hpp" #include "try_engine/application/application.hpp" diff --git a/src/try_engine/utils/define.hpp b/src/try_engine/utils/define.hpp index f486516..8a8f1d0 100755 --- a/src/try_engine/utils/define.hpp +++ b/src/try_engine/utils/define.hpp @@ -13,7 +13,7 @@ using time = try_engine::time::timestep;\ using event_manager = try_engine::app_event::event;\ using system_event = try_engine::system_event::event;\ - struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; } m_win + using win = try_engine::win #define BASE_WINDOW_FLAGS()\ if (m_flags.m_no_titlebar) m_window_flags |= ImGuiWindowFlags_NoTitleBar;\ @@ -73,7 +73,8 @@ private:\ FLAGS_STRUCT_DEFINED();\ private:\ - event_manager* m_event_manager + event_manager* m_event_manager;\ + win m_win #define BEGIN_IMGUI_WIN() if (!ImGui::Begin(m_win.m_name.c_str(), &m_flags.m_p_open, m_window_flags)) ImGui::End()