remove passport
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "VE.hpp" // IWYU pragma: keep
|
||||
#include <VE.hpp>
|
||||
|
||||
namespace sandbox
|
||||
{
|
||||
|
||||
class cube : public VE::opengl
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "VE.hpp" // IWYU pragma: keep
|
||||
#include <VE.hpp>
|
||||
|
||||
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 };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "VE.hpp" // IWYU pragma: keep
|
||||
#include <VE.hpp>
|
||||
|
||||
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 };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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<event&>& fn) { execute = fn; };
|
||||
|
||||
void begin()
|
||||
{
|
||||
ImGui::SetNextWindowPos(mt::convert<ImVec2>(m_passport.m_pos));
|
||||
ImGui::SetNextWindowSize(mt::convert<ImVec2>(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<event&> execute;
|
||||
struct passport
|
||||
{
|
||||
std::string m_name;
|
||||
mt::vec2 m_pos;
|
||||
mt::vec2 m_size;
|
||||
} m_passport;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user