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


C++ AnimationData类代码示例

本文整理汇总了C++中AnimationData的典型用法代码示例。如果您正苦于以下问题:C++ AnimationData类的具体用法?C++ AnimationData怎么用?C++ AnimationData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AnimationData类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: reset

	void AnimationController::reset(const AnimationData& animdata)
	{
		elapsed = 0;
		frame = 0;
		alpha = static_cast<float>(animdata.getalpha(0));
		alphastep = animdata.nextalpha(0, alpha) / (animdata.getdelay(0) / 16);
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:7,代码来源:AnimationController.cpp

示例2: AnimationData

    /** @private */
    AnimationData *XMLDataParser::parseAnimationData(const dragonBones::XMLElement *animationXML, ArmatureData *armatureData, uint frameRate)
    {
        AnimationData *animationData = new AnimationData();
        animationData->name = animationXML->Attribute(ConstValues::A_NAME.c_str());
        animationData->frameRate = frameRate;
        animationData->loop = int(animationXML->IntAttribute(ConstValues::A_LOOP.c_str()));
        animationData->setFadeInTime(Number(animationXML->DoubleAttribute(ConstValues::A_FADE_IN_TIME.c_str())));
        animationData->duration = Number(animationXML->DoubleAttribute(ConstValues::A_DURATION.c_str())) / (Number)frameRate;
        animationData->scale = Number(animationXML->DoubleAttribute(ConstValues::A_SCALE.c_str()));
        if(strcmp(animationXML->Attribute(ConstValues::A_TWEEN_EASING.c_str()) , "NaN") == 0)
        {
            animationData->tweenEasing = NaN;
        }
        else
        {
            animationData->tweenEasing = Number(animationXML->DoubleAttribute(ConstValues::A_TWEEN_EASING.c_str()));
        }

        parseTimeline(animationXML, animationData, parseMainFrame, frameRate);

        TransformTimeline *timeline = 0;
        String timelineName;
        for(const dragonBones::XMLElement* timelineXML = animationXML->FirstChildElement(ConstValues::TIMELINE.c_str()) ; timelineXML ; timelineXML = timelineXML->NextSiblingElement(ConstValues::TIMELINE.c_str()))
        {
            timeline = parseTransformTimeline(timelineXML, animationData->duration, frameRate);
            timelineName = timelineXML->Attribute(ConstValues::A_NAME.c_str());
            animationData->addTimeline(timeline, timelineName);
        }

        DBDataUtil::addHideTimeline(animationData, armatureData);
        DBDataUtil::transformAnimationData(animationData, armatureData);

        return animationData;
    }
开发者ID:114393824,项目名称:DragonBonesCPP,代码行数:35,代码来源:XMLDataParser.cpp

示例3: gettexture

	const Texture* Npcdata::gettexture(string st, uint8_t frame) const
	{
		AnimationData* anim = animations.get(st);
		if (anim)
		{
			return anim->gettexture(frame);
		}
		else
		{
			return nullptr;
		}
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:12,代码来源:Npcdata.cpp

示例4:

	vector2d<int32_t> Npcdata::getdimensions(string st, uint8_t frame) const
	{
		AnimationData* anim = animations.get(st);
		if (anim != 0)
		{
			return anim->getdimensions(frame);
		}
		else
		{
			return vector2d<int32_t>();
		}
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:12,代码来源:Npcdata.cpp

示例5: fread

bool DataLoader::loadAnimationDataList(FILE *fp) {
    int tamanhoLista;

    fread(&tamanhoLista, 1, sizeof(int), fp);

    for(int i = 0; i < tamanhoLista; i++) {
        AnimationData *animationData = new AnimationData();

        fread(&animationData->id, 1, sizeof(int), fp);

        animationData->fileName = std::string(loadString(fp));
        animationData->name = std::string(loadString(fp));

        fread(&animationData->colorkey_b, 1, sizeof(int), fp);
        fread(&animationData->colorkey_g, 1, sizeof(int), fp);
        fread(&animationData->colorkey_r, 1, sizeof(int), fp);

        fread(&animationData->frameLoop, 1, sizeof(int), fp);
        fread(&animationData->hasColorkey, 1, sizeof(bool), fp);
        fread(&animationData->hasLoop, 1, sizeof(bool), fp);
        int valor_horizontal_frame_number;
        fread(&valor_horizontal_frame_number, 1, sizeof(int), fp);
        animationData->setHorizontalFrameNumber(valor_horizontal_frame_number);
        fread(&animationData->horizontalSpacing, 1, sizeof(int), fp);
        fread(&animationData->order, 1, sizeof(int), fp);
        fread(&animationData->velocity, 1, sizeof(int), fp);
        int valor_vertical_frame_number;
        fread(&valor_vertical_frame_number, 1, sizeof(int), fp);
        animationData->setVerticalFrameNumber(valor_vertical_frame_number);
        fread(&animationData->verticalSpacing, 1, sizeof(int), fp);

        fread(&animationData->startX, 1, sizeof(int), fp);
        fread(&animationData->startY, 1, sizeof(int), fp);
        fread(&animationData->endX, 1, sizeof(int), fp);
        fread(&animationData->endY, 1, sizeof(int), fp);

        gameData->animationDataList->push_back(animationData);


    }

    return true;
}
开发者ID:slumki,项目名称:gameka-editor,代码行数:43,代码来源:dataloader.cpp

示例6:

AnimationData *ResourceManager::loadAnimationData(std::string name)
{
	// record the new reference
	this->animationDatas.addReference(name);
	
	// load if necessary
	if (this->animationDatas.getReferenceCount(name) == 1)
	{
		// try to load
		AnimationData *animationData = new AnimationData;
		if (!animationData->load(this->basePath + name))
		{
			std::cerr << "Loading of animationData '" << name << "' failed!" << std::endl;
			delete animationData;
			animationData = NULL;
		}
		
		// storage
		this->animationDatas.storeResourceObject(name, animationData);
	}
	
	return this->animationDatas.retrieveResourceObject(name);;
}
开发者ID:wsmind,项目名称:emp-impulse.testing,代码行数:23,代码来源:ResourceManager.cpp

示例7: update

	bool AnimationController::update(const AnimationData& animdata, uint16_t dpf)
	{
		if (animdata.getlastframe() > 0)
		{
			elapsed += dpf;

			alpha += alphastep;
			if (alpha < 0.f)
				alpha = 0.f;
			else if (alpha > 255.f)
				alpha = 255.f;

			uint16_t delay = animdata.getdelay(frame);
			if (elapsed > delay)
			{
				elapsed -= delay;
				frame = animdata.nextframe(frame);
				alphastep = (animdata.nextalpha(frame, alpha) * dpf) / delay;
				return frame == 0;
			}
		}
		return false;
	}
开发者ID:pandaforks,项目名称:JourneyClient,代码行数:23,代码来源:AnimationController.cpp

示例8: AnimationData

AnimationData* ObjectDataParser::parseAnimationData(Json::Value & animationObject, ArmatureData* armatureData,
		int frameRate) {
	AnimationData* animationData = new AnimationData();
	if(animationObject[ConstValues::A_NAME].isString()){
		animationData->name = animationObject[ConstValues::A_NAME].asCString();
	}else if(animationObject[ConstValues::A_NAME].isInt()){
		char temp[64];
		sprintf(temp, "%d", animationObject[ConstValues::A_NAME].asInt());
		animationData->name = temp;
	}
	animationData->frameRate = frameRate;
	animationData->loop = animationObject[ConstValues::A_LOOP].asInt();
	animationData->setFadeInTime(animationObject[ConstValues::A_FADE_IN_TIME].asDouble());
	animationData->setDuration(animationObject[ConstValues::A_DURATION].asDouble() / frameRate);
	animationData->setScale(animationObject[ConstValues::A_SCALE].asDouble());

	if (animationObject.isMember(ConstValues::A_TWEEN_EASING)) {
		float tweenEase = animationObject[ConstValues::A_TWEEN_EASING].asDouble();
		animationData->tweenEasing = tweenEase;
	}

	parseTimeline(animationObject, animationData, ObjectDataParser::parseMainFrame, frameRate);

	TransformTimeline* timeline = NULL;
	std::string timelineName;
	Json::Value & timelines = animationObject[ConstValues::TIMELINE];
	for (uint i = 0; i < timelines.size(); i++) {
		Json::Value & timelineObject = timelines[i];
		timeline = parseTransformTimeline(timelineObject, animationData->getDuration(), frameRate);
		timelineName = timelineObject[ConstValues::A_NAME].asCString();
		animationData->addTimeline(timeline, timelineName);
	}

	//DBDataUtil::addHideTimeline(animationData, armatureData);
	DBDataUtil::transformAnimationData(animationData, armatureData);

	return animationData;
}
开发者ID:ywl19891989,项目名称:DragonBones,代码行数:38,代码来源:ObjectDataParser.cpp

示例9: removeAllChildren

bool Armature::init(const char *name)
{
    bool bRet = false;
    do
    {
        removeAllChildren();

        CC_SAFE_DELETE(_animation);
        _animation = new ArmatureAnimation();
        _animation->init(this);

        CC_SAFE_DELETE(_boneDic);
        _boneDic	= new Dictionary();

        CC_SAFE_DELETE(_topBoneList);
        _topBoneList = new Array();
        _topBoneList->init();


        _blendFunc.src = CC_BLEND_SRC;
        _blendFunc.dst = CC_BLEND_DST;


        _name = name == NULL ? "" : name;

        ArmatureDataManager *armatureDataManager = ArmatureDataManager::getInstance();

        if(_name.length() != 0)
        {
            _name = name;

            AnimationData *animationData = armatureDataManager->getAnimationData(name);
            CCASSERT(animationData, "AnimationData not exist! ");

            _animation->setAnimationData(animationData);


            ArmatureData *armatureData = armatureDataManager->getArmatureData(name);
            CCASSERT(armatureData, "");

            _armatureData = armatureData;


            DictElement *_element = NULL;
            Dictionary *boneDataDic = &armatureData->boneDataDic;
            CCDICT_FOREACH(boneDataDic, _element)
            {
                Bone *bone = createBone(_element->getStrKey());

                //! init bone's  Tween to 1st movement's 1st frame
                do
                {

                    MovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
                    CC_BREAK_IF(!movData);

                    MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
                    CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);

                    FrameData *frameData = movBoneData->getFrameData(0);
                    CC_BREAK_IF(!frameData);

                    bone->getTweenData()->copy(frameData);
                    bone->changeDisplayByIndex(frameData->displayIndex, false);
                }
                while (0);
            }

            update(0);
            updateOffsetPoint();
        }
开发者ID:0x0c,项目名称:cocos2d-x,代码行数:71,代码来源:CCArmature.cpp

示例10: removeAllChildren

bool Armature::init(const std::string& name)
{
    bool bRet = false;
    do
    {
        removeAllChildren();

        CC_SAFE_DELETE(_animation);
        _animation = new ArmatureAnimation();
        _animation->init(this);

        _boneDic.clear();
        _topBoneList.clear();

        _blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;

        _name = name;

        ArmatureDataManager *armatureDataManager = ArmatureDataManager::getInstance();

        if(!_name.empty())
        {
            AnimationData *animationData = armatureDataManager->getAnimationData(name);
            CCASSERT(animationData, "AnimationData not exist! ");

            _animation->setAnimationData(animationData);


            ArmatureData *armatureData = armatureDataManager->getArmatureData(name);
            CCASSERT(armatureData, "");

            _armatureData = armatureData;

            for (auto& element : armatureData->boneDataDic)
            {
                Bone *bone = createBone(element.first.c_str());

                //! init bone's  Tween to 1st movement's 1st frame
                do
                {
                    MovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
                    CC_BREAK_IF(!movData);

                    MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
                    CC_BREAK_IF(!movBoneData || movBoneData->frameList.size() <= 0);

                    FrameData *frameData = movBoneData->getFrameData(0);
                    CC_BREAK_IF(!frameData);

                    bone->getTweenData()->copy(frameData);
                    bone->changeDisplayWithIndex(frameData->displayIndex, false);
                }
                while (0);
            }

            update(0);
            updateOffsetPoint();
        }
        else
        {
            _name = "new_armature";
            _armatureData = ArmatureData::create();
            _armatureData->name = _name;

            AnimationData *animationData = AnimationData::create();
            animationData->name = _name;

            armatureDataManager->addArmatureData(_name.c_str(), _armatureData);
            armatureDataManager->addAnimationData(_name.c_str(), animationData);

            _animation->setAnimationData(animationData);

        }

        setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));

        setCascadeOpacityEnabled(true);
        setCascadeColorEnabled(true);

        bRet = true;
    }
    while (0);

    return bRet;
}
开发者ID:2276225819,项目名称:Game,代码行数:85,代码来源:CCArmature.cpp

示例11: removeAllChildren

bool Armature::init(const char *name)
{
    bool bRet = false;
    do
    {
        //cocos2d::CCLog("Armature (%s)  create.", name);
		
		removeAllChildren();

		CC_SAFE_DELETE(m_pAnimation);
        m_pAnimation = new Animation();
		m_pAnimation->init(this);

		CC_SAFE_DELETE(m_pBoneDic);
        m_pBoneDic	= new CCDictionary();

		CC_SAFE_DELETE(m_pTopBoneList);
		m_pTopBoneList = new CCArray();
		m_pTopBoneList->init();


		m_sBlendFunc.src = CC_BLEND_SRC;
		m_sBlendFunc.dst = CC_BLEND_DST;
        

		m_strName = name == NULL ? "" : name;

        ArmatureDataManager *armatureDataManager = ArmatureDataManager::sharedArmatureDataManager();
        
        if(m_strName.compare("") != 0)
        {
            m_strName = name;
            
            AnimationData* animationData = armatureDataManager->getAnimationData(name);
            CCAssert(animationData, "AnimationData not exist! ");
            
            m_pAnimation->setAnimationData(animationData);
            
            
            ArmatureData *armatureData = armatureDataManager->getArmatureData(name);
            CCAssert(armatureData, "");
            
            m_pArmatureData = armatureData;
            
            
            CCDictElement *_element = NULL;
			CCDictionary *boneDataDic = &armatureData->boneDataDic;
            CCDICT_FOREACH(boneDataDic, _element)
            {
                Bone *bone = createBone(_element->getStrKey());
                
                //! init bone's  Tween to 1st movement's 1st frame
                do {
                    
                    MovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
                    CC_BREAK_IF(!movData);
                    
                    MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
                    CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);
                    
                    FrameData *frameData = movBoneData->getFrameData(0);
                    CC_BREAK_IF(!frameData);
                    
                    bone->getTweenData()->copy(frameData);
					bone->changeDisplayByIndex(frameData->displayIndex, false);
                } while (0);
			}
			
			update(0);
			updateOffsetPoint();
        }
开发者ID:1vs1,项目名称:quick-cocos2d-x,代码行数:71,代码来源:CSArmature.cpp

示例12: CC_SAFE_DELETE

bool Armature::init(const char *name)
{
    bool bRet = false;
    do
    {
        //cocos2d::CCLog("Armature (%s)  create.", name);

		CC_SAFE_DELETE(m_pAnimation);
        m_pAnimation = Animation::create(this);
        CCAssert(m_pAnimation, "create Armature::m_pAnimation fail!");
        m_pAnimation->retain();

		CC_SAFE_DELETE(m_pBoneDic);
        m_pBoneDic	= CCDictionary::create();
        CCAssert(m_pBoneDic, "create Armature::m_pBoneDic fail!");
        m_pBoneDic->retain();

		m_sBlendFunc.src = CC_BLEND_SRC;
		m_sBlendFunc.dst = CC_BLEND_DST;
        

		m_strName = name == NULL ? "" : name;

        ArmatureDataManager *armatureDataManager = ArmatureDataManager::sharedArmatureDataManager();
        
        if(m_strName.compare("") != 0)
        {
            m_strName = name;
            
            AnimationData* animationData = armatureDataManager->getAnimationData(name);
            CCAssert(animationData, "AnimationData not exist! ");
            
            m_pAnimation->setAnimationData(animationData);
            
            
            ArmatureData *armatureData = armatureDataManager->getArmatureData(name);
            CCAssert(armatureData, "");
            
            m_pArmatureData = armatureData;
            
            
            CCDictElement *_element = NULL;
			CCDictionary *boneDataDic = &armatureData->boneDataDic;
            CCDICT_FOREACH(boneDataDic, _element)
            {
                Bone *bone = createBone(_element->getStrKey());
                
                //! init bone's  Tween to 1st movement's 1st frame
                do {
                    
                    MovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
                    CC_BREAK_IF(!movData);
                    
                    MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
                    CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);
                    
                    FrameData *_frameData = movBoneData->getFrameData(0);
                    CC_BREAK_IF(!_frameData);
                    
                    bone->getTweenData()->copy(_frameData);
                } while (0);
            }
            
        }
开发者ID:chengstory,项目名称:CSArmature,代码行数:64,代码来源:CSArmature.cpp


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