| 
									
										
										
										
											2018-08-13 23:47:10 +08:00
										 |  |  | #include "..\e2dbase.h"
 | 
					
						
							|  |  |  | #include "..\e2dnode.h"
 | 
					
						
							|  |  |  | #include "..\e2dmanager.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::Scene::Scene() | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | 	: _outlineVisible(false) | 
					
						
							|  |  |  | 	, _colliderVisible(false) | 
					
						
							| 
									
										
										
										
											2018-08-13 23:47:10 +08:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | e2d::Scene::~Scene() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | e2d::Scene& e2d::Scene::outlineVisible(bool visible) | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	_outlineVisible = visible; | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | 	return *this; | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | e2d::Scene& e2d::Scene::colliderVisible(bool visible) | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	_colliderVisible = visible; | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | 	return *this; | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void e2d::Scene::visit(Game * game) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	Node::visit(game); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (_outlineVisible) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | 		auto brush = game->renderer()->solidBrush(); | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | 		brush->SetColor(D2D1::ColorF(D2D1::ColorF::Red, 0.6f)); | 
					
						
							|  |  |  | 		brush->SetOpacity(1.f); | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | 		this->drawOutline(game->renderer()); | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (_colliderVisible) | 
					
						
							|  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2018-08-23 16:37:44 +08:00
										 |  |  | 		game->renderer()->renderTarget()->SetTransform(D2D1::Matrix3x2F::Identity()); | 
					
						
							| 
									
										
										
										
											2018-08-19 15:11:20 +08:00
										 |  |  | 		this->drawCollider(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |