本文整理汇总了C++中CCCallFuncO::retain方法的典型用法代码示例。如果您正苦于以下问题:C++ CCCallFuncO::retain方法的具体用法?C++ CCCallFuncO::retain怎么用?C++ CCCallFuncO::retain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCCallFuncO
的用法示例。
在下文中一共展示了CCCallFuncO::retain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: animate
void Trooper::animate(const char* animationName, ...){
va_list params;
va_start(params, animationName);
const char* nextName = animationName;
if (m_current_sprite != NULL && m_animate_action != NULL){
m_current_sprite->stopAction(m_animate_action);
m_animate_action = NULL;
}
CCArray* animations = CCArray::array();
while (nextName){
CCAnimation* anim = TFAnimationCache::sharedAnimationCache()->animationByName(nextName);
if (m_current_sprite == NULL){
m_current_sprite = CCSprite::spriteWithSpriteFrame(anim->getFrames()->getObjectAtIndex(0));
this->addChild(m_current_sprite);
}
CCCallFuncO* notifyAction = CCCallFuncO::actionWithTarget(this, callfuncO_selector(Trooper::onAnimationStart), new CCString(nextName));
animations->addObject(notifyAction);
nextName = va_arg(params, const char*);
if (nextName == NULL){
CCCallFuncO* animAction = CCCallFuncO::actionWithTarget(this, callfuncO_selector(Trooper::animateForever), anim);
animations->addObject(animAction);
animAction->retain();
} else {
animations->addObject(CCAnimate::actionWithAnimation(anim));
}
notifyAction->retain();
}
m_current_sprite->runAction(CCSequence::actionsWithArray(animations));
va_end(params);
animations->retain();
}