| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | #include "..\e2dtransition.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-06 23:26:32 +08:00
										 |  |  | #include "..\e2dobject.h"
 | 
					
						
							| 
									
										
										
										
											2018-09-05 13:17:07 +08:00
										 |  |  | #include "..\e2dmodule.h"
 | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-14 00:26:20 +08:00
										 |  |  | e2d::BoxTransition::BoxTransition(Scene* scene, float duration) | 
					
						
							|  |  |  | 	: Transition(scene, duration) | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | bool e2d::BoxTransition::Init(Game * game, Scene * prev) | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 	if (Transition::Init(game, prev)) | 
					
						
							| 
									
										
										
										
											2018-08-02 00:27:45 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 		in_layer_param_.opacity = 0; | 
					
						
							| 
									
										
										
										
											2018-08-02 00:27:45 +08:00
										 |  |  | 		return true; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	return false; | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | void e2d::BoxTransition::Update() | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 	Transition::Update(); | 
					
						
							| 
									
										
										
										
											2018-08-02 00:27:45 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 	auto size = Window::GetInstance()->GetSize(); | 
					
						
							|  |  |  | 	if (delta_ <= 0.5) | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 		out_layer_param_.contentBounds = D2D1::RectF( | 
					
						
							|  |  |  | 			size.width * delta_, | 
					
						
							|  |  |  | 			size.height * delta_, | 
					
						
							|  |  |  | 			size.width * (1 - delta_), | 
					
						
							|  |  |  | 			size.height * (1 - delta_) | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 		); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 		out_layer_param_.opacity = 0; | 
					
						
							|  |  |  | 		in_layer_param_.opacity = 1; | 
					
						
							|  |  |  | 		in_layer_param_.contentBounds = D2D1::RectF( | 
					
						
							|  |  |  | 			size.width * (1 - delta_), | 
					
						
							|  |  |  | 			size.height * (1 - delta_), | 
					
						
							|  |  |  | 			size.width * delta_, | 
					
						
							|  |  |  | 			size.height * delta_ | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 		); | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 		if (delta_ >= 1) | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2018-09-04 22:42:34 +08:00
										 |  |  | 			this->Stop(); | 
					
						
							| 
									
										
										
										
											2018-05-22 13:49:10 +08:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |