Magic_Game/core/Node/Shape/RoundRectShape.cpp

66 lines
1.3 KiB
C++
Raw Normal View History

2018-04-21 21:24:46 +08:00
#include "..\..\e2dshape.h"
2018-05-22 22:29:42 +08:00
e2d::RoundRectShape::RoundRectShape()
: _radiusX(0)
, _radiusY(0)
{
}
2018-05-22 22:29:42 +08:00
e2d::RoundRectShape::RoundRectShape(Size size, double radiusX, double radiusY)
: _radiusX(float(radiusX))
, _radiusY(float(radiusY))
{
2018-05-17 12:22:52 +08:00
this->setSize(size);
}
2018-05-22 22:29:42 +08:00
e2d::RoundRectShape::RoundRectShape(Point topLeft, Size size, double radiusX, double radiusY)
: _radiusX(float(radiusX))
, _radiusY(float(radiusY))
{
2018-05-17 12:22:52 +08:00
this->setPivot(0, 0);
this->setPos(topLeft);
this->setSize(size);
}
2018-05-22 22:29:42 +08:00
e2d::RoundRectShape::~RoundRectShape()
{
}
2018-05-22 22:29:42 +08:00
double e2d::RoundRectShape::getRadiusX() const
{
return _radiusX;
}
2018-05-22 22:29:42 +08:00
double e2d::RoundRectShape::getRadiusY() const
{
return _radiusY;
}
2018-05-22 22:29:42 +08:00
void e2d::RoundRectShape::setRadiusX(double radiusX)
{
_radiusX = float(radiusX);
}
2018-05-22 22:29:42 +08:00
void e2d::RoundRectShape::setRadiusY(double radiusY)
{
_radiusY = float(radiusY);
}
2018-05-22 22:29:42 +08:00
void e2d::RoundRectShape::_renderLine()
{
Renderer::getRenderTarget()->DrawRoundedRectangle(
D2D1::RoundedRect(D2D1::RectF(0, 0, _width, _height), _radiusX, _radiusY),
Renderer::getSolidColorBrush(),
2018-05-24 20:10:11 +08:00
_strokeWidth,
_strokeStyle
);
}
2018-05-22 22:29:42 +08:00
void e2d::RoundRectShape::_renderFill()
{
Renderer::getRenderTarget()->FillRoundedRectangle(
D2D1::RoundedRect(D2D1::RectF(0, 0, _width, _height), _radiusX, _radiusY),
Renderer::getSolidColorBrush()
);
}