CSEngine
Loading...
Searching...
No Matches
SScene.cpp
1//
2// Created by ounols on 19. 2. 14.
3//
4
5#include "SScene.h"
6
7using namespace CSE;
8
9SScene::SScene() {
10 m_root = new SGameObject("__ROOT_OF_SCENE__");
11}
12
13SScene::~SScene() = default;
14
15void SScene::Init() {
16 InitGameObject(m_root);
17}
18
19void SScene::Tick(float elapsedTime) {
20 TickGameObject(m_root, elapsedTime);
21}
22
23void SScene::Destroy() {
24
25}
26
27void SScene::InitGameObject(SGameObject* obj) {
28 obj->Init();
29 const auto& children = obj->GetChildren();
30 for (const auto& child : children) {
31 InitGameObject(child);
32 }
33}
34
35void SScene::TickGameObject(SGameObject* obj, float elapsedTime) {
36 obj->Tick(elapsedTime);
37 const auto& children = obj->GetChildren();
38 for (const auto& child : children) {
39 TickGameObject(child, elapsedTime);
40 }
41}