本文整理汇总了C++中ActionFrame::getFrameIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionFrame::getFrameIndex方法的具体用法?C++ ActionFrame::getFrameIndex怎么用?C++ ActionFrame::getFrameIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionFrame
的用法示例。
在下文中一共展示了ActionFrame::getFrameIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUnitTime
CCSpawn * ActionNode::refreshActionProperty()
{
if ( m_Object == NULL )
{
return NULL;
}
CCArray* cSpawnArray = CCArray::create();
for (int n = 0; n < frameArrayNum; n++)
{
CCArray* cArray = (CCArray*)(m_FrameArray->objectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
CCArray* cSequenceArray = CCArray::create();
int frameCount = cArray->count();
for (int i = 0; i < frameCount; i++)
{
ActionFrame* frame = (ActionFrame*)(cArray->objectAtIndex(i));
if (i == 0)
{
CCAction* cAction = frame->getAction(0);
cSequenceArray->addObject(cAction);
}
else
{
ActionFrame* srcFrame = (ActionFrame*)(cArray->objectAtIndex(i-1));
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex()) * getUnitTime();
CCAction* cAction = frame->getAction(duration,srcFrame);
cSequenceArray->addObject(cAction);
}
}
CCSequence* cSequence = CCSequence::create(cSequenceArray);
if (cSequence != NULL)
{
cSpawnArray->addObject(cSequence);
}
}
if (m_action == NULL)
{
CC_SAFE_RELEASE_NULL(m_actionSpawn);
}
else
{
CC_SAFE_RELEASE_NULL(m_action);
}
m_actionSpawn = CCSpawn::create(cSpawnArray);
CC_SAFE_RETAIN(m_actionSpawn);
return m_actionSpawn;
}
示例2: updateActionToTimeLine
bool ActionNode::updateActionToTimeLine(float fTime)
{
bool bFindFrame = false;
ActionFrame* srcFrame = NULL;
ActionFrame* destFrame = NULL;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL)
{
continue;
}
int frameCount = cArray->count();
for (int i = 0; i < frameCount; i++)
{
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(i));
if (frame->getFrameIndex()*getUnitTime() == fTime)
{
this->easingToFrame(1.0f,1.0f,frame);
bFindFrame = true;
break;
}
else if (frame->getFrameIndex()*getUnitTime() > fTime)
{
if (i == 0)
{
this->easingToFrame(1.0f,1.0f,frame);
bFindFrame = false;
}
else
{
srcFrame = (ActionFrame*)(cArray->getObjectAtIndex(i-1));
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex())*getUnitTime();
float delaytime = fTime - srcFrame->getFrameIndex()*getUnitTime();
this->easingToFrame(duration,1.0f,srcFrame);
//float easingTime = ActionFrameEasing::bounceTime(delaytime);
this->easingToFrame(duration,delaytime/duration,frame);
bFindFrame = true;
}
break;
}
}
}
return bFindFrame;
}
示例3: updateActionToTimeLine
bool ActionNode::updateActionToTimeLine(float fTime)
{
bool bFindFrame = false;
ActionFrame* srcFrame = nullptr;
// ActionFrame* destFrame = nullptr;
for (int n = 0; n < _frameArrayNum; n++)
{
auto cArray = _frameArray.at(n);
if (cArray->empty())
{
continue;
}
ssize_t frameCount = cArray->size();
for (int i = 0; i < frameCount; i++)
{
auto frame = cArray->at(i);
if (frame->getFrameIndex()*getUnitTime() == fTime)
{
this->easingToFrame(1.0f,1.0f,nullptr,frame);
bFindFrame = true;
break;
}
else if (frame->getFrameIndex()*getUnitTime() > fTime)
{
if (i == 0)
{
this->easingToFrame(1.0f,1.0f,nullptr,frame);
bFindFrame = false;
}
else
{
srcFrame = cArray->at(i-1);
float duration = (frame->getFrameIndex() - srcFrame->getFrameIndex())*getUnitTime();
float delaytime = fTime - srcFrame->getFrameIndex()*getUnitTime();
this->easingToFrame(duration,1.0f,nullptr,srcFrame);
//float easingTime = ActionFrameEasing::bounceTime(delaytime);
this->easingToFrame(duration,delaytime/duration,srcFrame,frame);
bFindFrame = true;
}
break;
}
}
}
return bFindFrame;
}
示例4: getLastFrameIndex
int ActionNode::getLastFrameIndex()
{
int frameindex = -1;
bool bFindFrame = false;
for (int n = 0; n < frameArrayNum; n++)
{
CCArray* cArray = (CCArray*)(m_FrameArray->objectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
bFindFrame = true;
int lastInex = cArray->count() - 1;
ActionFrame* frame = (ActionFrame*)(cArray->objectAtIndex(lastInex));
int iFrameIndex = frame->getFrameIndex();
if (frameindex < iFrameIndex)
{
frameindex = iFrameIndex;
}
}
if (!bFindFrame)
{
frameindex = 0;
}
return frameindex;
}
示例5: getFirstFrameIndex
int ActionNode::getFirstFrameIndex()
{
int frameindex = 99999;
bool bFindFrame = false;
for (int n = 0; n < _frameArrayNum; n++)
{
Array* cArray = (Array*)(_frameArray->getObjectAtIndex(n));
if (cArray == NULL || cArray->count() <= 0)
{
continue;
}
bFindFrame = true;
ActionFrame* frame = (ActionFrame*)(cArray->getObjectAtIndex(0));
int iFrameIndex = frame->getFrameIndex();
if (frameindex > iFrameIndex)
{
frameindex = iFrameIndex;
}
}
if (!bFindFrame)
{
frameindex = 0;
}
return frameindex;
}