-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSceneRegistry.cpp
More file actions
38 lines (32 loc) · 838 Bytes
/
SceneRegistry.cpp
File metadata and controls
38 lines (32 loc) · 838 Bytes
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
//
// Created by Yury Rakhuba on 24/04/15.
//
#include "SceneRegistry.hpp"
SceneRegistry::SceneRegistry(std::string && title, SceneRegistry::TSceneCreator && creator)
: m_title(std::move(title))
, m_creatorFn(std::move(creator))
{
RegisterScene(this);
}
void SceneRegistry::EnumerateScenes(SceneRegistry::TSceneEnumeratorCallback const & callback)
{
SceneRegistry * head = m_firstScene;
while (head != nullptr)
{
callback(head->m_title, head->m_creatorFn);
head = head->m_nextScene;
}
}
void SceneRegistry::RegisterScene(SceneRegistry * scene)
{
if (m_firstScene == nullptr)
m_firstScene = scene;
else
{
SceneRegistry * head = m_firstScene;
while (head->m_nextScene != nullptr)
head = head->m_nextScene;
head->m_nextScene = scene;
}
}
SceneRegistry * SceneRegistry::m_firstScene;