Merge pull request #1869 from minggo/iss1639_CCBReader

fixed #1639:add CCBEaseInstant
This commit is contained in:
minggo 2013-01-20 19:19:26 -08:00
commit e2bf772997
2 changed files with 46 additions and 1 deletions

View File

@ -458,10 +458,14 @@ void CCBAnimationManager::setFirstFrame(CCNode *pNode, CCBSequenceProperty *pSeq
CCActionInterval* CCBAnimationManager::getEaseAction(CCActionInterval *pAction, int nEasingType, float fEasingOpt)
{
if (nEasingType == kCCBKeyframeEasingLinear || nEasingType == kCCBKeyframeEasingInstant)
if (nEasingType == kCCBKeyframeEasingLinear)
{
return pAction;
}
else if (nEasingType == kCCBKeyframeEasingInstant)
{
return CCBEaseInstant::create(pAction);
}
else if (nEasingType == kCCBKeyframeEasingCubicIn)
{
return CCEaseIn::create(pAction, fEasingOpt);
@ -689,6 +693,8 @@ void CCBAnimationManager::sequenceCompleted()
}
}
// Custom actions
/************************************************************
CCBSetSpriteFrame
************************************************************/
@ -814,4 +820,35 @@ void CCBRotateTo::update(float time)
;
}
/************************************************************
CCBEaseInstant
************************************************************/
CCBEaseInstant* CCBEaseInstant::create(CCActionInterval *pAction)
{
CCBEaseInstant *pRet = new CCBEaseInstant();
if (pRet && pRet->initWithAction(pAction))
{
pRet->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(pRet);
}
return pRet;
}
void CCBEaseInstant::update(float dt)
{
if (dt < 0)
{
m_pInner->update(0);
}
else
{
m_pInner->update(1);
}
}
NS_CC_EXT_END

View File

@ -143,6 +143,14 @@ public:
virtual void startWithTarget(CCNode *pNode);
};
class CCBEaseInstant : public CCActionEase
{
public:
static CCBEaseInstant* create(CCActionInterval *pAction);
virtual void update(float dt);
};
NS_CC_EXT_END
#endif // __CCB_CCBANIMATION_MANAGER_H__