本文整理汇总了C++中CCScale9Sprite::getActionByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScale9Sprite::getActionByTag方法的具体用法?C++ CCScale9Sprite::getActionByTag怎么用?C++ CCScale9Sprite::getActionByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScale9Sprite
的用法示例。
在下文中一共展示了CCScale9Sprite::getActionByTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setIndicator
void CAIndicator::setIndicator(const CCSize& parentSize, const CCRect& childrenFrame)
{
CCScale9Sprite* indicator = dynamic_cast<CCScale9Sprite*>(m_pIndicator);
int x = (int)indicator->getCenterOrigin().x * 10;
int y = (int)indicator->getCenterOrigin().y * 10;
if (m_eType == CAIndicatorTypeHorizontal)
{
float size_scale_x = parentSize.width / childrenFrame.size.width;
size_scale_x = MIN(size_scale_x, 1.0f);
float lenght_scale_x = parentSize.width / 2 - childrenFrame.origin.x;
lenght_scale_x /= childrenFrame.size.width;
CCSize size = m_obContentSize;
size.width *= size_scale_x;
if (lenght_scale_x < size_scale_x / 2)
{
size.width *= lenght_scale_x / (size_scale_x / 2);
}
if (1 - lenght_scale_x < size_scale_x / 2)
{
size.width *= (1 - lenght_scale_x) / (size_scale_x / 2);
}
size.width = MAX(size.height, size.width);
indicator->setPreferredSize(size);
CCPoint point = m_obContentSize;
point.y *= 0.5f;
point.x *= lenght_scale_x;
point.x = MAX(point.x, size.width/2);
point.x = MIN(point.x, m_obContentSize.width - size.width/2);
indicator->setCenterOrigin(point);
}
else if (m_eType == CAIndicatorTypeVertical)
{
float size_scale_y = parentSize.height / childrenFrame.size.height;
size_scale_y = MIN(size_scale_y, 1.0f);
float lenght_scale_y = parentSize.height / 2 - childrenFrame.origin.y;
lenght_scale_y /= childrenFrame.size.height;
CCSize size = m_obContentSize;
size.height *= size_scale_y;
if (lenght_scale_y < size_scale_y / 2)
{
size.height *= lenght_scale_y / (size_scale_y / 2);
}
if (1 - lenght_scale_y < size_scale_y / 2)
{
size.height *= (1 - lenght_scale_y) / (size_scale_y / 2);
}
size.height = MAX(size.height, size.width);
indicator->setPreferredSize(size);
CCPoint point = m_obContentSize;
point.x *= 0.5f;
point.y *= lenght_scale_y;
point.y = MAX(point.y, size.height/2);
point.y = MIN(point.y, m_obContentSize.height - size.height/2);
indicator->setCenterOrigin(point);
}
do
{
if (x == (int)indicator->getCenterOrigin().x * 10 && y == (int)indicator->getCenterOrigin().y * 10)
{
CC_BREAK_IF(indicator->getActionByTag(0xfff));
CC_BREAK_IF(indicator->getOpacity() < 255);
CCDelayTime* delayTime = CCDelayTime::create(0.2f);
CCFadeOut* fadeOut = CCFadeOut::create(0.3f);
CCEaseSineOut* easeSineOut = CCEaseSineOut::create(fadeOut);
CCSequence* actions = CCSequence::create(delayTime, easeSineOut, NULL);
actions->setTag(0xfff);
this->runAction(actions);
}
else
{
CC_BREAK_IF(indicator->getOpacity() == 255);
indicator->stopAllActions();
this->setOpacity(255);
}
}
while (0);
}