| 
									
										
										
										
											2017-09-27 17:56:28 +08:00
										 |  |  |  | #include "..\easy2d.h"
 | 
					
						
							|  |  |  |  | #include <assert.h>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Action::Action() : | 
					
						
							|  |  |  |  | 	m_bRunning(true), | 
					
						
							| 
									
										
										
										
											2017-10-08 12:30:45 +08:00
										 |  |  |  | 	m_bWaiting(false), | 
					
						
							|  |  |  |  | 	m_bEnding(false), | 
					
						
							| 
									
										
										
										
											2017-10-06 02:32:33 +08:00
										 |  |  |  | 	m_pTargetSprite(nullptr), | 
					
						
							|  |  |  |  | 	m_pParentScene(nullptr) | 
					
						
							| 
									
										
										
										
											2017-09-27 17:56:28 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 	// Ĭ<>϶<EFBFBD><CFB6><EFBFBD> 15ms <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
 | 
					
						
							|  |  |  |  | 	setInterval(15); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Action::~Action() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool Action::isRunning() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-08 12:30:45 +08:00
										 |  |  |  | 	return m_bRunning && !m_bWaiting; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | bool Action::isEnding() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	return m_bEnding; | 
					
						
							| 
									
										
										
										
											2017-09-27 17:56:28 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::start() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bRunning = true; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::resume() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bRunning = true; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::pause() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bRunning = false; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::stop() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2017-10-08 12:30:45 +08:00
										 |  |  |  | 	m_bEnding = true; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | void Action::wait() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bWaiting = true; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::notify() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bWaiting = false; | 
					
						
							| 
									
										
										
										
											2017-09-27 17:56:28 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::setInterval(UINT ms) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	LARGE_INTEGER nFreq; | 
					
						
							|  |  |  |  | 	QueryPerformanceFrequency(&nFreq); | 
					
						
							|  |  |  |  | 	m_nAnimationInterval.QuadPart = (LONGLONG)(ms / 1000.0 * nFreq.QuadPart); | 
					
						
							|  |  |  |  | 	// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
 | 
					
						
							|  |  |  |  | 	this->m_nMilliSeconds = ms; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Action * Action::reverse() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	assert(0); | 
					
						
							|  |  |  |  | 	return nullptr; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-10-08 12:30:45 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | void Action::_reset() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	m_bEnding = false; | 
					
						
							|  |  |  |  | } |