添加组件圆,添加可视化碰撞器渲染
This commit is contained in:
@ -265,13 +265,22 @@ namespace Hazel
|
||||
|
||||
if (!m_SelectionContext.HasComponent<SpriteRendererComponent>())
|
||||
{
|
||||
if (ImGui::MenuItem("Sprite"))
|
||||
if (ImGui::MenuItem("Sprite Renderer"))
|
||||
{
|
||||
m_SelectionContext.AddComponent<SpriteRendererComponent>();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_SelectionContext.HasComponent<CircleRendererComponent>())
|
||||
{
|
||||
if (ImGui::MenuItem("Circle Renderer"))
|
||||
{
|
||||
m_SelectionContext.AddComponent<CircleRendererComponent>();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_SelectionContext.HasComponent<RigidBody2DComponent>())
|
||||
{
|
||||
if (ImGui::MenuItem("RigidBody 2D"))
|
||||
@ -290,6 +299,15 @@ namespace Hazel
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_SelectionContext.HasComponent<CircleCollider2DComponent>())
|
||||
{
|
||||
if (ImGui::MenuItem("Circle Collider 2D"))
|
||||
{
|
||||
m_SelectionContext.AddComponent<CircleCollider2DComponent>();
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::PopItemWidth();
|
||||
@ -385,6 +403,13 @@ namespace Hazel
|
||||
ImGui::DragFloat("Tiling Color", &component.TilingFactor, 0.1f, 0.0f, 100.f);
|
||||
});
|
||||
|
||||
DrawComponent<CircleRendererComponent>("Circle Renderer", entity, [](auto& component)
|
||||
{
|
||||
ImGui::ColorEdit4("Color", glm::value_ptr(component.Color));
|
||||
// ImGui::DragFloat("Radius", &component.Radius, 0.01f, 0.0f, 1.f);
|
||||
ImGui::DragFloat("Thickness", &component.Thickness, 0.01f, 0.0f, 1.f);
|
||||
ImGui::DragFloat("Fade", &component.Fade, 0.00001f, 0.0f, 1.f);
|
||||
});
|
||||
|
||||
DrawComponent<RigidBody2DComponent>("Rigidbody 2D", entity, [](auto& component)
|
||||
{
|
||||
@ -415,8 +440,19 @@ namespace Hazel
|
||||
|
||||
DrawComponent<BoxCollider2DComponent>("Box Collider 2D", entity, [](auto& component)
|
||||
{
|
||||
ImGui::DragFloat2("Offset", glm::value_ptr(component.Offset));
|
||||
ImGui::DragFloat2("Size", glm::value_ptr(component.Size));
|
||||
ImGui::DragFloat2("Offset", glm::value_ptr(component.Offset), 0.001f);
|
||||
ImGui::DragFloat2("Size", glm::value_ptr(component.Size), 0.001f);
|
||||
|
||||
ImGui::DragFloat("Density", &component.Density, 0.01f, 0.0f);
|
||||
ImGui::DragFloat("Friction", &component.Friction, 0.01f, 0.0f, 1.0f);
|
||||
ImGui::DragFloat("Restitution", &component.Restitution, 0.01f, 0.0f, 1.0f);
|
||||
ImGui::DragFloat("Restitution Threshold", &component.RestitutionThreshold, 0.01f, 0.0f);
|
||||
});
|
||||
|
||||
DrawComponent<CircleCollider2DComponent>("Circle Collider 2D", entity, [](auto& component)
|
||||
{
|
||||
ImGui::DragFloat2("Offset", glm::value_ptr(component.Offset), 0.001f);
|
||||
ImGui::DragFloat("Radius", &component.Radius, 0.001f);
|
||||
|
||||
ImGui::DragFloat("Density", &component.Density, 0.01f, 0.0f);
|
||||
ImGui::DragFloat("Friction", &component.Friction, 0.01f, 0.0f, 1.0f);
|
||||
|
||||
Reference in New Issue
Block a user