Files
IAEngine/Src/IAEngine/imp/cpp/Scene.cpp
Isuru Samarathunga 829ca638cb Fixes
2025-09-15 20:28:22 +05:30

54 lines
1.4 KiB
C++

// IAEngine: 2D Game Engine by IA
// Copyright (C) 2025 IAS (ias@iasoft.dev)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <IAEngine/Scene.hpp>
namespace ia::iae
{
Scene::~Scene()
{
for (auto &n : m_nodes)
n.reset();
}
VOID Scene::Draw()
{
for (auto &n : m_nodes)
n->Draw();
}
VOID Scene::Update()
{
for (auto &n : m_nodes)
n->Update();
}
VOID Scene::AddNode(IN RefPtr<Node> node)
{
m_nodes.pushBack(node);
node->OnAdded(this);
}
VOID Scene::RemoveNode(IN RefPtr<Node> node)
{
const auto it = m_nodes.find(node);
if (it != m_nodes.end())
{
m_nodes.erase(it);
node->OnRemoved();
}
}
} // namespace ia::iae