| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | #include "..\enodes.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | #include "..\emanagers.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | #include "..\etools.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | #include "..\eactions.h"
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | #include "..\eshape.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | #include <algorithm>
 | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | // Ĭ<><C4AC><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>λ<EFBFBD><CEBB>
 | 
					
						
							|  |  |  |  | static float s_fDefaultPiovtX = 0; | 
					
						
							|  |  |  |  | static float s_fDefaultPiovtY = 0; | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | static bool s_fDefaultShapeEnabled = true; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Node::Node() | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	: m_nOrder(0) | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	, m_fPosX(0) | 
					
						
							|  |  |  |  | 	, m_fPosY(0) | 
					
						
							|  |  |  |  | 	, m_fWidth(0) | 
					
						
							|  |  |  |  | 	, m_fHeight(0) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	, m_fScaleX(1.0f) | 
					
						
							|  |  |  |  | 	, m_fScaleY(1.0f) | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	, m_fRotation(0) | 
					
						
							|  |  |  |  | 	, m_fSkewAngleX(0) | 
					
						
							|  |  |  |  | 	, m_fSkewAngleY(0) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	, m_fDisplayOpacity(1.0f) | 
					
						
							|  |  |  |  | 	, m_fRealOpacity(1.0f) | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	, m_fPivotX(s_fDefaultPiovtX) | 
					
						
							|  |  |  |  | 	, m_fPivotY(s_fDefaultPiovtY) | 
					
						
							|  |  |  |  | 	, m_MatriInitial(D2D1::Matrix3x2F::Identity()) | 
					
						
							|  |  |  |  | 	, m_MatriFinal(D2D1::Matrix3x2F::Identity()) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | 	, m_bVisiable(true) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	, m_bDisplayedInScene(false) | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	, m_pShape(nullptr) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	, m_pParent(nullptr) | 
					
						
							|  |  |  |  | 	, m_pParentScene(nullptr) | 
					
						
							|  |  |  |  | 	, m_nHashName(0) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	, m_bSortChildrenNeeded(false) | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	, m_bTransformNeeded(false) | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	, m_bAutoUpdate(true) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | 	if (s_fDefaultShapeEnabled) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		auto rect = new Rect(this); | 
					
						
							|  |  |  |  | 		this->setShape(rect); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Node::~Node() | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	ActionManager::__clearAllBindedWith(this); | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	ShapeManager::__delShape(m_pShape); | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:53:38 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		SafeRelease(&child); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:53:38 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_update() | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	if (m_bTransformNeeded) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		_updateTransform(this); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (!m_vChildren.empty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		if (m_bSortChildrenNeeded) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-11 20:48:56 +08:00
										 |  |  |  | 			// <20>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			auto sortFunc = [](Node * n1, Node * n2) { | 
					
						
							|  |  |  |  | 				return n1->getOrder() < n2->getOrder(); | 
					
						
							|  |  |  |  | 			}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			std::sort( | 
					
						
							|  |  |  |  | 				std::begin(m_vChildren), | 
					
						
							|  |  |  |  | 				std::end(m_vChildren), | 
					
						
							| 
									
										
										
										
											2018-02-11 20:48:56 +08:00
										 |  |  |  | 				sortFunc | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			m_bSortChildrenNeeded = false; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD>
 | 
					
						
							| 
									
										
										
										
											2017-12-15 23:15:06 +08:00
										 |  |  |  | 		size_t size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 		size_t i; | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		for (i = 0; i < size; i++) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			auto child = m_vChildren[i]; | 
					
						
							|  |  |  |  | 			// <20><><EFBFBD><EFBFBD> Order С<><D0A1><EFBFBD><EFBFBD><EFBFBD>Ľڵ<C4BD>
 | 
					
						
							|  |  |  |  | 			if (child->getOrder() < 0) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 				child->_update(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			} | 
					
						
							|  |  |  |  | 			else | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				break; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 		if (m_bAutoUpdate) | 
					
						
							| 
									
										
										
										
											2018-02-04 21:24:27 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 			if (!Game::isPaused()) | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				this->onUpdate(); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			this->onFixedUpdate(); | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>ڵ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		for (; i < size; i++) | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 			m_vChildren[i]->_update(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 		if (m_bAutoUpdate) | 
					
						
							| 
									
										
										
										
											2018-02-04 21:24:27 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 			if (!Game::isPaused()) | 
					
						
							| 
									
										
										
										
											2018-02-06 21:11:54 +08:00
										 |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				this->onUpdate(); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			this->onFixedUpdate(); | 
					
						
							| 
									
										
										
										
											2018-02-04 21:24:27 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_render() | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  |  | 	if (!m_bVisiable) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (!m_vChildren.empty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		size_t size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 		size_t i; | 
					
						
							|  |  |  |  | 		for (i = 0; i < size; i++) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			auto child = m_vChildren[i]; | 
					
						
							|  |  |  |  | 			// <20><><EFBFBD><EFBFBD> Order С<><D0A1><EFBFBD><EFBFBD><EFBFBD>Ľڵ<C4BD>
 | 
					
						
							|  |  |  |  | 			if (child->getOrder() < 0) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				child->_render(); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			else | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				break; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// ת<><D7AA><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD>Ķ<EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 		Renderer::getRenderTarget()->SetTransform(m_MatriFinal); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  |  | 		// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		this->onRender(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>ڵ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		for (; i < size; i++) | 
					
						
							|  |  |  |  | 			m_vChildren[i]->_render(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		// ת<><D7AA><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD>Ķ<EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 		Renderer::getRenderTarget()->SetTransform(m_MatriFinal); | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  |  | 		// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		this->onRender(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_drawShape() | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	if (m_pShape && m_pShape->m_bIsVisiable) | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		m_pShape->_render(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		child->_drawShape(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_onEnter() | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	if (!this->m_bDisplayedInScene) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->m_bDisplayedInScene = true; | 
					
						
							|  |  |  |  | 		this->onEnter(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			child->_onEnter(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_onExit() | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (this->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->m_bDisplayedInScene = false; | 
					
						
							|  |  |  |  | 		this->onExit(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			child->_onExit(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_updateTransform() | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	D2D1_POINT_2F pivot = D2D1::Point2F( | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 		m_fWidth * m_fPivotX, | 
					
						
							|  |  |  |  | 		m_fHeight * m_fPivotY | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2018-02-11 20:55:52 +08:00
										 |  |  |  | 	// <20>任 Initial <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ㽫<DAB5><E3BDAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б任
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_MatriInitial = D2D1::Matrix3x2F::Scale( | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 		m_fScaleX, | 
					
						
							|  |  |  |  | 		m_fScaleY, | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 		pivot | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	) * D2D1::Matrix3x2F::Skew( | 
					
						
							|  |  |  |  | 		m_fSkewAngleX, | 
					
						
							|  |  |  |  | 		m_fSkewAngleY, | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 		pivot | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	) * D2D1::Matrix3x2F::Rotation( | 
					
						
							|  |  |  |  | 		m_fRotation, | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 		pivot | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	) * D2D1::Matrix3x2F::Translation( | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 		m_fPosX, | 
					
						
							|  |  |  |  | 		m_fPosY | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2018-02-11 20:55:52 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>任 Final <20><><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-02-11 20:48:56 +08:00
										 |  |  |  | 	m_MatriFinal = m_MatriInitial * D2D1::Matrix3x2F::Translation(-pivot.x, -pivot.y); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	// <20><EFBFBD><CDB8>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	if (m_pParent) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		m_MatriInitial = m_MatriInitial * m_pParent->m_MatriInitial; | 
					
						
							| 
									
										
										
										
											2018-02-11 20:48:56 +08:00
										 |  |  |  | 		m_MatriFinal = m_MatriFinal * m_pParent->m_MatriInitial; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_updateChildrenTransform() | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		_updateTransform(child); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_updateTransform(Node * node) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	node->_updateTransform(); | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״Ҳ<D7B4><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧת<D3A6><D7AA>
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	if (node->m_pShape) | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		node->m_pShape->_transform(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>нڵ<D0BD>
 | 
					
						
							|  |  |  |  | 	node->_updateChildrenTransform(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	// <20><>־<EFBFBD><D6BE>ִ<EFBFBD>й<EFBFBD><D0B9>任
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	node->m_bTransformNeeded = false; | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_updateChildrenOpacity() | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		_updateOpacity(child); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_updateOpacity(Node * node) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (node->m_pParent) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		node->m_fDisplayOpacity = node->m_fRealOpacity * node->m_pParent->m_fDisplayOpacity; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	node->_updateChildrenOpacity(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | bool e2d::Node::isVisiable() const | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_bVisiable; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::String e2d::Node::getName() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_sName; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getPosX() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fPosX; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getPosY() const | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fPosY; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Point e2d::Node::getPos() const | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return Point(m_fPosX, m_fPosY); | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getWidth() const | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fWidth * m_fScaleX; | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getHeight() const | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fHeight * m_fScaleY; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getRealWidth() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fWidth; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getRealHeight() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return m_fHeight; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Size e2d::Node::getRealSize() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	return Size(m_fWidth, m_fHeight); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getPivotX() const | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	return m_fPivotX; | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getPivotY() const | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	return m_fPivotY; | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Size e2d::Node::getSize() const | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	return Size(getWidth(), getHeight()); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getScaleX() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	return m_fScaleX; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getScaleY() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	return m_fScaleY; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getSkewX() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	return m_fSkewAngleX; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getSkewY() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	return m_fSkewAngleY; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getRotation() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	return m_fRotation; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | double e2d::Node::getOpacity() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	return m_fRealOpacity; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Shape * e2d::Node::getShape() const | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_pShape; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | int e2d::Node::getOrder() const | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_nOrder; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setOrder(int order) | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	m_nOrder = order; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPosX(double x) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	this->setPos(x, m_fPosY); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPosY(double y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	this->setPos(m_fPosX, y); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setPos(const Point & p) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	this->setPos(p.x, p.y); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPos(double x, double y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	if (m_fPosX == x && m_fPosY == y) | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fPosX = static_cast<float>(x); | 
					
						
							|  |  |  |  | 	m_fPosY = static_cast<float>(y); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::movePosX(double x) | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	this->movePos(x, 0); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::movePosY(double y) | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	this->movePos(0, y); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::movePos(double x, double y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	this->setPos(m_fPosX + x, m_fPosY + y); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::movePos(const Vector & v) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  |  | 	this->movePos(v.x, v.y); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setScaleX(double scaleX) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	this->setScale(scaleX, m_fScaleY); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setScaleY(double scaleY) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	this->setScale(m_fScaleX, scaleY); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setScale(double scale) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	this->setScale(scale, scale); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setScale(double scaleX, double scaleY) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	if (m_fScaleX == scaleX && m_fScaleY == scaleY) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fScaleX = static_cast<float>(scaleX); | 
					
						
							|  |  |  |  | 	m_fScaleY = static_cast<float>(scaleY); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setSkewX(double angleX) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	this->setSkew(angleX, m_fSkewAngleY); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setSkewY(double angleY) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	this->setSkew(m_fSkewAngleX, angleY); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setSkew(double angleX, double angleY) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 	if (m_fSkewAngleX == angleX && m_fSkewAngleY == angleY) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fSkewAngleX = static_cast<float>(angleX); | 
					
						
							|  |  |  |  | 	m_fSkewAngleY = static_cast<float>(angleY); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setRotation(double angle) | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (m_fRotation == angle) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fRotation = static_cast<float>(angle); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setOpacity(double opacity) | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	if (m_fRealOpacity == opacity) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fDisplayOpacity = m_fRealOpacity = min(max(static_cast<float>(opacity), 0), 1); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	// <20><><EFBFBD>½ڵ<C2BD><EFBFBD><CDB8><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	_updateOpacity(this); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPivotX(double pivotX) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	this->setPivot(pivotX, m_fPivotY); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPivotY(double pivotY) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	this->setPivot(m_fPivotX, pivotY); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setPivot(double pivotX, double pivotY) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	if (m_fPivotX == pivotX && m_fPivotY == pivotY) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	m_fPivotX = min(max(static_cast<float>(pivotX), 0), 1); | 
					
						
							|  |  |  |  | 	m_fPivotY = min(max(static_cast<float>(pivotY), 0), 1); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-01 19:28:22 +08:00
										 |  |  |  | void e2d::Node::setWidth(double width) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->setSize(width, m_fHeight); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Node::setHeight(double height) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->setSize(m_fWidth, height); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Node::setSize(double width, double height) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (m_fWidth == width && m_fHeight == height) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_fWidth = static_cast<float>(width); | 
					
						
							|  |  |  |  | 	m_fHeight = static_cast<float>(height); | 
					
						
							|  |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Node::setSize(Size size) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->setSize(size.width, size.height); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setShape(Shape * pShape) | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	// ɾ<><C9BE><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	ShapeManager::__delShape(m_pShape); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	ShapeManager::__addShape(pShape); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	if (pShape) | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 		// ˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		this->m_pShape = pShape; | 
					
						
							|  |  |  |  | 		pShape->m_pParentNode = this; | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	else | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		this->m_pShape = nullptr; | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::addChild(Node * child, int order  /* = 0 */) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	WARN_IF(child == nullptr, "Node::addChild NULL pointer exception."); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (child) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 		ASSERT(child->m_pParent == nullptr, "Node already added. It can't be added again!"); | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 		for (Node * parent = this; parent != nullptr; parent = parent->getParent()) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 			ASSERT(child != parent, "A Node cannot be the child of his own children!"); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		m_vChildren.push_back(child); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		child->setOrder(order); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		child->retain(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 		child->m_pParent = this; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		if (this->m_pParentScene) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			child->_setParentScene(this->m_pParentScene); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		if (this->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			child->_onEnter(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><EFBFBD><CDB8><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		_updateOpacity(child); | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD>½ڵ<C2BD>ת<EFBFBD><D7AA>
 | 
					
						
							|  |  |  |  | 		child->m_bTransformNeeded = true; | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 		m_bSortChildrenNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Node * e2d::Node::getParent() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_pParent; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | e2d::Scene * e2d::Node::getParentScene() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_pParentScene; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | std::vector<e2d::Node*> e2d::Node::getChildren(const String & name) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	std::vector<Node*> vChildren; | 
					
						
							| 
									
										
										
										
											2018-03-01 23:47:42 +08:00
										 |  |  |  | 	unsigned int hash = name.getHashCode(); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		// <20><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>ƿ<EFBFBD><C6BF>ܻ<EFBFBD><DCBB><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC> Hash ֵ<><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱȽ<C8B1> Hash <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		if (child->m_nHashName == hash && child->m_sName == name) | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			vChildren.push_back(child); | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	return std::move(vChildren); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | std::vector<e2d::Node*> e2d::Node::getChildren() | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	return m_vChildren; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | int e2d::Node::getChildrenCount() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return static_cast<int>(m_vChildren.size()); | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::removeFromParent() | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	if (m_pParent) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | 		m_pParent->removeChild(this); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | bool e2d::Node::removeChild(Node * child) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	WARN_IF(child == nullptr, "Node::removeChildren NULL pointer exception."); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (m_vChildren.empty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		return false; | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (child) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 23:15:06 +08:00
										 |  |  |  | 		size_t size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 		for (size_t i = 0; i < size; i++) | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			if (m_vChildren[i] == child) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				m_vChildren.erase(m_vChildren.begin() + i); | 
					
						
							|  |  |  |  | 				child->m_pParent = nullptr; | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 				if (child->m_pParentScene) | 
					
						
							|  |  |  |  | 				{ | 
					
						
							|  |  |  |  | 					child->_setParentScene(nullptr); | 
					
						
							|  |  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 				if (child->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 				{ | 
					
						
							|  |  |  |  | 					child->_onExit(); | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 				child->release(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 				return true; | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return false; | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::removeChildren(const String & childName) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	WARN_IF(childName.isEmpty(), "Invalid Node name."); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (m_vChildren.empty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Hash ֵ
 | 
					
						
							| 
									
										
										
										
											2018-03-01 23:47:42 +08:00
										 |  |  |  | 	unsigned int hash = childName.getHashCode(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 23:15:06 +08:00
										 |  |  |  | 	size_t size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 	for (size_t i = 0; i < size; i++) | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		auto child = m_vChildren[i]; | 
					
						
							|  |  |  |  | 		if (child->m_nHashName == hash && child->m_sName == childName) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			m_vChildren.erase(m_vChildren.begin() + i); | 
					
						
							|  |  |  |  | 			child->m_pParent = nullptr; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 			if (child->m_pParentScene) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				child->_setParentScene(nullptr); | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 			if (child->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				child->_onExit(); | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			child->release(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::clearAllChildren() | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>нڵ<D0BD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>һ
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		if (child->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			child->_onExit(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		child->release(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	m_vChildren.clear(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::runAction(Action * action) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-06 15:34:47 +08:00
										 |  |  |  | 	if (this != action->getTarget()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		WARN_IF( | 
					
						
							|  |  |  |  | 			nullptr != action->getTarget(), | 
					
						
							|  |  |  |  | 			"The action has already got a target, The clone of the action will be created automatically!" | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		if (nullptr != action->getTarget()) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			action = action->clone(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		ActionManager::__startAction(action, this); | 
					
						
							| 
									
										
										
										
											2018-02-06 15:34:47 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-06 15:34:47 +08:00
										 |  |  |  | 		action->reset(); | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | void e2d::Node::resumeAction(const String & strActionName) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	auto actions = ActionManager::getActions(strActionName); | 
					
						
							|  |  |  |  | 	for (auto action : actions) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			action->resume(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Node::pauseAction(const String & strActionName) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	auto actions = ActionManager::getActions(strActionName); | 
					
						
							|  |  |  |  | 	for (auto action : actions) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			action->pause(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::Node::stopAction(const String & strActionName) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	auto actions = ActionManager::getActions(strActionName); | 
					
						
							|  |  |  |  | 	for (auto action : actions) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			action->stop(); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::Action * e2d::Node::getAction(const String & strActionName) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	auto actions = ActionManager::getActions(strActionName); | 
					
						
							|  |  |  |  | 	for (auto action : actions) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			return action; | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	return nullptr; | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | std::vector<e2d::Action*> e2d::Node::getActions(const String & strActionName) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	std::vector<Action*>::iterator iter; | 
					
						
							|  |  |  |  | 	auto actions = ActionManager::getActions(strActionName); | 
					
						
							|  |  |  |  | 	for (iter = actions.begin(); iter != actions.end();) | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 		if ((*iter)->getTarget() != this) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			iter = actions.erase(iter); | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 		else | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			iter++; | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 	return std::move(actions); | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | bool e2d::Node::isPointIn(Point point) const | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	// <20>жϵ<D0B6><CFB5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>
 | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | 	BOOL ret = 0; | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	this->m_pShape->_getD2dGeometry()->FillContainsPoint( | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 		D2D1::Point2F( | 
					
						
							|  |  |  |  | 			static_cast<float>(point.x),  | 
					
						
							|  |  |  |  | 			static_cast<float>(point.y)), | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | 		m_MatriFinal, | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		&ret | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	if (ret) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20>жϵ<D0B6><CFB5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5><EFBFBD>
 | 
					
						
							|  |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							|  |  |  |  | 		if (child->isPointIn(point)) | 
					
						
							|  |  |  |  | 			return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | bool e2d::Node::isIntersectWith(const Node * pNode) const | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	if (this->m_pShape && pNode->m_pShape) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		int relation = this->m_pShape->getRelationWith(pNode->m_pShape); | 
					
						
							|  |  |  |  | 		if ((relation != Relation::UNKNOWN) &&  | 
					
						
							|  |  |  |  | 			(relation != Relation::DISJOINT)) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			return true; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	// <20>жϺ<D0B6><CFBA><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5>Ƿ<EFBFBD><C7B7>ཻ
 | 
					
						
							|  |  |  |  | 	for (auto child : pNode->m_vChildren) | 
					
						
							|  |  |  |  | 		if (this->isIntersectWith(child)) | 
					
						
							|  |  |  |  | 			return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20>ж<EFBFBD><D0B6>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ཻ
 | 
					
						
							|  |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							|  |  |  |  | 		if (child->isIntersectWith(pNode)) | 
					
						
							|  |  |  |  | 			return true; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>ཻ<EFBFBD><E0BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false
 | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setAutoUpdate(bool bAutoUpdate) | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bAutoUpdate = bAutoUpdate; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | void e2d::Node::setDefaultPiovt(double defaultPiovtX, double defaultPiovtY) | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-27 21:07:43 +08:00
										 |  |  |  | 	s_fDefaultPiovtX = min(max(static_cast<float>(defaultPiovtX), 0), 1); | 
					
						
							|  |  |  |  | 	s_fDefaultPiovtY = min(max(static_cast<float>(defaultPiovtY), 0), 1); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-07 20:14:58 +08:00
										 |  |  |  | void e2d::Node::setDefaultShapeEnable(bool bEnable) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	s_fDefaultShapeEnabled = bEnable; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::resumeAllActions() | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	ActionManager::__resumeAllBindedWith(this); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::pauseAllActions() | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	ActionManager::__pauseAllBindedWith(this); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::stopAllActions() | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-03-11 23:56:40 +08:00
										 |  |  |  | 	ActionManager::__stopAllBindedWith(this); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setVisiable(bool value) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bVisiable = value; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::setName(const String & name) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | 	WARN_IF(name.isEmpty(), "Invalid Node name."); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	if (!name.isEmpty() && m_sName != name) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>
 | 
					
						
							|  |  |  |  | 		m_sName = name; | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> Hash <20><>
 | 
					
						
							| 
									
										
										
										
											2018-03-01 23:47:42 +08:00
										 |  |  |  | 		m_nHashName = name.getHashCode(); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  |  | void e2d::Node::_setParentScene(Scene * scene) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	m_pParentScene = scene; | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 	for (auto child : m_vChildren) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-02-03 22:04:43 +08:00
										 |  |  |  | 		child->_setParentScene(scene); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } |