本文整理汇总了C++中AnimationData::getMovement方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationData::getMovement方法的具体用法?C++ AnimationData::getMovement怎么用?C++ AnimationData::getMovement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationData
的用法示例。
在下文中一共展示了AnimationData::getMovement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
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();
}
示例2: init
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();
}
示例3: init
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;
}
示例4: init
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);
}
}