本文整理汇总了C++中AnimationFrame::getDelayUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationFrame::getDelayUnits方法的具体用法?C++ AnimationFrame::getDelayUnits怎么用?C++ AnimationFrame::getDelayUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationFrame
的用法示例。
在下文中一共展示了AnimationFrame::getDelayUnits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initWithAnimation
bool Animate::initWithAnimation(Animation *pAnimation)
{
CCASSERT( pAnimation!=NULL, "Animate: argument Animation must be non-NULL");
float singleDuration = pAnimation->getDuration();
if ( ActionInterval::initWithDuration(singleDuration * pAnimation->getLoops() ) )
{
_nextFrame = 0;
setAnimation(pAnimation);
_origFrame = NULL;
_executedLoops = 0;
_splitTimes->reserve(pAnimation->getFrames()->count());
float accumUnitsOfTime = 0;
float newUnitOfTimeValue = singleDuration / pAnimation->getTotalDelayUnits();
Array* pFrames = pAnimation->getFrames();
CCARRAY_VERIFY_TYPE(pFrames, AnimationFrame*);
Object* pObj = NULL;
CCARRAY_FOREACH(pFrames, pObj)
{
AnimationFrame* frame = static_cast<AnimationFrame*>(pObj);
float value = (accumUnitsOfTime * newUnitOfTimeValue) / singleDuration;
accumUnitsOfTime += frame->getDelayUnits();
_splitTimes->push_back(value);
}