| 
									
										
										
										
											2018-04-21 21:24:46 +08:00
										 |  |  | #include "..\..\e2dshape.h"
 | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | e2d::CircleShape::CircleShape() | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  | 	: _radius(0) | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	this->setPivot(0.5, 0.5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | e2d::CircleShape::CircleShape(double radius) | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	this->setRadius(radius); | 
					
						
							|  |  |  | 	this->setPivot(0.5, 0.5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | e2d::CircleShape::CircleShape(Point center, double radius) | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | 	this->setRadius(radius); | 
					
						
							|  |  |  | 	this->setPos(center); | 
					
						
							|  |  |  | 	this->setPivot(0.5, 0.5); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | e2d::CircleShape::~CircleShape() | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | double e2d::CircleShape::getRadius() const | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  | 	return _radius; | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | void e2d::CircleShape::setRadius(double radius) | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  | 	_radius = float(radius); | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | 	Node::setSize(radius * 2, radius * 2); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | void e2d::CircleShape::_renderLine() | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-07-03 18:16:26 +08:00
										 |  |  | 	auto renderer = Renderer::getInstance(); | 
					
						
							|  |  |  | 	renderer->getRenderTarget()->DrawEllipse( | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  | 		D2D1::Ellipse(D2D1::Point2F(_radius, _radius), _radius, _radius), | 
					
						
							| 
									
										
										
										
											2018-07-03 18:16:26 +08:00
										 |  |  | 		renderer->getSolidColorBrush(), | 
					
						
							| 
									
										
										
										
											2018-05-24 20:10:11 +08:00
										 |  |  | 		_strokeWidth, | 
					
						
							|  |  |  | 		_strokeStyle | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | 	); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-22 22:29:42 +08:00
										 |  |  | void e2d::CircleShape::_renderFill() | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-07-03 18:16:26 +08:00
										 |  |  | 	auto renderer = Renderer::getInstance(); | 
					
						
							|  |  |  | 	renderer->getRenderTarget()->FillEllipse( | 
					
						
							| 
									
										
										
										
											2018-05-09 00:34:15 +08:00
										 |  |  | 		D2D1::Ellipse(D2D1::Point2F(_radius, _radius), _radius, _radius), | 
					
						
							| 
									
										
										
										
											2018-07-03 18:16:26 +08:00
										 |  |  | 		renderer->getSolidColorBrush() | 
					
						
							| 
									
										
										
										
											2018-04-02 23:01:38 +08:00
										 |  |  | 	); | 
					
						
							|  |  |  | } |