Update ShapeActor

This commit is contained in:
Nomango 2020-02-12 10:04:16 +08:00
parent 50d2b80d79
commit 8c291b1cdc
2 changed files with 44 additions and 2 deletions

View File

@ -24,9 +24,36 @@
namespace kiwano
{
ShapeActorPtr ShapeActor::Create()
ShapeActorPtr ShapeActor::Create(ShapePtr shape)
{
ShapeActorPtr ptr = new (std::nothrow) ShapeActor;
if (ptr)
{
ptr->SetShape(shape);
}
return ptr;
}
ShapeActorPtr ShapeActor::Create(ShapePtr shape, const Color& fill_color, const Color& stroke_color)
{
ShapeActorPtr ptr = ShapeActor::Create(shape);
if (ptr)
{
ptr->SetFillColor(fill_color);
ptr->SetStrokeColor(stroke_color);
}
return ptr;
}
ShapeActorPtr ShapeActor::Create(ShapePtr shape, BrushPtr fill_brush, BrushPtr stroke_brush)
{
ShapeActorPtr ptr = ShapeActor::Create(shape);
if (ptr)
{
ptr->SetFillBrush(fill_brush);
ptr->SetStrokeBrush(stroke_brush);
}
return ptr;
}

View File

@ -50,7 +50,22 @@ class KGE_API ShapeActor : public Actor
public:
/// \~chinese
/// @brief 创建形状角色
static ShapeActorPtr Create();
/// @param shape 形状
static ShapeActorPtr Create(ShapePtr shape);
/// \~chinese
/// @brief 创建形状角色
/// @param shape 形状
/// @param fill_color 填充颜色
/// @param stroke_color 轮廓颜色
static ShapeActorPtr Create(ShapePtr shape, const Color& fill_color, const Color& stroke_color);
/// \~chinese
/// @brief 创建形状角色
/// @param shape 形状
/// @param fill_brush 填充画刷
/// @param stroke_brush 轮廓画刷
static ShapeActorPtr Create(ShapePtr shape, BrushPtr fill_brush, BrushPtr stroke_brush);
/// \~chinese
/// @brief 构造形状角色