本文整理汇总了C++中StaticSprite2D::SetFlip方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticSprite2D::SetFlip方法的具体用法?C++ StaticSprite2D::SetFlip怎么用?C++ StaticSprite2D::SetFlip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticSprite2D
的用法示例。
在下文中一共展示了StaticSprite2D::SetFlip方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateAnimation
void AnimatedSprite2D::OnFlipChanged()
{
for (unsigned i = 0; i < numTracks_; ++i)
{
if (!trackNodes_[i])
continue;
StaticSprite2D* staticSprite = trackNodes_[i]->GetComponent<StaticSprite2D>();
staticSprite->SetFlip(flipX_, flipY_);
}
// For editor paused mode
UpdateAnimation(0.0f);
}
示例2: UpdateAnimation
void AnimatedSprite2D::SetFlip(bool flipX, bool flipY)
{
if (flipX == flipX_ && flipY == flipY_)
return;
flipX_ = flipX;
flipY_ = flipY;
for (unsigned i = 0; i < timelineNodes_.Size(); ++i)
{
if (!timelineNodes_[i])
continue;
StaticSprite2D* staticSprite = timelineNodes_[i]->GetComponent<StaticSprite2D>();
staticSprite->SetFlip(flipX_, flipY_);
}
// For editor paused mode
UpdateAnimation(0.0f);
MarkNetworkUpdate();
}
示例3: SetLoopMode
void AnimatedSprite2D::SetAnimation(Animation2D* animation, LoopMode2D loopMode)
{
if (animation == animation_)
{
SetLoopMode(loopMode_);
currentTime_ = 0.0f;
UpdateAnimation(0.0f);
return;
}
for (unsigned i = 0; i < numTracks_; ++i)
{
if (trackNodes_[i])
trackNodes_[i]->SetEnabled(false);
}
numTracks_ = 0;
trackNodes_.Clear();
trackNodeInfos_.Clear();
animation_ = animation;
if (!animation_)
return;
currentTime_ = 0.0f;
if (!rootNode_)
{
rootNode_ = GetNode()->CreateChild("_root_", LOCAL);
rootNode_->SetTemporary(true);
}
numTracks_ = animation_->GetNumTracks();
trackNodes_.Resize(numTracks_);
trackNodeInfos_.Resize(numTracks_);
for (unsigned i = 0; i < numTracks_; ++i)
{
const AnimationTrack2D& track = animation->GetTrack(i);
SharedPtr<Node> trackNode(rootNode_->GetChild(track.name_));
StaticSprite2D* staticSprite = 0;
if (trackNode)
{
// Enable track node
trackNode->SetEnabled(true);
// Get StaticSprite2D component
if (track.hasSprite_)
staticSprite = trackNode->GetComponent<StaticSprite2D>();
}
else
{
// Create new track node
trackNode = rootNode_->CreateChild(track.name_, LOCAL);
trackNode->SetTemporary(true);
// Create StaticSprite2D component
if (track.hasSprite_)
staticSprite = trackNode->CreateComponent<StaticSprite2D>();
}
if (staticSprite)
{
staticSprite->SetLayer(layer_);
staticSprite->SetBlendMode(blendMode_);
staticSprite->SetFlip(flipX_, flipY_);
staticSprite->SetUseHotSpot(true);
}
trackNodes_[i] = trackNode;
trackNodeInfos_[i].hasSprite = track.hasSprite_;
}
SetLoopMode(loopMode);
UpdateAnimation(0.0f);
MarkNetworkUpdate();
}
示例4: SetLoopMode
void AnimatedSprite2D::SetAnimation(Animation2D* animation, LoopMode2D loopMode)
{
if (animation == animation_)
{
SetLoopMode(loopMode_);
currentTime_ = 0.0f;
UpdateAnimation(0.0f);
return;
}
for (unsigned i = 0; i < timelineNodes_.Size(); ++i)
{
if (timelineNodes_[i])
timelineNodes_[i]->SetEnabled(false);
}
timelineNodes_.Clear();
animation_ = animation;
if (!animation_)
return;
currentTime_ = 0.0f;
if (!rootNode_)
{
rootNode_ = GetNode()->CreateChild("RootNode", LOCAL);
rootNode_->SetTemporary(true);
}
timelineNodes_.Resize(animation_->GetNumTimelines());
timelineTransformInfos_.Resize(animation_->GetNumTimelines());
for (unsigned i = 0; i < animation_->GetNumTimelines(); ++i)
{
const Timeline2D& timeline = animation->GetTimeline(i);
SharedPtr<Node> timelineNode(rootNode_->GetChild(timeline.name_));
StaticSprite2D* staticSprite = 0;
if (timelineNode)
{
// Enable timeline node
timelineNode->SetEnabled(true);
// Get StaticSprite2D component
if (timeline.type_ == OT_SPRITE)
staticSprite = timelineNode->GetComponent<StaticSprite2D>();
}
else
{
// Create new timeline node
timelineNode = rootNode_->CreateChild(timeline.name_, LOCAL);
// Create StaticSprite2D component
if (timeline.type_ == OT_SPRITE)
staticSprite = timelineNode->CreateComponent<StaticSprite2D>();
}
if (staticSprite)
{
staticSprite->SetLayer(layer_);
staticSprite->SetBlendMode(blendMode_);
staticSprite->SetFlip(flipX_, flipY_);
staticSprite->SetUseHotSpot(true);
}
timelineNodes_[i] = timelineNode;
timelineTransformInfos_[i].parent_ = timeline.parent_;
}
SetLoopMode(loopMode);
UpdateAnimation(0.0f);
MarkNetworkUpdate();
}