| 
									
										
										
										
											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"
 | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | #include "..\egeometry.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  |  | #include "..\Win\winbase.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; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | e2d::ENode::ENode() | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	: m_nOrder(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) | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | 	, m_pGeometry(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) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::ENode::ENode(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	: m_nOrder(0) | 
					
						
							|  |  |  |  | 	, m_fScaleX(1.0f) | 
					
						
							|  |  |  |  | 	, m_fScaleY(1.0f) | 
					
						
							|  |  |  |  | 	, m_fRotation(0) | 
					
						
							|  |  |  |  | 	, m_fSkewAngleX(0) | 
					
						
							|  |  |  |  | 	, m_fSkewAngleY(0) | 
					
						
							|  |  |  |  | 	, m_fDisplayOpacity(1.0f) | 
					
						
							|  |  |  |  | 	, m_fRealOpacity(1.0f) | 
					
						
							|  |  |  |  | 	, m_fPivotX(s_fDefaultPiovtX) | 
					
						
							|  |  |  |  | 	, m_fPivotY(s_fDefaultPiovtY) | 
					
						
							|  |  |  |  | 	, m_MatriInitial(D2D1::Matrix3x2F::Identity()) | 
					
						
							|  |  |  |  | 	, m_MatriFinal(D2D1::Matrix3x2F::Identity()) | 
					
						
							|  |  |  |  | 	, m_bVisiable(true) | 
					
						
							|  |  |  |  | 	, m_bDisplayedInScene(false) | 
					
						
							|  |  |  |  | 	, m_pGeometry(nullptr) | 
					
						
							|  |  |  |  | 	, m_pParent(nullptr) | 
					
						
							|  |  |  |  | 	, m_pParentScene(nullptr) | 
					
						
							|  |  |  |  | 	, m_nHashName(0) | 
					
						
							|  |  |  |  | 	, m_bSortChildrenNeeded(false) | 
					
						
							|  |  |  |  | 	, m_bTransformNeeded(false) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	setName(name); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::ENode::~ENode() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	ETimerManager::_clearAllTimersBindedWith(this); | 
					
						
							|  |  |  |  | 	EMsgManager::_clearAllMouseListenersBindedWith(this); | 
					
						
							|  |  |  |  | 	EMsgManager::_clearAllKeyboardListenersBindedWith(this); | 
					
						
							|  |  |  |  | 	EActionManager::_clearAllActionsBindedWith(this); | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	EPhysicsManager::_clearAllListenersBindedWith(this); | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | 	EPhysicsManager::_delGeometry(m_pGeometry); | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:53:38 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		SafeRelease(&(*child)); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:53:38 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::ENode::onEnter() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::onExit() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | void e2d::ENode::_update() | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	if (!m_bVisiable) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->_sortChildren(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		UINT size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 		UINT 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) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | 				child->_update(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			} | 
					
						
							|  |  |  |  | 			else | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				break; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		GetRenderTarget()->SetTransform(m_MatriFinal); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | 		this->_render(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD>ڵ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		for (; i < size; i++) | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | 			m_vChildren[i]->_update(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		GetRenderTarget()->SetTransform(m_MatriFinal); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | 		this->_render(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | void e2d::ENode::_render() | 
					
						
							| 
									
										
										
										
											2017-10-13 11:42:36 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | void e2d::ENode::_drawGeometry() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | 	if (m_pGeometry && m_pGeometry->m_bIsVisiable) | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-08 15:37:52 +08:00
										 |  |  |  | 		m_pGeometry->_render(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		(*child)->_drawGeometry(); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::ENode::_onEnter() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (!this->m_bDisplayedInScene && this->isVisiable()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->m_bDisplayedInScene = true; | 
					
						
							|  |  |  |  | 		this->onEnter(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 			(*child)->_onEnter(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::_onExit() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (this->m_bDisplayedInScene) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->m_bDisplayedInScene = false; | 
					
						
							|  |  |  |  | 		this->onExit(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 			(*child)->_onExit(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | void e2d::ENode::_sortChildren() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	if (m_bSortChildrenNeeded) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		// <20>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		std::sort( | 
					
						
							|  |  |  |  | 			std::begin(m_vChildren),  | 
					
						
							|  |  |  |  | 			std::end(m_vChildren),  | 
					
						
							|  |  |  |  | 			[](ENode * n1, ENode * n2) { | 
					
						
							|  |  |  |  | 				return n1->getOrder() < n2->getOrder(); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 		m_bSortChildrenNeeded = false; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | void e2d::ENode::_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( | 
					
						
							|  |  |  |  | 		getRealWidth() * m_fPivotX, | 
					
						
							|  |  |  |  | 		getRealHeight() * m_fPivotY | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD>ά<EFBFBD><CEAC><EFBFBD>α任<CEB1><E4BBBB><EFBFBD>ӽڵ㽫<DAB5><E3BDAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б任
 | 
					
						
							|  |  |  |  | 	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( | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 		m_Pos.x, | 
					
						
							|  |  |  |  | 		m_Pos.y | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ձ任
 | 
					
						
							|  |  |  |  | 	m_MatriFinal = m_MatriInitial * D2D1::Matrix3x2F::Translation(-pivot.x, -pivot.y); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::_updateChildrenTransform() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		_updateTransform((*child)); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::_updateTransform(ENode * 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>
 | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	if (node->m_pGeometry) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		node->m_pGeometry->_transform(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | void e2d::ENode::_updateChildrenOpacity() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		_updateOpacity((*child)); | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | void e2d::ENode::_updateOpacity(ENode * node) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::ENode::isVisiable() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_bVisiable; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EString e2d::ENode::getName() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_sName; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | float e2d::ENode::getPosX() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_Pos.x; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | float e2d::ENode::getPosY() const | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return m_Pos.y; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::EPoint e2d::ENode::getPos() const | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return m_Pos; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | float e2d::ENode::getWidth() const | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return m_Size.width * m_fScaleX; | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::getHeight() const | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	return m_Size.height * m_fScaleY; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | float e2d::ENode::getRealWidth() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_Size.width; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | float e2d::ENode::getRealHeight() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_Size.height; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::ESize e2d::ENode::getRealSize() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_Size; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::ESize e2d::ENode::getSize() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return ESize(getWidth(), getHeight()); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | float e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | int e2d::ENode::getOrder() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_nOrder; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::setOrder(int order) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_nOrder = order; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::ENode::setPosX(float x) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->setPos(x, m_Pos.y); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::setPosY(float y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	this->setPos(m_Pos.x, y); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::ENode::setPos(const EPoint & 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setPos(float x, float y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	if (m_Pos.x == x && m_Pos.y == y) | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	m_Pos.x = x; | 
					
						
							|  |  |  |  | 	m_Pos.y = y; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  |  | void e2d::ENode::movePosX(float x) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->movePos(x, 0); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::movePosY(float y) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	this->movePos(0, y); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::movePos(float x, float y) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	this->setPos(m_Pos.x + x, m_Pos.y + y); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  |  | void e2d::ENode::movePos(const EVec & 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | void e2d::ENode::_setWidth(float width) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	this->_setSize(width, m_Size.height); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | void e2d::ENode::_setHeight(float height) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	this->_setSize(m_Size.width, height); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | void e2d::ENode::_setSize(const ESize & size) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | 	this->_setSize(size.width, size.height); | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 22:13:20 +08:00
										 |  |  |  | void e2d::ENode::_setSize(float width, float height) | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	if (m_Size.width == width && m_Size.height == height) | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	m_Size.width = width; | 
					
						
							|  |  |  |  | 	m_Size.height = height; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setScaleX(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setScaleY(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setScale(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setScale(float scaleX, float 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; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_fScaleX = scaleX; | 
					
						
							|  |  |  |  | 	m_fScaleY = scaleY; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setSkewX(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setSkewY(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | void e2d::ENode::setSkew(float angleX, float 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; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_fSkewAngleX = angleX; | 
					
						
							|  |  |  |  | 	m_fSkewAngleY = angleY; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::setRotation(float angle) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (m_fRotation == angle) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_fRotation = angle; | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-15 02:46:24 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::setOpacity(float opacity) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-15 23:58:39 +08:00
										 |  |  |  | 	if (m_fRealOpacity == opacity) | 
					
						
							|  |  |  |  | 		return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	m_fDisplayOpacity = m_fRealOpacity = min(max(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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | void e2d::ENode::setPivotX(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | void e2d::ENode::setPivotY(float 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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | void e2d::ENode::setPivot(float pivotX, float 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; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-04 15:38:41 +08:00
										 |  |  |  | 	m_fPivotX = min(max(pivotX, 0), 1); | 
					
						
							|  |  |  |  | 	m_fPivotY = min(max(pivotY, 0), 1); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	m_bTransformNeeded = true; | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | void e2d::ENode::setGeometry(EGeometry * geometry) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	// ɾ<><C9BE><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | 	EPhysicsManager::_delGeometry(m_pGeometry); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 	// <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | 	EPhysicsManager::_addGeometry(geometry); | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (geometry) | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 		// ˫<><CBAB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		this->m_pGeometry = geometry; | 
					
						
							|  |  |  |  | 		geometry->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
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-10-29 23:48:32 +08:00
										 |  |  |  | 		this->m_pGeometry = nullptr; | 
					
						
							| 
									
										
										
										
											2017-10-28 18:48:21 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-26 17:17:30 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | void e2d::ENode::addChild(ENode * child, int order  /* = 0 */) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	WARN_IF(child == nullptr, "ENode::addChild NULL pointer exception."); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	ASSERT(child->m_pParent == nullptr, "ENode already added. It can't be added again!"); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (child) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		for (ENode * parent = this; parent != nullptr; parent = parent->getParent()) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			ASSERT(child != parent, "A ENode 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
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | e2d::ENode * e2d::ENode::getParent() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_pParent; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | e2d::EScene * e2d::ENode::getParentScene() const | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_pParentScene; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | std::vector<e2d::ENode*>& e2d::ENode::getChildren() | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_vChildren; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | UINT e2d::ENode::getChildrenCount() const | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_vChildren.size(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | e2d::ENode * e2d::ENode::getChild(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	WARN_IF(name.isEmpty(), "Invalid ENode name."); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	unsigned int hash = name.hash(); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											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>
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		if ((*child)->m_nHashName == hash && (*child)->m_sName == name) | 
					
						
							|  |  |  |  | 			return (*child); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return nullptr; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | void e2d::ENode::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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | bool e2d::ENode::removeChild(ENode * child) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 	WARN_IF(child == nullptr, "ENode::removeChild NULL pointer exception."); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	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 21:51:07 +08:00
										 |  |  |  | 		UINT size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 		for (UINT 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; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 				if (child->m_pParentScene) | 
					
						
							|  |  |  |  | 				{ | 
					
						
							|  |  |  |  | 					child->_setParentScene(nullptr); | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 				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
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | void e2d::ENode::removeChild(const EString & childName) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	WARN_IF(childName.isEmpty(), "Invalid ENode 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 ֵ
 | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	unsigned int hash = childName.hash(); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	UINT size = m_vChildren.size(); | 
					
						
							|  |  |  |  | 	for (UINT 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); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			child->_onExit(); | 
					
						
							| 
									
										
										
										
											2017-10-14 18:43:32 +08:00
										 |  |  |  | 			child->release(); | 
					
						
							|  |  |  |  | 			return; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 17:19:13 +08:00
										 |  |  |  | void e2d::ENode::clearAllChildren() | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>нڵ<D0BD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>һ
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		(*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(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | void e2d::ENode::runAction(EAction * action) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-20 00:59:26 +08:00
										 |  |  |  | 	ASSERT( | 
					
						
							|  |  |  |  | 		(!action->getTarget()), | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 		"The action is already running, it cannot run again!" | 
					
						
							| 
									
										
										
										
											2017-10-20 00:59:26 +08:00
										 |  |  |  | 	); | 
					
						
							|  |  |  |  | 	action->setTarget(this); | 
					
						
							|  |  |  |  | 	EActionManager::addAction(action); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | void e2d::ENode::resumeAction(EAction * action) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		action->resume(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::pauseAction(EAction * action) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		action->pause(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | bool e2d::ENode::isPointIn(EPoint point) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	if (m_bTransformNeeded) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		_updateTransform(this); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	// Ϊ<>ڵ㴴<DAB5><E3B4B4>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>״
 | 
					
						
							|  |  |  |  | 	ID2D1RectangleGeometry * rect; | 
					
						
							|  |  |  |  | 	GetFactory()->CreateRectangleGeometry( | 
					
						
							|  |  |  |  | 		D2D1::RectF(0, 0, getRealWidth(), getRealHeight()), | 
					
						
							|  |  |  |  | 		&rect | 
					
						
							| 
									
										
										
										
											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>
 | 
					
						
							|  |  |  |  | 	BOOL ret; | 
					
						
							|  |  |  |  | 	rect->FillContainsPoint( | 
					
						
							|  |  |  |  | 		D2D1::Point2F( | 
					
						
							|  |  |  |  | 			point.x, | 
					
						
							|  |  |  |  | 			point.y), | 
					
						
							|  |  |  |  | 		&m_MatriFinal, | 
					
						
							|  |  |  |  | 		&ret | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	); | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | 	if (ret) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	else | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							|  |  |  |  | 			if ((*child)->isPointIn(point)) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | 				return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-09 18:22:41 +08:00
										 |  |  |  | void e2d::ENode::setDefaultPiovt(float defaultPiovtX, float defaultPiovtY) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	s_fDefaultPiovtX = min(max(defaultPiovtX, 0), 1); | 
					
						
							|  |  |  |  | 	s_fDefaultPiovtY = min(max(defaultPiovtY, 0), 1); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | void e2d::ENode::stopAction(EAction * action) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-19 12:47:36 +08:00
										 |  |  |  | 	if (action->getTarget() == this) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		action->stop(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  |  | void e2d::ENode::startAllActions() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EActionManager::startAllActionsBindedWith(this); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::pauseAllActions() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EActionManager::pauseAllActionsBindedWith(this); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::stopAllActions() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	EActionManager::stopAllActionsBindedWith(this); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | void e2d::ENode::setVisiable(bool value) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bVisiable = value; | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	if (m_bDisplayedInScene == false) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		this->_onEnter(); | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-10-12 23:34:13 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | void e2d::ENode::setName(const EString & name) | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	WARN_IF(name.isEmpty(), "Invalid ENode name."); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 	if (!name.isEmpty()) | 
					
						
							| 
									
										
										
										
											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><>
 | 
					
						
							| 
									
										
										
										
											2017-12-11 18:17:24 +08:00
										 |  |  |  | 		m_nHashName = name.hash(); | 
					
						
							| 
									
										
										
										
											2017-10-14 11:40:47 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ENode::_setParentScene(EScene * scene) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_pParentScene = scene; | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	for (auto child = m_vChildren.begin(); child != m_vChildren.end(); child++) | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		(*child)->_setParentScene(scene); | 
					
						
							| 
									
										
										
										
											2017-10-17 21:22:25 +08:00
										 |  |  |  | 	} | 
					
						
							|  |  |  |  | } |