SceneManager函数重命名

This commit is contained in:
Nomango 2018-07-17 22:27:00 +08:00
parent 284db32f6d
commit 2dfa2b3f07
2 changed files with 11 additions and 8 deletions

View File

@ -34,7 +34,7 @@ e2d::SceneManager::~SceneManager()
{ {
} }
void e2d::SceneManager::enter(Scene * scene, Transition * transition /* = nullptr */, bool saveCurrentScene /* = true */) void e2d::SceneManager::push(Scene * scene, Transition * transition /* = nullptr */, bool saveCurrentScene /* = true */)
{ {
if (!scene) if (!scene)
return; return;
@ -63,11 +63,14 @@ void e2d::SceneManager::enter(Scene * scene, Transition * transition /* = nullpt
} }
} }
void e2d::SceneManager::back(Transition * transition /* = nullptr */) void e2d::SceneManager::pop(Transition * transition /* = nullptr */)
{ {
// 栈为空时,调用返回场景函数失败 // 栈为空时,调用返回场景函数失败
WARN_IF(_scenes.size() == 0, "Scene stack is empty!"); if (_scenes.size() == 0)
if (_scenes.size() == 0) return; {
WARN("Scene stack is empty!");
return;
}
// 从栈顶取出场景指针,作为下一场景 // 从栈顶取出场景指针,作为下一场景
_nextScene = _scenes.top(); _nextScene = _scenes.top();

View File

@ -22,15 +22,15 @@ public:
// 销毁实例 // 销毁实例
static void destroyInstance(); static void destroyInstance();
// 切换场景 // 场景入栈
void enter( void push(
Scene * scene, /* 下一个场景的指针 */ Scene * scene, /* 下一个场景的指针 */
Transition * transition = nullptr, /* 场景切换动作 */ Transition * transition = nullptr, /* 场景切换动作 */
bool saveCurrentScene = true /* 是否保存当前场景 */ bool saveCurrentScene = true /* 是否保存当前场景 */
); );
// 返回上一场景 // 场景出栈
void back( void pop(
Transition * transition = nullptr /* 场景切换动作 */ Transition * transition = nullptr /* 场景切换动作 */
); );