| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | #include "..\etransitions.h"
 | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | #include "..\enodes.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | e2d::ETransitionMove::ETransitionMove(float duration, MOVE_DIRECT direct) | 
					
						
							|  |  |  | 	: ETransition(duration) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	, m_Direct(direct) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | void e2d::ETransitionMove::_update() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 	this->_calcRateOfProgress(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (m_pPrevScene) m_pPrevScene->getRoot()->setPos(m_Vec * m_fRateOfProgress); | 
					
						
							|  |  |  | 	m_pNextScene->getRoot()->setPos(m_NextPos + m_Vec * m_fRateOfProgress); | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 	if (m_fRateOfProgress >= 1) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		this->_stop(); | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void e2d::ETransitionMove::_init() | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  | 	if (m_Direct == ETransitionMove::UP) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 		m_Vec = EVector2(0, -EWindow::getHeight()); | 
					
						
							|  |  |  | 		m_NextPos = EPoint(0, EWindow::getHeight()); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  | 	else if (m_Direct == ETransitionMove::DOWN) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 		m_Vec = EVector2(0, EWindow::getHeight()); | 
					
						
							|  |  |  | 		m_NextPos = EPoint(0, -EWindow::getHeight()); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  | 	else if (m_Direct == ETransitionMove::LEFT) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 		m_Vec = EVector2(-EWindow::getWidth(), 0); | 
					
						
							|  |  |  | 		m_NextPos = EPoint(EWindow::getWidth(), 0); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  | 	else if (m_Direct == ETransitionMove::RIGHT) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-01-30 16:45:38 +08:00
										 |  |  | 		m_Vec = EVector2(EWindow::getWidth(), 0); | 
					
						
							|  |  |  | 		m_NextPos = EPoint(-EWindow::getWidth(), 0); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | 	if (m_pPrevScene) m_pPrevScene->getRoot()->setPos(0, 0); | 
					
						
							|  |  |  | 	m_pNextScene->getRoot()->setPos(m_NextPos); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | void e2d::ETransitionMove::_reset() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (m_pPrevScene) m_pPrevScene->getRoot()->setPos(0, 0); | 
					
						
							|  |  |  | 	m_pNextScene->getRoot()->setPos(0, 0); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | 
 |