feat? add basich ah scene loading

This commit is contained in:
2026-07-25 21:46:01 +02:00
parent aa5c497f29
commit 4b6f773c0c
18 changed files with 523 additions and 73 deletions
+15 -9
View File
@@ -32,7 +32,7 @@ GameObject* Scene::CreateGameObject(std::string name)
GameObject* rawPtr = obj.get();
// obj->SetScene(this);
obj->SetScene(this);
m_pendingAdditions.emplace_back(std::move(obj));
return rawPtr;
@@ -61,15 +61,9 @@ void Scene::Load() {
}
void Scene::Update() {
if (!m_pendingAdditions.empty()) {
for (auto& obj : m_pendingAdditions) {
m_objects.emplace_back(std::move(obj));
}
m_pendingAdditions.clear();
}
CommitPendingAdditions();
for (const auto& object: m_objects) {
for (const auto& object : m_objects) {
if (object->IsActiveInHierarchy()) {
object->Update();
}
@@ -155,3 +149,15 @@ void Scene::DestroyGameObjects() {
assert(m_BeingUnloaded && "Scene is being cleared but not unloaded? Weird");
}
}
void Scene::CommitPendingAdditions() {
if (m_pendingAdditions.empty()) {
return;
}
for (auto& obj : m_pendingAdditions) {
m_objects.emplace_back(std::move(obj));
}
m_pendingAdditions.clear();
}