当前位置: 首页>>代码示例>>C++>>正文


C++ Timeline::addFrame方法代码示例

本文整理汇总了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);
    }
开发者ID:1085075003,项目名称:quick-cocos2d-x,代码行数:12,代码来源:CCTimeLine.cpp

示例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;
}
开发者ID:RyunosukeOno,项目名称:rayjack,代码行数:13,代码来源:CCTimeLine.cpp

示例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;
}
开发者ID:980538137,项目名称:MyGame-QuickCocos2dx,代码行数:42,代码来源:CCActionTimelineCache.cpp

示例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;
}
开发者ID:boruis,项目名称:cocos2dx-classical,代码行数:39,代码来源:CCActionTimelineCache.cpp

示例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;
}
开发者ID:980538137,项目名称:MyGame-QuickCocos2dx,代码行数:93,代码来源:CCActionTimelineCache.cpp

示例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;
}
开发者ID:Ratel13,项目名称:cocos-reader,代码行数:78,代码来源:CCActionTimelineCache.cpp


注:本文中的Timeline::addFrame方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。