CSEngine
Loading...
Searching...
No Matches
SceneMgr.cpp
1#include "SceneMgr.h"
2#include "MemoryMgr.h"
3#include "EngineCore.h"
4
5using namespace CSE;
6
7SceneMgr::SceneMgr() = default;
8
9
10SceneMgr::~SceneMgr() = default;
11
12
13void SceneMgr::Init() {
14 if (m_scene == nullptr) return;
15
16 m_scene->Init();
17}
18
19
20void SceneMgr::Update(float elapsedTime) {
21
22 if (m_scene == nullptr)
23 return;
24
25 m_scene->Tick(elapsedTime);
26
27}
28
29
30void SceneMgr::SetScene(Scene* scene) {
31
32 if (m_scene != nullptr) {
33 m_scene->SetUndestroyable(false);
34 //MemoryMgr::getInstance()->ReleaseObject(m_scene);
35 CORE->GetCore(MemoryMgr)->ExterminateObjects();
36 }
37
38 m_scene = scene;
39
40 if (m_scene != nullptr)
41 m_scene->Init();
42}
43
44Scene* SceneMgr::GetCurrentScene() const {
45 return m_scene;
46}