Scene方法重命名

This commit is contained in:
Nomango 2018-07-07 19:05:39 +08:00
parent 7e3b224b69
commit 0423b49bb9
4 changed files with 21 additions and 27 deletions

View File

@ -16,7 +16,7 @@ e2d::Scene::~Scene()
GC::safeRelease(_root); GC::safeRelease(_root);
} }
void e2d::Scene::_render() void e2d::Scene::render()
{ {
_root->_render(); _root->_render();
@ -33,7 +33,7 @@ void e2d::Scene::_render()
} }
} }
void e2d::Scene::_update() void e2d::Scene::update()
{ {
// 执行 onUpdate 函数 // 执行 onUpdate 函数
if (_autoUpdate) if (_autoUpdate)
@ -67,17 +67,17 @@ bool e2d::Scene::remove(Node * child)
return _root->removeChild(child); return _root->removeChild(child);
} }
std::vector<e2d::Node*> e2d::Scene::get(const String& name) const std::vector<e2d::Node*> e2d::Scene::getChildren(const String& name) const
{ {
return _root->getChildren(name); return _root->getChildren(name);
} }
e2d::Node * e2d::Scene::getOne(const String& name) const e2d::Node * e2d::Scene::getChild(const String& name) const
{ {
return _root->getChild(name); return _root->getChild(name);
} }
const std::vector<e2d::Node*>& e2d::Scene::getAll() const const std::vector<e2d::Node*>& e2d::Scene::getAllChildren() const
{ {
return _root->getAllChildren(); return _root->getAllChildren();
} }

View File

@ -122,7 +122,7 @@ void e2d::SceneManager::update()
// 更新场景内容 // 更新场景内容
if (_currScene) if (_currScene)
{ {
_currScene->_update(); _currScene->update();
} }
} }
else else
@ -179,7 +179,7 @@ void e2d::SceneManager::render()
// 绘制当前场景 // 绘制当前场景
if (_currScene) if (_currScene)
{ {
_currScene->_render(); _currScene->render();
} }
} }
} }

View File

@ -72,11 +72,11 @@ void e2d::Transition::_update()
// 更新场景内容 // 更新场景内容
if (_outScene) if (_outScene)
{ {
_outScene->_update(); _outScene->update();
} }
if (_inScene) if (_inScene)
{ {
_inScene->_update(); _inScene->update();
} }
} }
@ -97,7 +97,7 @@ void e2d::Transition::_render()
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
pRT->PushLayer(_outLayerParam, _outLayer); pRT->PushLayer(_outLayerParam, _outLayer);
_outScene->_render(); _outScene->render();
pRT->PopLayer(); pRT->PopLayer();
pRT->PopAxisAlignedClip(); pRT->PopAxisAlignedClip();
@ -116,7 +116,7 @@ void e2d::Transition::_render()
pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE);
pRT->PushLayer(_inLayerParam, _inLayer); pRT->PushLayer(_inLayerParam, _inLayer);
_inScene->_render(); _inScene->render();
pRT->PopLayer(); pRT->PopLayer();
pRT->PopAxisAlignedClip(); pRT->PopAxisAlignedClip();

View File

@ -649,16 +649,10 @@ protected:
}; };
class SceneManager;
class Transition;
// 场景 // 场景
class Scene : class Scene :
public Ref public Ref
{ {
friend class SceneManager;
friend class Transition;
public: public:
Scene(); Scene();
@ -698,30 +692,30 @@ public:
Node * child Node * child
); );
// 获取所有名称相同的子节点 // 获取名称相同的子节点
std::vector<Node*> get( Node* getChild(
const String& name const String& name
) const; ) const;
// 获取名称相同的子节点 // 获取所有名称相同的子节点
Node* getOne( std::vector<Node*> getChildren(
const String& name const String& name
) const; ) const;
// 获取所有子节点 // 获取所有子节点
const std::vector<Node*>& getAll() const; const std::vector<Node*>& getAllChildren() const;
// 获取根节点 // 获取根节点
Node * getRoot() const; Node * getRoot() const;
protected:
E2D_DISABLE_COPY(Scene);
// 渲染场景画面 // 渲染场景画面
void _render(); void render();
// 更新场景内容 // 更新场景内容
void _update(); void update();
protected:
E2D_DISABLE_COPY(Scene);
protected: protected:
bool _autoUpdate; bool _autoUpdate;