| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | #include "..\etransition.h"
 | 
					
						
							|  |  |  | #include "..\enode.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | e2d::TransitionMove::TransitionMove(double duration, int direct) | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  | 	: Transition(duration) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	, m_Direct(direct) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | void e2d::TransitionMove::_init(Scene * prev, Scene * next) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 	Transition::_init(prev, next); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	double width = m_WindowSize.width; | 
					
						
							|  |  |  | 	double height = m_WindowSize.height; | 
					
						
							|  |  |  | 	if (m_Direct == Direct::UP) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 		m_Vector = Vector(0, -height); | 
					
						
							|  |  |  | 		m_NextPos = Point(0, height); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 	else if (m_Direct == Direct::DOWN) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 		m_Vector = Vector(0, height); | 
					
						
							|  |  |  | 		m_NextPos = Point(0, -height); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 	else if (m_Direct == Direct::LEFT) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 		m_Vector = Vector(-width, 0); | 
					
						
							|  |  |  | 		m_NextPos = Point(width, 0); | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 	else if (m_Direct == Direct::RIGHT) | 
					
						
							| 
									
										
										
										
											2017-10-21 19:09:31 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 01:11:56 +08:00
										 |  |  | 		m_Vector = Vector(width, 0); | 
					
						
							|  |  |  | 		m_NextPos = Point(-width, 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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-17 11:41:33 +08:00
										 |  |  | void e2d::TransitionMove::_updateCustom() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (m_pPrevScene) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 13:26:50 +08:00
										 |  |  | 		m_pPrevScene->getRoot()->setPos(m_Vector * m_fRateOfProgress); | 
					
						
							| 
									
										
										
										
											2018-04-17 11:41:33 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (m_pNextScene) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-04-17 13:26:50 +08:00
										 |  |  | 		m_pNextScene->getRoot()->setPos(m_NextPos + m_Vector * m_fRateOfProgress); | 
					
						
							| 
									
										
										
										
											2018-04-17 11:41:33 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (m_fRateOfProgress >= 1) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		this->_stop(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-07 16:37:12 +08:00
										 |  |  | void e2d::TransitionMove::_reset() | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	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
										 |  |  | 
 |