添加场景加载与保存功能
This commit is contained in:
@ -18,16 +18,17 @@ namespace Hazel
|
||||
void SceneHierachyPanel::SetContext(const Ref<Scene>& context)
|
||||
{
|
||||
m_Context = context;
|
||||
m_SelectionContext = {};
|
||||
}
|
||||
|
||||
void SceneHierachyPanel::OnImGuiRender()
|
||||
{
|
||||
ImGui::Begin("Scene Hierachy");
|
||||
|
||||
for (const auto entityID : m_Context->m_Registry.view<entt::entity>())
|
||||
m_Context->m_Registry.view<entt::entity>().each([&](auto entityID)
|
||||
{
|
||||
DrawEntityNode({entityID, m_Context.get()});
|
||||
}
|
||||
});
|
||||
|
||||
if (ImGui::IsMouseDown(0) && ImGui::IsWindowHovered())
|
||||
{
|
||||
@ -185,6 +186,7 @@ namespace Hazel
|
||||
|
||||
if (entity.HasComponent<T>())
|
||||
{
|
||||
ImGui::PushID(&entity);
|
||||
auto& component = entity.GetComponent<T>();
|
||||
|
||||
ImVec2 contextReginAvail = ImGui::GetContentRegionAvail();
|
||||
@ -219,7 +221,8 @@ namespace Hazel
|
||||
}
|
||||
|
||||
if (removeComponent)
|
||||
entity.RemoveComponent<SpriteRendererComponent>();
|
||||
entity.RemoveComponent<T>();
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user