[deploy] update Actor

This commit is contained in:
Nomango 2020-08-08 14:39:51 +08:00
parent 3d40f5cfe2
commit 38d4eb214a
2 changed files with 14 additions and 5 deletions

View File

@ -50,7 +50,7 @@ Actor::Actor()
, dirty_visibility_(true)
, dirty_transform_(false)
, dirty_transform_inverse_(false)
, cascade_opacity_(false)
, cascade_opacity_(true)
, show_border_(false)
, is_fast_transform_(true)
, evt_dispatch_enabled_(true)
@ -515,7 +515,7 @@ void Actor::SetRotation(float angle)
is_fast_transform_ = false;
}
void Actor::AddChild(ActorPtr child, int zorder)
void Actor::AddChild(ActorPtr child)
{
if (child)
{
@ -527,7 +527,7 @@ void Actor::AddChild(ActorPtr child, int zorder)
{
if (parent == child)
{
KGE_ERRORF("A actor cannot be its own parent");
Fail("Actor::AddChild failed, A actor cannot be its own parent");
return;
}
}
@ -539,7 +539,6 @@ void Actor::AddChild(ActorPtr child, int zorder)
child->SetStage(this->stage_);
child->dirty_transform_ = true;
child->z_order_ = zorder;
child->Reorder();
child->UpdateOpacity();
}
@ -549,6 +548,12 @@ void Actor::AddChild(ActorPtr child, int zorder)
}
}
void Actor::AddChild(ActorPtr child, int zorder)
{
child->z_order_ = zorder;
this->AddChild(child);
}
void Actor::AddChildren(const Vector<ActorPtr>& children)
{
for (const auto& actor : children)

View File

@ -341,7 +341,11 @@ public:
/// \~chinese
/// @brief 添加子角色
void AddChild(ActorPtr child, int zorder = 0);
void AddChild(ActorPtr child);
/// \~chinese
/// @brief Ìí¼Ó×Ó½ÇÉ«
void AddChild(ActorPtr child, int zorder);
/// \~chinese
/// @brief 添加多个子角色