From dab6f64dc5fffa7d30a069fe7eec733b9293b440 Mon Sep 17 00:00:00 2001 From: iWas-Coder Date: Thu, 12 Sep 2024 18:00:44 +0200 Subject: [PATCH] Created destructor for Scene objects --- src/Runtime/Scene.cc | 5 +++++ src/Runtime/Scene.hh | 1 + 2 files changed, 6 insertions(+) diff --git a/src/Runtime/Scene.cc b/src/Runtime/Scene.cc index a913616..b03f13d 100644 --- a/src/Runtime/Scene.cc +++ b/src/Runtime/Scene.cc @@ -11,6 +11,11 @@ namespace volt::runtime { : m_name{name}, m_running{false} {} + Scene::~Scene(void) { + m_registry.clear(); + VOLT_LOG_INFO("Scene: destroyed successfully"); + } + Entity Scene::CreateEntity(const std::string &name) { return CreateEntity(core::SnowflakeID(), name); } diff --git a/src/Runtime/Scene.hh b/src/Runtime/Scene.hh index e5c04a6..2a30fc5 100644 --- a/src/Runtime/Scene.hh +++ b/src/Runtime/Scene.hh @@ -41,6 +41,7 @@ namespace volt::runtime { Scene(Scene &&) = delete; Scene &operator=(const Scene &) = delete; Scene &operator=(Scene &&) = delete; + ~Scene(void); Entity CreateEntity(const std::string &name = std::string()); Entity CreateEntity(core::SnowflakeID id, const std::string &name = std::string()); void DestroyEntity(Entity e);