2
3
4
5
31 assert(m_Tags.size() > 0);
33 if (m_Tags.size() == 1)
36 ss <<
"Remove tag failed: Entity " << *m_Tags.begin() <<
" must have at lease one tag.";
38 SPICES_CORE_WARN(ss.str())
43 if (m_Tags.find(tag) == m_Tags.end())
46 ss <<
"Remove tag failed: Entity " << *m_Tags.begin() <<
" do not have tag of " << tag;
48 SPICES_CORE_WARN(ss.str())
60 assert(m_Tags.size() > 0);
62 m_Tags.erase(*m_Tags.begin());
70 std::vector<std::string> tagBuffer(m_Tags.begin(), m_Tags.end());
73 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2{ 0, 3.0f });
74 float columeWidth = ImGuiH::GetLineItemSize().x * 6.5f;
79 for(
int i = 0; i < tagBuffer.size(); i++)
82 ss <<
"Tag[" << i <<
"]";
83 ImGuiH::DrawPropertyItem(ss.str(), columeWidth,
nullptr, [&]() {
84 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
85 char buffer[256] = {};
86 strcpy_s(buffer,
sizeof(buffer), tagBuffer[i].c_str());
87 if (ImGui::InputText(
"##", buffer,
sizeof(buffer)))
89 m_Tags.erase(tagBuffer[i]);
90 m_Tags.insert(std::string(buffer));
92 ImGui::PopItemWidth();
94 ImGuiH::DrawResetIcon(
false);
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
void RemoveTag(const std::string &tag)
Remove a tag from this component handled.
virtual void DrawThis() override
This interface defines how to draw this component to property panel.
void Rename(const std::string &tag)
Rename first element in tags.
TagComponent(const std::string &tag)
Constructor Function.
virtual void OnDeSerialize() override
This interface defines how to deserialize.
virtual void OnSerialize() override
This interface defines how to serialize.
TagComponent Class. This class defines the specific behaves of TagComponent.