From 0423b49bb99201b5ce4dbd4d5925c49009d332aa Mon Sep 17 00:00:00 2001 From: Nomango <569629550@qq.com> Date: Sat, 7 Jul 2018 19:05:39 +0800 Subject: [PATCH] =?UTF-8?q?Scene=E6=96=B9=E6=B3=95=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/Common/Scene.cpp | 10 +++++----- core/Manager/SceneManager.cpp | 4 ++-- core/Transition/Transition.cpp | 8 ++++---- core/e2dcommon.h | 26 ++++++++++---------------- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/core/Common/Scene.cpp b/core/Common/Scene.cpp index 7fd4ff07..1229c6fe 100644 --- a/core/Common/Scene.cpp +++ b/core/Common/Scene.cpp @@ -16,7 +16,7 @@ e2d::Scene::~Scene() GC::safeRelease(_root); } -void e2d::Scene::_render() +void e2d::Scene::render() { _root->_render(); @@ -33,7 +33,7 @@ void e2d::Scene::_render() } } -void e2d::Scene::_update() +void e2d::Scene::update() { // 执行 onUpdate 函数 if (_autoUpdate) @@ -67,17 +67,17 @@ bool e2d::Scene::remove(Node * child) return _root->removeChild(child); } -std::vector e2d::Scene::get(const String& name) const +std::vector e2d::Scene::getChildren(const String& name) const { 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); } -const std::vector& e2d::Scene::getAll() const +const std::vector& e2d::Scene::getAllChildren() const { return _root->getAllChildren(); } diff --git a/core/Manager/SceneManager.cpp b/core/Manager/SceneManager.cpp index 7f7d2e05..707fc274 100644 --- a/core/Manager/SceneManager.cpp +++ b/core/Manager/SceneManager.cpp @@ -122,7 +122,7 @@ void e2d::SceneManager::update() // 更新场景内容 if (_currScene) { - _currScene->_update(); + _currScene->update(); } } else @@ -179,7 +179,7 @@ void e2d::SceneManager::render() // 绘制当前场景 if (_currScene) { - _currScene->_render(); + _currScene->render(); } } } diff --git a/core/Transition/Transition.cpp b/core/Transition/Transition.cpp index 5072b3dc..39dc1baf 100644 --- a/core/Transition/Transition.cpp +++ b/core/Transition/Transition.cpp @@ -72,11 +72,11 @@ void e2d::Transition::_update() // 更新场景内容 if (_outScene) { - _outScene->_update(); + _outScene->update(); } if (_inScene) { - _inScene->_update(); + _inScene->update(); } } @@ -97,7 +97,7 @@ void e2d::Transition::_render() pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); pRT->PushLayer(_outLayerParam, _outLayer); - _outScene->_render(); + _outScene->render(); pRT->PopLayer(); pRT->PopAxisAlignedClip(); @@ -116,7 +116,7 @@ void e2d::Transition::_render() pRT->PushAxisAlignedClip(clipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); pRT->PushLayer(_inLayerParam, _inLayer); - _inScene->_render(); + _inScene->render(); pRT->PopLayer(); pRT->PopAxisAlignedClip(); diff --git a/core/e2dcommon.h b/core/e2dcommon.h index d6aa2603..971b89c8 100644 --- a/core/e2dcommon.h +++ b/core/e2dcommon.h @@ -649,16 +649,10 @@ protected: }; -class SceneManager; -class Transition; - // 场景 class Scene : public Ref { - friend class SceneManager; - friend class Transition; - public: Scene(); @@ -698,30 +692,30 @@ public: Node * child ); - // 获取所有名称相同的子节点 - std::vector get( + // 获取名称相同的子节点 + Node* getChild( const String& name ) const; - // 获取名称相同的子节点 - Node* getOne( + // 获取所有名称相同的子节点 + std::vector getChildren( const String& name ) const; // 获取所有子节点 - const std::vector& getAll() const; + const std::vector& getAllChildren() const; // 获取根节点 Node * getRoot() const; -protected: - E2D_DISABLE_COPY(Scene); - // 渲染场景画面 - void _render(); + void render(); // 更新场景内容 - void _update(); + void update(); + +protected: + E2D_DISABLE_COPY(Scene); protected: bool _autoUpdate;