添加简单场景ctrl+s保存功能

This commit is contained in:
2025-06-20 21:07:40 +08:00
parent ea59c82f35
commit aecaf86dc0
3 changed files with 96 additions and 74 deletions

View File

@ -27,27 +27,30 @@ namespace Hazel
void SceneHierachyPanel::OnImGuiRender()
{
ImGui::Begin("Scene Hierachy");
m_Context->m_Registry.view<entt::entity>().each([&](auto entityID)
if (m_Context)
{
DrawEntityNode({entityID, m_Context.get()});
});
ImGui::Begin("Scene Hierachy");
if (ImGui::IsMouseDown(0) && ImGui::IsWindowHovered())
{
m_SelectionContext = { };
m_Context->m_Registry.view<entt::entity>().each([&](auto entityID)
{
DrawEntityNode({entityID, m_Context.get()});
});
if (ImGui::IsMouseDown(0) && ImGui::IsWindowHovered())
{
m_SelectionContext = {};
}
if (ImGui::BeginPopupContextWindow(0, ImGuiPopupFlags_MouseButtonRight | ImGuiPopupFlags_NoOpenOverItems))
{
if (ImGui::MenuItem("Create Empty Entity"))
m_Context->CreateEntity("Empty Entity");
ImGui::EndPopup();
}
ImGui::End();
}
if (ImGui::BeginPopupContextWindow(0, ImGuiPopupFlags_MouseButtonRight | ImGuiPopupFlags_NoOpenOverItems))
{
if (ImGui::MenuItem("Create Empty Entity"))
m_Context->CreateEntity("Empty Entity");
ImGui::EndPopup();
}
ImGui::End();
ImGui::Begin("Properties");
if (m_SelectionContext)
{