| 
									
										
										
										
											2018-04-21 21:24:46 +08:00
										 |  |  | #include "..\e2daction.h"
 | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionMoveBy * e2d::Action::MoveBy(double duration, Vector vector) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionMoveBy(duration, vector); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionMoveTo * e2d::Action::MoveTo(double duration, Point pos) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionMoveTo(duration, pos); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionScaleBy * e2d::Action::ScaleBy(double duration, double scale) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionScaleBy(duration, scale); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionScaleBy * e2d::Action::ScaleBy(double duration, double scaleX, double scaleY) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionScaleBy(duration, scaleX, scaleY); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionScaleTo * e2d::Action::ScaleTo(double duration, double scale) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionScaleTo(duration, scale); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionScaleTo * e2d::Action::ScaleTo(double duration, double scaleX, double scaleY) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionScaleTo(duration, scaleX, scaleY); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionOpacityBy * e2d::Action::OpacityBy(double duration, double opacity) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionOpacityBy(duration, opacity); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionOpacityTo * e2d::Action::OpacityTo(double duration, double opacity) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionOpacityTo(duration, opacity); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionFadeIn * e2d::Action::FadeIn(double duration) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionFadeIn(duration); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionFadeOut * e2d::Action::FadeOut(double duration) | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionFadeOut(duration); | 
					
						
							| 
									
										
										
										
											2018-03-06 09:56:17 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionRotateBy * e2d::Action::RotateBy(double duration, double rotation) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionRotateBy(duration, rotation); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionRotateTo * e2d::Action::RotateTo(double duration, double rotation) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionRotateTo(duration, rotation); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionTwo * e2d::Action::Two(ActionBase * pActionFirst, ActionBase * pActionSecond, bool bAtSameTime) | 
					
						
							| 
									
										
										
										
											2018-04-21 18:22:01 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionTwo(pActionFirst, pActionSecond, bAtSameTime); | 
					
						
							| 
									
										
										
										
											2018-04-21 18:22:01 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionDelay * e2d::Action::Delay(double duration) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionDelay(duration); | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::ActionLoop * e2d::Action::Loop(ActionBase * action, int times) | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	return new (std::nothrow) ActionLoop(action, times); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 11:37:11 +08:00
										 |  |  | e2d::ActionFunc * e2d::Action::Func(const Function& func) | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	return new (std::nothrow) ActionFunc(func); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef HIGHER_THAN_VS2012
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 11:37:11 +08:00
										 |  |  | e2d::ActionSequence * e2d::Action::Sequence(const std::initializer_list<ActionBase*>& vActions) | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	return new (std::nothrow) ActionSequence(vActions); | 
					
						
							| 
									
										
										
										
											2017-11-03 12:51:01 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-08 11:37:11 +08:00
										 |  |  | e2d::Animation * e2d::Action::Animation(double interval, const std::initializer_list<Image*>& vFrames) | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	return new (std::nothrow) e2d::Animation(interval, vFrames); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::ActionSequence * e2d::Action::Sequence(int number, ActionBase * action1, ...) | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	auto action = new (std::nothrow) ActionSequence(); | 
					
						
							|  |  |  | 	if (action) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		ActionBase ** ppAction = &action1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		while (number > 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			WARN_IF((*ppAction) == nullptr, "ActionSequence NULL pointer exception!"); | 
					
						
							|  |  |  | 			action->add(*ppAction); | 
					
						
							|  |  |  | 			ppAction++; | 
					
						
							|  |  |  | 			number--; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return action; | 
					
						
							| 
									
										
										
										
											2017-12-04 10:03:14 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | e2d::Animation * e2d::Action::Animation(double interval, int number, Image * frame, ...) | 
					
						
							| 
									
										
										
										
											2017-12-04 10:03:14 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 	auto animation = new (std::nothrow) e2d::Animation(interval); | 
					
						
							|  |  |  | 	if (animation) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		Image ** ppImage = &frame; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		while (number > 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			WARN_IF((*ppImage) == nullptr, "Animation NULL pointer exception!"); | 
					
						
							|  |  |  | 			animation->add(*ppImage); | 
					
						
							|  |  |  | 			ppImage++; | 
					
						
							|  |  |  | 			number--; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return animation; | 
					
						
							| 
									
										
										
										
											2017-10-19 00:50:04 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2018-04-30 16:49:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif
 |