| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  |  | #include "..\etransitions.h"
 | 
					
						
							|  |  |  |  | #include "..\Win\winbase.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | e2d::ETransition::ETransition(float duration) | 
					
						
							|  |  |  |  | 	: m_bEnd(false) | 
					
						
							|  |  |  |  | 	, m_fTotalDuration(duration * 1000) | 
					
						
							|  |  |  |  | 	, m_fDuration(0) | 
					
						
							|  |  |  |  | 	, m_fRateOfProgress(0) | 
					
						
							|  |  |  |  | 	, m_pPrevScene(nullptr) | 
					
						
							|  |  |  |  | 	, m_pNextScene(nullptr) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-16 15:49:48 +08:00
										 |  |  |  | 	SetInterval(m_nAnimationInterval, 15LL); | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::ETransition::isEnding() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_bEnd; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool e2d::ETransition::_isDelayEnough() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20>ж<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>㹻
 | 
					
						
							|  |  |  |  | 	if (m_fTotalDuration == 0) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		m_fRateOfProgress = 1; | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	if (IsIntervalFull(m_tLast, m_nAnimationInterval)) | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		// <20><><EFBFBD>¼<EFBFBD>¼ʱ<C2BC><CAB1>
 | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 		m_tLast.QuadPart += m_nAnimationInterval.QuadPart; | 
					
						
							|  |  |  |  | 		m_fDuration += static_cast<float>(ToMilliseconds(m_nAnimationInterval.QuadPart)); | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  |  | 		// <20><><EFBFBD>㶯<EFBFBD><E3B6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		m_fRateOfProgress = m_fDuration / m_fTotalDuration; | 
					
						
							|  |  |  |  | 		return true; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ETransition::_stop() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bEnd = true; | 
					
						
							|  |  |  |  | 	_reset(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void e2d::ETransition::_setTarget(EScene * prev, EScene * next) | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-12-15 21:51:07 +08:00
										 |  |  |  | 	m_tLast = GetNow(); | 
					
						
							| 
									
										
										
										
											2017-12-09 15:27:11 +08:00
										 |  |  |  | 	m_pPrevScene = prev; | 
					
						
							|  |  |  |  | 	m_pNextScene = next; | 
					
						
							|  |  |  |  | 	_init(); | 
					
						
							|  |  |  |  | } |