本文整理汇总了C++中Timeline::addFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ Timeline::addFrame方法的具体用法?C++ Timeline::addFrame怎么用?C++ Timeline::addFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timeline
的用法示例。
在下文中一共展示了Timeline::addFrame方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clone
Timeline* Timeline::clone()
{
Timeline* timeline = Timeline::create();
timeline->_actionTag = _actionTag;
CCObject* object = NULL;
CCARRAY_FOREACH(_frames, object)
{
Frame* frame = static_cast<Frame*>(object);
Frame* newFrame = frame->clone();
timeline->addFrame(newFrame);
}
示例2: clone
Timeline* Timeline::clone()
{
Timeline* timeline = Timeline::create();
timeline->_actionTag = _actionTag;
for (auto frame : _frames)
{
Frame* newFrame = frame->clone();
timeline->addFrame(newFrame);
}
return timeline;
}
示例3: loadTimeline
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
{
Timeline* timeline = nullptr;
// get frame type
const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE);
if(frameType == nullptr)
return nullptr;
if(frameType && _funcs.find(frameType) != _funcs.end())
{
timeline = Timeline::create();
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
timeline->setActionTag(actionTag);
FrameCreateFunc func = _funcs.at(frameType);
int length = DICTOOL->getArrayCount_json(json, FRAMES);
for (int i = 0; i<length; i++)
{
const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, FRAMES, i);
Frame* frame = nullptr;
if (func != nullptr)
{
frame = func(dic);
int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX);
frame->setFrameIndex(frameIndex);
bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false);
frame->setTween(tween);
}
timeline->addFrame(frame);
}
}
return timeline;
}
示例4: loadTimeline
Timeline* ActionTimelineCache::loadTimeline(const rapidjson::Value& json)
{
Timeline* timeline = NULL;
// get frame type
const char* frameType = DICTOOL->getStringValue_json(json, FRAME_TYPE);
if(frameType == NULL)
return NULL;
FrameCreateCallFunc* func = static_cast<FrameCreateCallFunc*>(_funcs->objectForKey(frameType));
if(frameType && func)
{
timeline = Timeline::create();
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
timeline->setActionTag(actionTag);
int length = DICTOOL->getArrayCount_json(json, FRAMES);
for (int i = 0; i<length; i++)
{
const rapidjson::Value& dic = DICTOOL->getSubDictionary_json(json, FRAMES, i);
Frame* frame = NULL;
frame = func->excute(dic);
int frameIndex = DICTOOL->getIntValue_json(dic, FRAME_INDEX);
frame->setFrameIndex(frameIndex);
bool tween = DICTOOL->getBooleanValue_json(dic, TWEEN, false);
frame->setTween(tween);
timeline->addFrame(frame);
}
}
return timeline;
}
示例5: loadTimelineWithFlatBuffers
Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::TimeLine *flatbuffers)
{
Timeline* timeline = nullptr;
// property
std::string property = flatbuffers->property()->c_str();
if(property == "")
return nullptr;
CCLOG("property = %s", property.c_str());
if(property != "")
{
timeline = Timeline::create();
int actionTag = flatbuffers->actionTag();
timeline->setActionTag(actionTag);
auto framesFlatbuf = flatbuffers->frames();
int length = framesFlatbuf->size();
for (int i = 0; i < length; i++)
{
auto frameFlatbuf = framesFlatbuf->Get(i);
Frame* frame = nullptr;
if (property == Property_VisibleForFrame)
{
auto boolFrame = frameFlatbuf->boolFrame();
frame = loadVisibleFrameWithFlatBuffers(boolFrame);
}
else if (property == Property_Position)
{
auto potisionFrame = frameFlatbuf->pointFrame();
frame = loadPositionFrameWithFlatBuffers(potisionFrame);
}
else if (property == Property_Scale)
{
auto scaleFrame = frameFlatbuf->scaleFrame();
frame = loadScaleFrameWithFlatBuffers(scaleFrame);
}
else if (property == Property_RotationSkew)
{
auto scaleFrame = frameFlatbuf->scaleFrame();
frame = loadRotationSkewFrameWithFlatBuffers(scaleFrame);
}
else if (property == Property_CColor)
{
auto colorFrame = frameFlatbuf->colorFrame();
frame = loadColorFrameWithFlatBuffers(colorFrame);
}
else if (property == Property_FrameEvent)
{
auto eventFrame = frameFlatbuf->eventFrame();
frame = loadEventFrameWithFlatBuffers(eventFrame);
}
else if (property == Property_FileData)
{
auto textureFrame = frameFlatbuf->textureFrame();
frame = loadTextureFrameWithFlatBuffers(textureFrame);
}
else if (property == Property_Alpha)
{
auto intFrame = frameFlatbuf->intFrame();
frame = loadAlphaFrameWithFlatBuffers(intFrame);
}
else if (property == Property_AnchorPoint)
{
auto scaleFrame = frameFlatbuf->scaleFrame();
frame = loadAnchorPointFrameWithFlatBuffers(scaleFrame);
}
else if (property == Property_ZOrder)
{
auto intFrame = frameFlatbuf->intFrame();
frame = loadZOrderFrameWithFlatBuffers(intFrame);
}
else if (property == Property_ActionValue)
{
auto innerActionFrame = frameFlatbuf->innerActionFrame();
frame = loadInnerActionFrameWithFlatBuffers(innerActionFrame);
}
if (!frame)
{
CCLOG("frame is invalid.");
continue;
}
timeline->addFrame(frame);
}
}
return timeline;
}
示例6: loadTimelineWithFlatBuffers
Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::TimeLine *flatbuffers)
{
Timeline* timeline = nullptr;
// get frame type
std::string frameType = flatbuffers->frameType()->c_str();
if(frameType == "")
return nullptr;
CCLOG("frameType = %s", frameType.c_str());
if(frameType != "")
{
timeline = Timeline::create();
int actionTag = flatbuffers->actionTag();
timeline->setActionTag(actionTag);
auto framesFlatbuf = flatbuffers->frames();
int length = framesFlatbuf->size();
for (int i = 0; i < length; i++)
{
auto frameFlatbuf = framesFlatbuf->Get(i);
Frame* frame = nullptr;
if (frameType == FrameType_VisibleFrame)
{
auto visibleFrame = frameFlatbuf->visibleFrame();
frame = loadVisibleFrameWithFlatBuffers(visibleFrame);
}
else if (frameType == FrameType_ZOrderFrame)
{
auto zOrderFrame = frameFlatbuf->zOrderFrame();
frame = loadZOrderFrameWithFlatBuffers(zOrderFrame);
}
else if (frameType == FrameType_RotationSkewFrame)
{
auto rotationSkewFrame = frameFlatbuf->rotationSkewFrame();
frame = loadRotationSkewFrameWithFlatBuffers(rotationSkewFrame);
}
else if (frameType == FrameType_EventFrame)
{
auto eventFrame = frameFlatbuf->eventFrame();
frame = loadEventFrameWithFlatBuffers(eventFrame);
}
else if (frameType == FrameType_AnchorFrame)
{
auto anchorPointFrame = frameFlatbuf->anchorPointFrame();
frame = loadAnchorPointFrameWithFlatBuffers(anchorPointFrame);
}
else if (frameType == FrameType_PositionFrame)
{
auto potisionFrame = frameFlatbuf->positionFrame();
frame = loadPositionFrameWithFlatBuffers(potisionFrame);
}
else if (frameType == FrameType_ScaleFrame)
{
auto scaleFrame = frameFlatbuf->scaleFrame();
frame = loadScaleFrameWithFlatBuffers(scaleFrame);
}
else if (frameType == FrameType_ColorFrame)
{
auto colorFrame = frameFlatbuf->colorFrame();
frame = loadColorFrameWithFlatBuffers(colorFrame);
}
else if (frameType == FrameType_TextureFrame)
{
auto textureFrame = frameFlatbuf->textureFrame();
frame = loadTextureFrameWithFlatBuffers(textureFrame);
}
timeline->addFrame(frame);
}
}
return timeline;
}