Added Collision Tag Matrix #296
|
@ -13,18 +13,18 @@ namespace SHADE
|
|||
{
|
||||
ImGui::BeginTable("CollisionMtxTable", SHCollisionTag::NUM_LAYERS + 1, ImGuiTableRowFlags_Headers);
|
||||
ImGui::TableNextRow();
|
||||
for (int i = 0; i <= SHCollisionTag::NUM_LAYERS; ++i)
|
||||
for (int i = SHCollisionTag::NUM_LAYERS; i >= 0; --i)
|
||||
{
|
||||
ImGui::TableNextColumn();
|
||||
if(i == 0) continue;
|
||||
std::string const& tagName = SHCollisionTagMatrix::GetTagName(i- 1);
|
||||
auto tag = SHCollisionTagMatrix::GetTag(i - 1);
|
||||
if(i == SHCollisionTag::NUM_LAYERS) continue;
|
||||
std::string const& tagName = SHCollisionTagMatrix::GetTagName(i);
|
||||
auto tag = SHCollisionTagMatrix::GetTag(i);
|
||||
if (!tag)
|
||||
continue;
|
||||
//ImGui::Text(tagName.data());
|
||||
SHEditorWidgets::InputText("##" + std::to_string(i), [i]{return SHCollisionTagMatrix::GetTagName(i- 1);}, [i](std::string const& value){SHCollisionTagMatrix::GetTag(i)->SetName(value);}, tagName.data(), ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
SHEditorWidgets::InputText("##" + std::to_string(i), [i]{return SHCollisionTagMatrix::GetTagName(i);}, [i](std::string const& value){SHCollisionTagMatrix::GetTag(i)->SetName(value);}, tagName.data(), ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
}
|
||||
for (int i = SHCollisionTag::NUM_LAYERS - 1; i >= 0; --i)
|
||||
for (int i = 0; i < SHCollisionTag::NUM_LAYERS; ++i)
|
||||
{
|
||||
std::string tagName = SHCollisionTagMatrix::GetTagName(i);
|
||||
auto tag = SHCollisionTagMatrix::GetTag(i);
|
||||
|
@ -33,10 +33,11 @@ namespace SHADE
|
|||
ImGui::TableNextRow();
|
||||
ImGui::TableNextColumn();
|
||||
ImGui::Text(tagName.data());
|
||||
for (int j = 0; j < SHCollisionTag::NUM_LAYERS - i; ++j)
|
||||
for (int j = (SHCollisionTag::NUM_LAYERS) - 1; j >= i; --j)
|
||||
{
|
||||
std::string tagName2 = SHCollisionTagMatrix::GetTagName(j);
|
||||
auto tag2 = SHCollisionTagMatrix::GetTag(j);
|
||||
int idx = j;
|
||||
std::string tagName2 = SHCollisionTagMatrix::GetTagName(idx);
|
||||
auto tag2 = SHCollisionTagMatrix::GetTag(idx);
|
||||
|
||||
if(!tag2)
|
||||
continue;
|
||||
|
@ -44,14 +45,13 @@ namespace SHADE
|
|||
if(tagName.empty())
|
||||
tagName = std::to_string(i);
|
||||
if(tagName2.empty())
|
||||
tagName2 = std::to_string(j);
|
||||
tagName2 = std::to_string(idx);
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
//if(i == j)
|
||||
//if(i == idx)
|
||||
// continue;
|
||||
std::string_view label = std::format("##{} vs {}", tagName, tagName2).data();
|
||||
SHEditorWidgets::CheckBox(label, [tag, &j]{return tag->GetLayerState(j);}, [tag, i, j](bool const& value){tag->SetLayerState(j, value); SHCollisionTagMatrix::GetTag(j)->SetLayerState(i, value);}, label.substr(2));
|
||||
|
||||
SHEditorWidgets::CheckBox(label, [tag, &idx]{return tag->GetLayerState(idx);}, [tag, i, idx](bool const& value){tag->SetLayerState(idx, value); SHCollisionTagMatrix::GetTag(idx)->SetLayerState(i, value);}, label.substr(2));
|
||||
}
|
||||
}
|
||||
ImGui::EndTable();
|
||||
|
|
Loading…
Reference in New Issue