diff --git a/src/sandbox/layers/test_panel/test_panel.cpp b/src/sandbox/layers/test_panel/test_panel.cpp index 3285d6e..0b637f8 100755 --- a/src/sandbox/layers/test_panel/test_panel.cpp +++ b/src/sandbox/layers/test_panel/test_panel.cpp @@ -8,6 +8,7 @@ namespace tr::layers m_win.m_pos = { 212.f, 35.f }; m_win.m_size = { 720.f, 480.f }; + m_win.m_name = "test_win"; } void test_panel::on_detach() @@ -20,23 +21,24 @@ namespace tr::layers ImGui::SetNextWindowPos(m_win.m_pos); ImGui::SetNextWindowSize(m_win.m_size); - BEGIN_IMGUI_WIN("test_win"); + BEGIN_IMGUI_WIN(); + { + if (ImGui::Button("RUN", ImVec2(28, 30))) { + m_event_manager->execute(std::string("test signal key"), "value params run"); + } - 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))) { + m_event_manager->execute(std::string("test signal key"), "value params stop"); + } + + ImGui::Text(try_engine::style::icon::ICON_PAINT_BRUSH, " Paint" ); + ImGui::Text("\xef\x87\xbc"); + + TR_POP_FONT(); } - TR_PUSH_FONT(ICON, 18); - - if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30))) { - m_event_manager->execute(std::string("test signal key"), "value params stop"); - } - - ImGui::Text(try_engine::style::icon::ICON_PAINT_BRUSH, " Paint" ); - ImGui::Text("\xef\x87\xbc"); - - TR_POP_FONT(); - END_IMGUI_WIN(); } diff --git a/src/try_engine/utils/define.hpp b/src/try_engine/utils/define.hpp index 7da4e28..f486516 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 }; } m_win + struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; } m_win #define BASE_WINDOW_FLAGS()\ if (m_flags.m_no_titlebar) m_window_flags |= ImGuiWindowFlags_NoTitleBar;\ @@ -76,7 +76,7 @@ event_manager* m_event_manager -#define BEGIN_IMGUI_WIN(name) if (!ImGui::Begin(name, &m_flags.m_p_open, m_window_flags)) ImGui::End() +#define BEGIN_IMGUI_WIN() if (!ImGui::Begin(m_win.m_name.c_str(), &m_flags.m_p_open, m_window_flags)) ImGui::End() #define END_IMGUI_WIN() ImGui::End() #define TR_PUSH_FONT(def_font, def_size)\