diff --git a/bin/layers/opengl_panel/opengl_panel.hpp b/bin/layers/opengl_panel/opengl_panel.hpp index 3d38c47..b84826f 100755 --- a/bin/layers/opengl_panel/opengl_panel.hpp +++ b/bin/layers/opengl_panel/opengl_panel.hpp @@ -1,10 +1,9 @@ #pragma once -#include "VE.hpp" // IWYU pragma: keep +#include namespace sandbox { - class cube : public VE::opengl { public: diff --git a/bin/layers/test_panel/test_panel.cpp b/bin/layers/test_panel/test_panel.cpp index 6791b9b..ea41ff1 100755 --- a/bin/layers/test_panel/test_panel.cpp +++ b/bin/layers/test_panel/test_panel.cpp @@ -6,17 +6,6 @@ namespace sandbox void test_panel::on_attach() { hack::log()("on_attach"); - - // set layer params - // m_passport.m_name = "test_panel"; - m_passport.m_size = mt::vec2{ 600.f, 100.f }; - m_passport.m_pos = mt::vec2{ 100.f, 100.f }; - - // HERE - // можно сделать это функцией remove_frags(...) - // устанавливаем/убираем флаги отличные от установки по умолчанию - // в данном примере убираем флаг - m_window_flags &= ~ImGuiWindowFlags_NoTitleBar; } void test_panel::on_detach() @@ -26,13 +15,18 @@ namespace sandbox void test_panel::render() { - begin(); - if (ImGui::Button("RUN", ImVec2(28, 30))) - { - VE::event e { test_event::TEST_EVEN , std::string("test event message") }; - execute(e); - } - end(); + 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 { test_event::TEST_EVEN , std::string("test event message") }; + execute(e); + } + + ImGui::End(); } void test_panel::on_event(VE::event e) diff --git a/bin/layers/test_panel/test_panel.hpp b/bin/layers/test_panel/test_panel.hpp index 052e275..6226352 100755 --- a/bin/layers/test_panel/test_panel.hpp +++ b/bin/layers/test_panel/test_panel.hpp @@ -1,12 +1,15 @@ #pragma once -#include "VE.hpp" // IWYU pragma: keep +#include namespace sandbox { class test_panel : public VE::layer { VE_FN_OVERIDE(); + + ImVec2 m_size = ImVec2{ 600.f, 100.f }; + ImVec2 m_pos = ImVec2{ 100.f, 100.f }; }; } diff --git a/bin/layers/test_panel_2/test_panel_2.cpp b/bin/layers/test_panel_2/test_panel_2.cpp index da1feac..a33cf97 100755 --- a/bin/layers/test_panel_2/test_panel_2.cpp +++ b/bin/layers/test_panel_2/test_panel_2.cpp @@ -9,8 +9,6 @@ namespace sandbox // set layer params // m_passport.m_name = "test_panel"; - m_passport.m_size = mt::vec2{ 400.f, 400.f }; - m_passport.m_pos = mt::vec2{ 400.f, 400.f }; } void test_panel_2::on_detach() @@ -20,26 +18,30 @@ namespace sandbox void test_panel_2::render() { - begin(); - if (ImGui::Button("RUN", ImVec2(28, 30))) - { - VE::event e { test_event::TEST_EVEN , std::string("test event message") }; - execute(e); - } + ImGui::SetNextWindowPos(m_pos); + ImGui::SetNextWindowSize(m_size); - VE_PUSH_FONT(ICON, 18); + if (!ImGui::Begin("#test_panel_2", &m_p_open, m_window_flags)) ImGui::End(); + if (ImGui::Button("RUN", ImVec2(28, 30))) + { + VE::event e { test_event::TEST_EVEN , std::string("test event message") }; + execute(e); + } - if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30))) - { - VE::event e { test_event::TEST_EVEN , std::string("test icon button") }; - execute(e); - } + VE_PUSH_FONT(ICON, 18); - ImGui::Text(VE::style::icon::ICON_PAINT_BRUSH, " Paint" ); - ImGui::Text("\xef\x87\xbc"); + if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30))) + { + VE::event e { test_event::TEST_EVEN , std::string("test icon button") }; + execute(e); + } - VE_POP_FONT(); - end(); + ImGui::Text(VE::style::icon::ICON_PAINT_BRUSH, " Paint" ); + ImGui::Text("\xef\x87\xbc"); + + VE_POP_FONT(); + + ImGui::End(); } void test_panel_2::on_event(VE::event e) diff --git a/bin/layers/test_panel_2/test_panel_2.hpp b/bin/layers/test_panel_2/test_panel_2.hpp index 138df05..aa8e5ec 100755 --- a/bin/layers/test_panel_2/test_panel_2.hpp +++ b/bin/layers/test_panel_2/test_panel_2.hpp @@ -1,12 +1,15 @@ #pragma once -#include "VE.hpp" // IWYU pragma: keep +#include namespace sandbox { class test_panel_2 : public VE::layer { VE_FN_OVERIDE(); + + ImVec2 m_size = ImVec2{ 400.f, 400.f }; + ImVec2 m_pos = ImVec2{ 400.f, 400.f }; }; } diff --git a/src/layer/layer.hpp b/src/layer/layer.hpp index d54d21e..6b166e1 100755 --- a/src/layer/layer.hpp +++ b/src/layer/layer.hpp @@ -1,7 +1,5 @@ #pragma once -#include "hack/security/uuid.hpp" - #include "event/event.hpp" #include "gui/flags.hpp" @@ -26,26 +24,8 @@ namespace VE void set_event_fn(const event_fn& fn) { execute = fn; }; - void begin() - { - ImGui::SetNextWindowPos(mt::convert(m_passport.m_pos)); - ImGui::SetNextWindowSize(mt::convert(m_passport.m_size)); - - if (m_passport.m_name.empty()) - m_passport.m_name = hack::security::generate_uuid(); - if (!ImGui::Begin(m_passport.m_name.c_str(), &m_p_open, m_window_flags)) end(); - } - - void end() { ImGui::End(); } - protected: event_fn execute; - struct passport - { - std::string m_name; - mt::vec2 m_pos; - mt::vec2 m_size; - } m_passport; }; }