-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneManager.cpp
More file actions
59 lines (51 loc) · 1.04 KB
/
SceneManager.cpp
File metadata and controls
59 lines (51 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "stdafx.h"
#include "SceneManager.h"
#include "Scene.h"
#include "StartScene.h"
#include "SecondScene.h"
SceneManager::SceneManager()
{
}
SceneManager::~SceneManager()
{
}
HRESULT SceneManager::Init()
{
startScene = new StartScene();
secondScene = new SecondScene();
AddScene("start", startScene);
_curScene = startScene;
_curScene->Init();
return S_OK;
}
void SceneManager::Update()
{
_curScene->Update();
}
void SceneManager::Render()
{
_curScene->Render();
}
void SceneManager::Release()
{
}
void SceneManager::AddScene(string sceneName, Scene* scene)
{
sceneMap.insert(pair<string, Scene*>(sceneName, scene));
}
void SceneManager::LoadScene(string sceneName)
{
_curScene->Release();
sceneIter = sceneMap.find(sceneName);
if (sceneIter != sceneMap.end()) {
_curScene = sceneIter->second;
}
}
Scene* SceneManager::GetScene(string sceneName)
{
sceneIter = sceneMap.find(sceneName);
if (sceneIter != sceneMap.end()) {
return sceneIter->second;
}
return nullptr;
}