mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/2youyouo2/cocos2d-x into develop
Conflicts: extensions/CocoStudio/Armature/CCArmature.h extensions/CocoStudio/Armature/CCBone.h extensions/CocoStudio/Armature/animation/CCArmatureAnimation.h extensions/CocoStudio/Armature/animation/CCProcessBase.h extensions/CocoStudio/Armature/animation/CCTween.h extensions/CocoStudio/Armature/datas/CCDatas.h extensions/CocoStudio/Armature/display/CCDecorativeDisplay.h extensions/CocoStudio/Armature/display/CCDisplayManager.h extensions/CocoStudio/Armature/external_tool/CCTexture2DMutable.h extensions/CocoStudio/Armature/physics/CCColliderDetector.h extensions/CocoStudio/Armature/physics/CCPhysicsWorld.h extensions/CocoStudio/Armature/utils/CCArmatureDataManager.h extensions/CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.h
This commit is contained in:
commit
5e1f91d396
|
@ -1 +1 @@
|
|||
cee239faffacb79c42a315cc01d4bce887435f5b
|
||||
f8c6e5c68d06d713a92aea4ef3398cb8a3476c17
|
|
@ -29,13 +29,20 @@ THE SOFTWARE.
|
|||
#include "datas/CCDatas.h"
|
||||
#include "display/CCSkin.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
#include "Box2D/Box2D.h"
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
#include "chipmunk.h"
|
||||
#endif
|
||||
|
||||
std::map<int, Armature *> Armature::_armatureIndexDic;
|
||||
|
||||
Armature *Armature::create()
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
std::map<int, CCArmature *> CCArmature::m_sArmatureIndexDic;
|
||||
|
||||
CCArmature *CCArmature::create()
|
||||
{
|
||||
Armature *armature = new Armature();
|
||||
CCArmature *armature = new CCArmature();
|
||||
if (armature && armature->init())
|
||||
{
|
||||
armature->autorelease();
|
||||
|
@ -46,10 +53,10 @@ Armature *Armature::create()
|
|||
}
|
||||
|
||||
|
||||
Armature *Armature::create(const char *_name)
|
||||
CCArmature *CCArmature::create(const char *name)
|
||||
{
|
||||
Armature *armature = new Armature();
|
||||
if (armature && armature->init(_name))
|
||||
CCArmature *armature = new CCArmature();
|
||||
if (armature && armature->init(name))
|
||||
{
|
||||
armature->autorelease();
|
||||
return armature;
|
||||
|
@ -58,9 +65,9 @@ Armature *Armature::create(const char *_name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Armature *Armature::create(const char *name, Bone *parentBone)
|
||||
CCArmature *CCArmature::create(const char *name, CCBone *parentBone)
|
||||
{
|
||||
Armature *armature = new Armature();
|
||||
CCArmature *armature = new CCArmature();
|
||||
if (armature && armature->init(name, parentBone))
|
||||
{
|
||||
armature->autorelease();
|
||||
|
@ -70,100 +77,101 @@ Armature *Armature::create(const char *name, Bone *parentBone)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Armature::Armature()
|
||||
: _animation(NULL)
|
||||
, _armatureData(NULL)
|
||||
, _batchNode(NULL)
|
||||
, _atlas(NULL)
|
||||
, _parentBone(NULL)
|
||||
, _boneDic(NULL)
|
||||
, _topBoneList(NULL)
|
||||
CCArmature::CCArmature()
|
||||
: m_pArmatureData(NULL)
|
||||
, m_pBatchNode(NULL)
|
||||
, m_pAtlas(NULL)
|
||||
, m_pParentBone(NULL)
|
||||
, m_bArmatureTransformDirty(true)
|
||||
, m_pBoneDic(NULL)
|
||||
, m_pTopBoneList(NULL)
|
||||
, m_pAnimation(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Armature::~Armature(void)
|
||||
CCArmature::~CCArmature(void)
|
||||
{
|
||||
CCLOGINFO("deallocing Armature: %p", this);
|
||||
|
||||
if(NULL != _boneDic)
|
||||
if(NULL != m_pBoneDic)
|
||||
{
|
||||
_boneDic->removeAllObjects();
|
||||
CC_SAFE_RELEASE(_boneDic);
|
||||
m_pBoneDic->removeAllObjects();
|
||||
CC_SAFE_DELETE(m_pBoneDic);
|
||||
}
|
||||
if (NULL != _topBoneList)
|
||||
if (NULL != m_pTopBoneList)
|
||||
{
|
||||
_topBoneList->removeAllObjects();
|
||||
CC_SAFE_DELETE(_topBoneList);
|
||||
m_pTopBoneList->removeAllObjects();
|
||||
CC_SAFE_DELETE(m_pTopBoneList);
|
||||
}
|
||||
CC_SAFE_DELETE(_animation);
|
||||
CC_SAFE_DELETE(m_pAnimation);
|
||||
}
|
||||
|
||||
|
||||
bool Armature::init()
|
||||
bool CCArmature::init()
|
||||
{
|
||||
return init(NULL);
|
||||
}
|
||||
|
||||
|
||||
bool Armature::init(const char *name)
|
||||
bool CCArmature::init(const char *name)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
removeAllChildren();
|
||||
|
||||
CC_SAFE_DELETE(_animation);
|
||||
_animation = new ArmatureAnimation();
|
||||
_animation->init(this);
|
||||
CC_SAFE_DELETE(m_pAnimation);
|
||||
m_pAnimation = new CCArmatureAnimation();
|
||||
m_pAnimation->init(this);
|
||||
|
||||
CC_SAFE_RELEASE(_boneDic);
|
||||
_boneDic = new Dictionary();
|
||||
_boneDic->init();
|
||||
CC_SAFE_DELETE(m_pBoneDic);
|
||||
m_pBoneDic = new Dictionary();
|
||||
|
||||
CC_SAFE_DELETE(_topBoneList);
|
||||
_topBoneList = Array::create();
|
||||
_topBoneList->retain();
|
||||
CC_SAFE_DELETE(m_pTopBoneList);
|
||||
m_pTopBoneList = new Array();
|
||||
m_pTopBoneList->init();
|
||||
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
|
||||
_name = name == NULL ? "" : name;
|
||||
m_sBlendFunc.src = CC_BLEND_SRC;
|
||||
m_sBlendFunc.dst = CC_BLEND_DST;
|
||||
|
||||
ArmatureDataManager *armatureDataManager = ArmatureDataManager::sharedArmatureDataManager();
|
||||
|
||||
if(_name.length() != 0)
|
||||
m_strName = name == NULL ? "" : name;
|
||||
|
||||
CCArmatureDataManager *armatureDataManager = CCArmatureDataManager::sharedArmatureDataManager();
|
||||
|
||||
if(m_strName.length() != 0)
|
||||
{
|
||||
_name = name;
|
||||
m_strName = name;
|
||||
|
||||
AnimationData *animationData = armatureDataManager->getAnimationData(name);
|
||||
CCASSERT(animationData, "CCAnimationData not exist! ");
|
||||
CCAnimationData *animationData = armatureDataManager->getAnimationData(name);
|
||||
CCAssert(animationData, "CCAnimationData not exist! ");
|
||||
|
||||
_animation->setAnimationData(animationData);
|
||||
m_pAnimation->setAnimationData(animationData);
|
||||
|
||||
|
||||
ArmatureData *armatureData = armatureDataManager->getArmatureData(name);
|
||||
CCASSERT(armatureData, "");
|
||||
CCArmatureData *armatureData = armatureDataManager->getArmatureData(name);
|
||||
CCAssert(armatureData, "");
|
||||
|
||||
_armatureData = armatureData;
|
||||
m_pArmatureData = armatureData;
|
||||
|
||||
|
||||
DictElement *_element = NULL;
|
||||
Dictionary *boneDataDic = armatureData->boneDataDic;
|
||||
Dictionary *boneDataDic = &armatureData->boneDataDic;
|
||||
CCDICT_FOREACH(boneDataDic, _element)
|
||||
{
|
||||
Bone *bone = createBone(_element->getStrKey());
|
||||
CCBone *bone = createBone(_element->getStrKey());
|
||||
|
||||
//! init bone's Tween to 1st movement's 1st frame
|
||||
//! init bone's CCTween to 1st movement's 1st frame
|
||||
do
|
||||
{
|
||||
|
||||
MovementData *movData = animationData->getMovement(animationData->movementNames.at(0).c_str());
|
||||
CCMovementData *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);
|
||||
CCMovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
|
||||
CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);
|
||||
|
||||
FrameData *frameData = movBoneData->getFrameData(0);
|
||||
CCFrameData *frameData = movBoneData->getFrameData(0);
|
||||
CC_BREAK_IF(!frameData);
|
||||
|
||||
bone->getTweenData()->copy(frameData);
|
||||
|
@ -177,21 +185,21 @@ bool Armature::init(const char *name)
|
|||
}
|
||||
else
|
||||
{
|
||||
_name = "new_armature";
|
||||
_armatureData = ArmatureData::create();
|
||||
_armatureData->name = _name;
|
||||
m_strName = "new_armature";
|
||||
m_pArmatureData = CCArmatureData::create();
|
||||
m_pArmatureData->name = m_strName;
|
||||
|
||||
AnimationData *animationData = AnimationData::create();
|
||||
animationData->name = _name;
|
||||
CCAnimationData *animationData = CCAnimationData::create();
|
||||
animationData->name = m_strName;
|
||||
|
||||
armatureDataManager->addArmatureData(_name.c_str(), _armatureData);
|
||||
armatureDataManager->addAnimationData(_name.c_str(), animationData);
|
||||
armatureDataManager->addArmatureData(m_strName.c_str(), m_pArmatureData);
|
||||
armatureDataManager->addAnimationData(m_strName.c_str(), animationData);
|
||||
|
||||
_animation->setAnimationData(animationData);
|
||||
m_pAnimation->setAnimationData(animationData);
|
||||
|
||||
}
|
||||
|
||||
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
setShaderProgram(CCShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
|
||||
unscheduleUpdate();
|
||||
scheduleUpdate();
|
||||
|
@ -206,33 +214,33 @@ bool Armature::init(const char *name)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
bool Armature::init(const char *name, Bone *parentBone)
|
||||
bool CCArmature::init(const char *name, CCBone *parentBone)
|
||||
{
|
||||
_parentBone = parentBone;
|
||||
m_pParentBone = parentBone;
|
||||
return init(name);
|
||||
}
|
||||
|
||||
|
||||
Bone *Armature::createBone(const char *boneName)
|
||||
CCBone *CCArmature::createBone(const char *boneName)
|
||||
{
|
||||
Bone *existedBone = getBone(boneName);
|
||||
CCBone *existedBone = getBone(boneName);
|
||||
if(existedBone != NULL)
|
||||
return existedBone;
|
||||
|
||||
BoneData *boneData = (BoneData *)_armatureData->getBoneData(boneName);
|
||||
CCBoneData *boneData = (CCBoneData *)m_pArmatureData->getBoneData(boneName);
|
||||
std::string parentName = boneData->parentName;
|
||||
|
||||
Bone *bone = NULL;
|
||||
CCBone *bone = NULL;
|
||||
|
||||
if( parentName.length() != 0 )
|
||||
{
|
||||
createBone(parentName.c_str());
|
||||
bone = Bone::create(boneName);
|
||||
bone = CCBone::create(boneName);
|
||||
addBone(bone, parentName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
bone = Bone::create(boneName);
|
||||
bone = CCBone::create(boneName);
|
||||
addBone(bone, "");
|
||||
}
|
||||
|
||||
|
@ -243,90 +251,103 @@ Bone *Armature::createBone(const char *boneName)
|
|||
}
|
||||
|
||||
|
||||
void Armature::addBone(Bone *bone, const char *parentName)
|
||||
void CCArmature::addBone(CCBone *bone, const char *parentName)
|
||||
{
|
||||
CCASSERT( bone != NULL, "Argument must be non-nil");
|
||||
CCASSERT(_boneDic->objectForKey(bone->getName()) == NULL, "bone already added. It can't be added again");
|
||||
CCAssert( bone != NULL, "Argument must be non-nil");
|
||||
CCAssert(m_pBoneDic->objectForKey(bone->getName()) == NULL, "bone already added. It can't be added again");
|
||||
|
||||
if (NULL != parentName)
|
||||
{
|
||||
Bone *boneParent = (Bone *)_boneDic->objectForKey(parentName);
|
||||
CCBone *boneParent = (CCBone *)m_pBoneDic->objectForKey(parentName);
|
||||
if (boneParent)
|
||||
{
|
||||
boneParent->addChildBone(bone);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_parentBone)
|
||||
_parentBone->addChildBone(bone);
|
||||
if (m_pParentBone)
|
||||
m_pParentBone->addChildBone(bone);
|
||||
else
|
||||
_topBoneList->addObject(bone);
|
||||
m_pTopBoneList->addObject(bone);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_parentBone)
|
||||
_parentBone->addChildBone(bone);
|
||||
if (m_pParentBone)
|
||||
m_pParentBone->addChildBone(bone);
|
||||
else
|
||||
_topBoneList->addObject(bone);
|
||||
m_pTopBoneList->addObject(bone);
|
||||
}
|
||||
|
||||
bone->setArmature(this);
|
||||
|
||||
_boneDic->setObject(bone, bone->getName());
|
||||
m_pBoneDic->setObject(bone, bone->getName());
|
||||
addChild(bone);
|
||||
}
|
||||
|
||||
|
||||
void Armature::removeBone(Bone *bone, bool recursion)
|
||||
void CCArmature::removeBone(CCBone *bone, bool recursion)
|
||||
{
|
||||
CCASSERT(bone != NULL, "bone must be added to the bone dictionary!");
|
||||
CCAssert(bone != NULL, "bone must be added to the bone dictionary!");
|
||||
|
||||
bone->setArmature(NULL);
|
||||
bone->removeFromParent(recursion);
|
||||
|
||||
if (_topBoneList->containsObject(bone))
|
||||
if (m_pTopBoneList->containsObject(bone))
|
||||
{
|
||||
_topBoneList->removeObject(bone);
|
||||
m_pTopBoneList->removeObject(bone);
|
||||
}
|
||||
_boneDic->removeObjectForKey(bone->getName());
|
||||
m_pBoneDic->removeObjectForKey(bone->getName());
|
||||
removeChild(bone, true);
|
||||
}
|
||||
|
||||
|
||||
Bone *Armature::getBone(const char *_name) const
|
||||
CCBone *CCArmature::getBone(const char *name) const
|
||||
{
|
||||
return (Bone *)_boneDic->objectForKey(_name);
|
||||
return (CCBone *)m_pBoneDic->objectForKey(name);
|
||||
}
|
||||
|
||||
|
||||
void Armature::changeBoneParent(Bone *bone, const char *parentName)
|
||||
void CCArmature::changeBoneParent(CCBone *bone, const char *parentName)
|
||||
{
|
||||
CCASSERT(bone != NULL, "bone must be added to the bone dictionary!");
|
||||
CCAssert(bone != NULL, "bone must be added to the bone dictionary!");
|
||||
|
||||
bone->getParentBone()->getChildren()->removeObject(bone);
|
||||
bone->setParentBone(NULL);
|
||||
if(bone->getParentBone())
|
||||
{
|
||||
bone->getParentBone()->getChildren()->removeObject(bone);
|
||||
bone->setParentBone(NULL);
|
||||
}
|
||||
|
||||
if (parentName != NULL)
|
||||
{
|
||||
Bone *boneParent = (Bone *)_boneDic->objectForKey(parentName);
|
||||
CCBone *boneParent = (CCBone *)m_pBoneDic->objectForKey(parentName);
|
||||
|
||||
if (boneParent)
|
||||
{
|
||||
boneParent->addChildBone(bone);
|
||||
if (m_pTopBoneList->containsObject(bone))
|
||||
{
|
||||
m_pTopBoneList->removeObject(bone);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pTopBoneList->addObject(bone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary *Armature::getBoneDic()
|
||||
Dictionary *CCArmature::getBoneDic()
|
||||
{
|
||||
return _boneDic;
|
||||
return m_pBoneDic;
|
||||
}
|
||||
|
||||
const AffineTransform& Armature::getNodeToParentTransform() const
|
||||
const AffineTransform& CCArmature::getNodeToParentTransform() const
|
||||
{
|
||||
if (_transformDirty)
|
||||
{
|
||||
m_bArmatureTransformDirty = true;
|
||||
|
||||
// Translate values
|
||||
float x = _position.x;
|
||||
float y = _position.y;
|
||||
|
@ -352,8 +373,8 @@ const AffineTransform& Armature::getNodeToParentTransform() const
|
|||
}
|
||||
|
||||
// Add offset point
|
||||
x += cy * _offsetPoint.x * _scaleX + -sx * _offsetPoint.y * _scaleY;
|
||||
y += sy * _offsetPoint.x * _scaleX + cx * _offsetPoint.y * _scaleY;
|
||||
x += cy * m_pOffsetPoint.x * _scaleX + -sx * m_pOffsetPoint.y * _scaleY;
|
||||
y += sy * m_pOffsetPoint.x * _scaleX + cx * m_pOffsetPoint.y * _scaleY;
|
||||
|
||||
bool needsSkewMatrix = ( _skewX || _skewY );
|
||||
|
||||
|
@ -401,100 +422,192 @@ const AffineTransform& Armature::getNodeToParentTransform() const
|
|||
return _transform;
|
||||
}
|
||||
|
||||
void Armature::updateOffsetPoint()
|
||||
void CCArmature::updateOffsetPoint()
|
||||
{
|
||||
// Set contentsize and Calculate anchor point.
|
||||
Rect rect = getBoundingBox();
|
||||
Rect rect = boundingBox();
|
||||
setContentSize(rect.size);
|
||||
_offsetPoint = Point(-rect.origin.x, -rect.origin.y);
|
||||
setAnchorPoint(Point(_offsetPoint.x / rect.size.width, _offsetPoint.y / rect.size.height));
|
||||
}
|
||||
|
||||
|
||||
void Armature::update(float dt)
|
||||
{
|
||||
_animation->update(dt);
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_topBoneList, object)
|
||||
m_pOffsetPoint = Point(-rect.origin.x, -rect.origin.y);
|
||||
if (rect.size.width != 0 && rect.size.height != 0)
|
||||
{
|
||||
static_cast<Bone*>(object)->update(dt);
|
||||
setAnchorPoint(Point(m_pOffsetPoint.x / rect.size.width, m_pOffsetPoint.y / rect.size.height));
|
||||
}
|
||||
}
|
||||
|
||||
void Armature::draw()
|
||||
void CCArmature::setAnimation(CCArmatureAnimation *animation)
|
||||
{
|
||||
if (_parentBone == NULL)
|
||||
m_pAnimation = animation;
|
||||
}
|
||||
|
||||
CCArmatureAnimation *CCArmature::getAnimation()
|
||||
{
|
||||
return m_pAnimation;
|
||||
}
|
||||
|
||||
bool CCArmature::getArmatureTransformDirty()
|
||||
{
|
||||
return m_bArmatureTransformDirty;
|
||||
}
|
||||
|
||||
void CCArmature::update(float dt)
|
||||
{
|
||||
m_pAnimation->update(dt);
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pTopBoneList, object)
|
||||
{
|
||||
((CCBone *)object)->update(dt);
|
||||
}
|
||||
|
||||
m_bArmatureTransformDirty = false;
|
||||
}
|
||||
|
||||
void CCArmature::draw()
|
||||
{
|
||||
if (m_pParentBone == NULL)
|
||||
{
|
||||
CC_NODE_DRAW_SETUP();
|
||||
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
|
||||
GL::blendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
|
||||
}
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Bone *bone = static_cast<Bone *>(object);
|
||||
|
||||
DisplayManager *displayManager = bone->getDisplayManager();
|
||||
Node *node = displayManager->getDisplayRenderNode();
|
||||
|
||||
if (NULL == node)
|
||||
continue;
|
||||
|
||||
if(Skin *skin = dynamic_cast<Skin *>(node))
|
||||
if (CCBone *bone = dynamic_cast<CCBone *>(object))
|
||||
{
|
||||
TextureAtlas *textureAtlas = skin->getTextureAtlas();
|
||||
if(_atlas != textureAtlas)
|
||||
CCDisplayManager *displayManager = bone->getDisplayManager();
|
||||
Node *node = displayManager->getDisplayRenderNode();
|
||||
|
||||
if (NULL == node)
|
||||
continue;
|
||||
|
||||
switch (displayManager->getCurrentDecorativeDisplay()->getDisplayData()->displayType)
|
||||
{
|
||||
if (_atlas)
|
||||
case CS_DISPLAY_SPRITE:
|
||||
{
|
||||
CCSkin *skin = (CCSkin *)node;
|
||||
|
||||
TextureAtlas *textureAtlas = skin->getTextureAtlas();
|
||||
CCBlendType blendType = bone->getBlendType();
|
||||
if(m_pAtlas != textureAtlas || blendType != BLEND_NORMAL)
|
||||
{
|
||||
_atlas->drawQuads();
|
||||
_atlas->removeAllQuads();
|
||||
if (m_pAtlas)
|
||||
{
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
}
|
||||
|
||||
m_pAtlas = textureAtlas;
|
||||
if (m_pAtlas->getCapacity() == m_pAtlas->getTotalQuads() && !m_pAtlas->resizeCapacity(m_pAtlas->getCapacity() * 2))
|
||||
return;
|
||||
|
||||
skin->updateTransform();
|
||||
|
||||
if (blendType != BLEND_NORMAL)
|
||||
{
|
||||
updateBlendType(blendType);
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
GL::blendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
|
||||
}
|
||||
}
|
||||
|
||||
_atlas = textureAtlas;
|
||||
if (_atlas->getCapacity() == _atlas->getTotalQuads() && !_atlas->resizeCapacity(_atlas->getCapacity() * 2))
|
||||
return;
|
||||
|
||||
skin->draw();
|
||||
}
|
||||
else if(Armature *armature = dynamic_cast<Armature *>(node))
|
||||
{
|
||||
TextureAtlas *textureAtlas = armature->getTextureAtlas();
|
||||
|
||||
if(_atlas != textureAtlas)
|
||||
break;
|
||||
case CS_DISPLAY_ARMATURE:
|
||||
{
|
||||
if (_atlas)
|
||||
CCArmature *armature = (CCArmature *)(node);
|
||||
|
||||
TextureAtlas *textureAtlas = armature->getTextureAtlas();
|
||||
if(m_pAtlas != textureAtlas)
|
||||
{
|
||||
_atlas->drawQuads();
|
||||
_atlas->removeAllQuads();
|
||||
if (m_pAtlas)
|
||||
{
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
}
|
||||
armature->draw();
|
||||
}
|
||||
armature->draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_atlas)
|
||||
break;
|
||||
default:
|
||||
{
|
||||
_atlas->drawQuads();
|
||||
_atlas->removeAllQuads();
|
||||
if (m_pAtlas)
|
||||
{
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
node->visit();
|
||||
|
||||
CC_NODE_DRAW_SETUP();
|
||||
GL::blendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(Node *node = dynamic_cast<Node *>(object))
|
||||
{
|
||||
if (m_pAtlas)
|
||||
{
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
node->visit();
|
||||
|
||||
CC_NODE_DRAW_SETUP();
|
||||
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
|
||||
GL::blendFunc(m_sBlendFunc.src, m_sBlendFunc.dst);
|
||||
}
|
||||
}
|
||||
|
||||
if(_atlas && !_batchNode && _parentBone == NULL)
|
||||
if(m_pAtlas && !m_pBatchNode && m_pParentBone == NULL)
|
||||
{
|
||||
_atlas->drawQuads();
|
||||
_atlas->removeAllQuads();
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
}
|
||||
|
||||
void Armature::visit()
|
||||
|
||||
void CCArmature::updateBlendType(CCBlendType blendType)
|
||||
{
|
||||
BlendFunc blendFunc;
|
||||
switch (blendType)
|
||||
{
|
||||
case BLEND_NORMAL:
|
||||
{
|
||||
blendFunc.src = CC_BLEND_SRC;
|
||||
blendFunc.dst = CC_BLEND_DST;
|
||||
}
|
||||
break;
|
||||
case BLEND_ADD:
|
||||
{
|
||||
blendFunc.src = GL_SRC_ALPHA;
|
||||
blendFunc.dst = GL_ONE;
|
||||
}
|
||||
break;
|
||||
case BLEND_MULTIPLY:
|
||||
{
|
||||
blendFunc.src = GL_DST_COLOR;
|
||||
blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
|
||||
}
|
||||
break;
|
||||
case BLEND_SCREEN:
|
||||
{
|
||||
blendFunc.src = GL_ONE;
|
||||
blendFunc.dst = GL_ONE_MINUS_SRC_COLOR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
blendFunc.src = CC_BLEND_SRC;
|
||||
blendFunc.dst = CC_BLEND_DST;
|
||||
}
|
||||
break;
|
||||
}
|
||||
GL::blendFunc(blendFunc.src, blendFunc.dst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CCArmature::visit()
|
||||
{
|
||||
// quick return if not visible. children won't be drawn.
|
||||
if (!_visible)
|
||||
|
@ -523,7 +636,7 @@ void Armature::visit()
|
|||
kmGLPopMatrix();
|
||||
}
|
||||
|
||||
Rect Armature::getBoundingBox() const
|
||||
Rect CCArmature::getBoundingBox() const
|
||||
{
|
||||
float minx, miny, maxx, maxy = 0;
|
||||
|
||||
|
@ -534,46 +647,145 @@ Rect Armature::getBoundingBox() const
|
|||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Bone *bone = static_cast<Bone *>(object);
|
||||
Rect r = bone->getDisplayManager()->getBoundingBox();
|
||||
|
||||
if(first)
|
||||
if (CCBone *bone = dynamic_cast<CCBone *>(object))
|
||||
{
|
||||
minx = r.getMinX();
|
||||
miny = r.getMinY();
|
||||
maxx = r.getMaxX();
|
||||
maxy = r.getMaxY();
|
||||
Rect r = bone->getDisplayManager()->getBoundingBox();
|
||||
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
minx = r.getMinX() < boundingBox.getMinX() ? r.getMinX() : boundingBox.getMinX();
|
||||
miny = r.getMinY() < boundingBox.getMinY() ? r.getMinY() : boundingBox.getMinY();
|
||||
maxx = r.getMaxX() > boundingBox.getMaxX() ? r.getMaxX() : boundingBox.getMaxX();
|
||||
maxy = r.getMaxY() > boundingBox.getMaxY() ? r.getMaxY() : boundingBox.getMaxY();
|
||||
}
|
||||
if(first)
|
||||
{
|
||||
minx = r.getMinX();
|
||||
miny = r.getMinY();
|
||||
maxx = r.getMaxX();
|
||||
maxy = r.getMaxY();
|
||||
|
||||
boundingBox.setRect(minx, miny, maxx - minx, maxy - miny);
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
minx = r.getMinX() < boundingBox.getMinX() ? r.getMinX() : boundingBox.getMinX();
|
||||
miny = r.getMinY() < boundingBox.getMinY() ? r.getMinY() : boundingBox.getMinY();
|
||||
maxx = r.getMaxX() > boundingBox.getMaxX() ? r.getMaxX() : boundingBox.getMaxX();
|
||||
maxy = r.getMaxY() > boundingBox.getMaxY() ? r.getMaxY() : boundingBox.getMaxY();
|
||||
}
|
||||
|
||||
boundingBox.setRect(minx, miny, maxx - minx, maxy - miny);
|
||||
}
|
||||
}
|
||||
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
Bone *Armature::getBoneAtPoint(float x, float y)
|
||||
CCBone *CCArmature::getBoneAtPoint(float x, float y)
|
||||
{
|
||||
int length = _children->count();
|
||||
Bone *bs;
|
||||
int length = _children->data->num;
|
||||
CCBone **bs = (CCBone **)_children->data->arr;
|
||||
|
||||
for(int i = length - 1; i >= 0; i--)
|
||||
{
|
||||
bs = static_cast<Bone*>( _children->getObjectAtIndex(i) );
|
||||
if(bs->getDisplayManager()->containPoint(x, y))
|
||||
if(bs[i]->getDisplayManager()->containPoint(x, y))
|
||||
{
|
||||
return bs;
|
||||
return bs[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
b2Body *CCArmature::getBody()
|
||||
{
|
||||
return m_pBody;
|
||||
}
|
||||
|
||||
void CCArmature::setBody(b2Body *body)
|
||||
{
|
||||
if (m_pBody == body)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_pBody = body;
|
||||
m_pBody->SetUserData(this);
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
if (CCBone *bone = dynamic_cast<CCBone *>(object))
|
||||
{
|
||||
Array *displayList = bone->getDisplayManager()->getDecorativeDisplayList();
|
||||
|
||||
Object *displayObject = NULL;
|
||||
CCARRAY_FOREACH(displayList, displayObject)
|
||||
{
|
||||
CCColliderDetector *detector = ((CCDecorativeDisplay *)displayObject)->getColliderDetector();
|
||||
if (detector != NULL)
|
||||
{
|
||||
detector->setBody(m_pBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b2Fixture *CCArmature::getShapeList()
|
||||
{
|
||||
if (m_pBody)
|
||||
{
|
||||
return m_pBody->GetFixtureList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
cpBody *CCArmature::getBody()
|
||||
{
|
||||
return m_pBody;
|
||||
}
|
||||
|
||||
void CCArmature::setBody(cpBody *body)
|
||||
{
|
||||
if (m_pBody == body)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_pBody = body;
|
||||
m_pBody->data = this;
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
if (CCBone *bone = dynamic_cast<CCBone *>(object))
|
||||
{
|
||||
Array *displayList = bone->getDisplayManager()->getDecorativeDisplayList();
|
||||
|
||||
Object *displayObject = NULL;
|
||||
CCARRAY_FOREACH(displayList, displayObject)
|
||||
{
|
||||
CCColliderDetector *detector = ((CCDecorativeDisplay *)displayObject)->getColliderDetector();
|
||||
if (detector != NULL)
|
||||
{
|
||||
detector->setBody(m_pBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cpShape *CCArmature::getShapeList()
|
||||
{
|
||||
if (m_pBody)
|
||||
{
|
||||
return m_pBody->shapeList_private;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -21,183 +21,173 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef __CCARMATURE_H__
|
||||
#define __CCARMATURE_H__
|
||||
|
||||
#include "utils/CCArmatureDefine.h"
|
||||
#include "CCBone.h"
|
||||
#include "display/CCBatchNode.h"
|
||||
#include "display/CCShaderNode.h"
|
||||
#include "animation/CCArmatureAnimation.h"
|
||||
#include "physics/CCPhysicsWorld.h"
|
||||
#include "utils/CCSpriteFrameCacheHelper.h"
|
||||
#include "utils/CCArmatureDataManager.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
class b2Body;
|
||||
struct cpBody;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ProcessBase CCProcessBase;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef BaseData CCBaseData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DisplayData CCDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef SpriteDisplayData CCSpriteDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ArmatureDisplayData CCArmatureDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ParticleDisplayData CCParticleDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ShaderDisplayData CCShaderDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef BoneData CCBoneData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef FrameData CCFrameData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef MovementBoneData CCMovementBoneData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef MovementData CCMovementData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef AnimationData CCAnimationData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ContourData CCContourData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef TextureData CCTextureData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ShaderNode CCShaderNode;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DecorativeDisplay CCDecorativeDisplay;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DisplayData CCDisplayData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DisplayFactory CCDisplayFactory;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef BatchNode CCBatchNode;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DecorativeDisplay CCDecorativeDisplay;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef DisplayManager CCDisplayManager;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ColliderBody CCColliderBody;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ColliderDetector CCColliderDetector;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef PhysicsWorld CCPhysicsWorld;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef SpriteFrameCacheHelper CCSpriteFrameCacheHelper;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef TweenFunction CCTweenFunction;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ArmatureData CCArmatureData;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Bone CCBone;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ArmatureAnimation CCArmatureAnimation;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef Armature CCArmature;
|
||||
CC_DEPRECATED_ATTRIBUTE typedef ArmatureDataManager CCArmatureDataManager;
|
||||
|
||||
class Armature : public NodeRGBA, public BlendProtocol
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class CCArmature : public NodeRGBA, public BlendProtocol
|
||||
{
|
||||
|
||||
public:
|
||||
/**
|
||||
* Allocates and initializes a armature.
|
||||
* @return A initialized armature which is marked as "autorelease".
|
||||
*/
|
||||
static Armature *create();
|
||||
|
||||
/**
|
||||
* Allocates a armature, and use the ArmatureData named name in ArmatureDataManager to initializes the armature.
|
||||
*
|
||||
* @param name Armature will use the name to find to the ArmatureData to initializes it.
|
||||
* @return A initialized armature which is marked as "autorelease".
|
||||
*/
|
||||
static Armature *create(const char *name);
|
||||
|
||||
static Armature *create(const char *name, Bone *parentBone);
|
||||
/**
|
||||
* Allocates and initializes an armature.
|
||||
* @return An initialized armature which is marked as "autorelease".
|
||||
*/
|
||||
static CCArmature *create();
|
||||
|
||||
/**
|
||||
* Allocates an armature, and use the CCArmatureData named name in CCArmatureDataManager to initializes the armature.
|
||||
*
|
||||
* @param name CCArmature will use the name to find the CCArmatureData to initializes it.
|
||||
* @return A initialized armature which is marked as "autorelease".
|
||||
*/
|
||||
static CCArmature *create(const char *name);
|
||||
|
||||
static CCArmature *create(const char *name, CCBone *parentBone);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Armature();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Armature(void);
|
||||
CCArmature();
|
||||
~CCArmature(void);
|
||||
|
||||
/**
|
||||
* Init the empty armature
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
|
||||
/**
|
||||
* Init a armature with specified name
|
||||
* @param name Armature name
|
||||
* Init an armature with specified name
|
||||
* @param name CCArmature name
|
||||
*/
|
||||
virtual bool init(const char *name);
|
||||
|
||||
virtual bool init(const char *name, Bone *parentBone);
|
||||
virtual bool init(const char *name, CCBone *parentBone);
|
||||
/**
|
||||
* Add a Bone to this Armature,
|
||||
* Add a CCBone to this CCArmature,
|
||||
*
|
||||
* @param bone The Bone you want to add to Armature
|
||||
* @param parentName The parent Bone's name you want to add to . If it's NULL, then set Armature to it's parent
|
||||
* @param bone The CCBone you want to add to CCArmature
|
||||
* @param parentName The parent CCBone's name you want to add to . If it's NULL, then set CCArmature to its parent
|
||||
*/
|
||||
virtual void addBone(Bone *bone, const char* parentName);
|
||||
virtual void addBone(CCBone *bone, const char *parentName);
|
||||
/**
|
||||
* Get a bone with the specified name
|
||||
*
|
||||
* @param name The bone's name you want to get
|
||||
*/
|
||||
virtual Bone *getBone(const char *name) const;
|
||||
virtual CCBone *getBone(const char *name) const;
|
||||
/**
|
||||
* Change a bone's parent with the specified parent name.
|
||||
*
|
||||
* @param bone The bone you want to change parent
|
||||
* @param parentName The new parent's name.
|
||||
* @param parentName The new parent's name.
|
||||
*/
|
||||
virtual void changeBoneParent(Bone *bone, const char *parentName);
|
||||
virtual void changeBoneParent(CCBone *bone, const char *parentName);
|
||||
/**
|
||||
* Remove a bone with the specified name. If recursion it will also remove child Bone recursionly.
|
||||
* Remove a bone with the specified name. If recursion it will also remove child CCBone recursionly.
|
||||
*
|
||||
* @param bone The bone you want to remove
|
||||
* @param recursion Determine whether remove the bone's child recursion.
|
||||
* @param recursion Determine whether remove the bone's child recursion.
|
||||
*/
|
||||
virtual void removeBone(Bone *bone, bool recursion);
|
||||
virtual void removeBone(CCBone *bone, bool recursion);
|
||||
|
||||
/**
|
||||
* Get Armature's bone dictionary
|
||||
* @return Armature's bone dictionary
|
||||
* Get CCArmature's bone dictionary
|
||||
* @return CCArmature's bone dictionary
|
||||
*/
|
||||
Dictionary *getBoneDic();
|
||||
|
||||
Bone *getBoneAtPoint(float x, float y);
|
||||
|
||||
Dictionary *getBoneDic();
|
||||
|
||||
/**
|
||||
* Set contentsize and Calculate anchor point.
|
||||
*/
|
||||
virtual void updateOffsetPoint();
|
||||
|
||||
// overrides
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
* This boundingBox will calculate all bones' boundingBox every time
|
||||
*/
|
||||
virtual void visit() override;
|
||||
virtual void update(float dt) override;
|
||||
virtual void draw() override;
|
||||
virtual const AffineTransform& getNodeToParentTransform() const override;
|
||||
/** This boundingBox will calculate all bones' boundingBox every time */
|
||||
virtual Rect getBoundingBox() const override;
|
||||
inline void setBlendFunc(const BlendFunc& blendFunc) override { _blendFunc = blendFunc; }
|
||||
inline const BlendFunc& getBlendFunc(void) const override { return _blendFunc; }
|
||||
virtual Rect getBoundingBox() const;
|
||||
|
||||
CCBone *getBoneAtPoint(float x, float y);
|
||||
|
||||
virtual void visit();
|
||||
virtual void update(float dt);
|
||||
virtual void draw();
|
||||
|
||||
virtual const AffineTransform& getNodeToParentTransform() const;
|
||||
|
||||
/**
|
||||
* Set contentsize and Calculate anchor point.
|
||||
*/
|
||||
virtual void updateOffsetPoint();
|
||||
|
||||
inline void setBlendFunc(const BlendFunc &blendFunc)
|
||||
{
|
||||
m_sBlendFunc = blendFunc;
|
||||
}
|
||||
inline const BlendFunc &getBlendFunc(void) const
|
||||
{
|
||||
return m_sBlendFunc;
|
||||
}
|
||||
|
||||
virtual void setAnimation(CCArmatureAnimation *animation);
|
||||
virtual CCArmatureAnimation *getAnimation();
|
||||
|
||||
virtual bool getArmatureTransformDirty();
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
virtual b2Fixture *getShapeList();
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
virtual cpShape *getShapeList();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/*
|
||||
* Used to create Bone internal
|
||||
* Used to create CCBone internal
|
||||
*/
|
||||
Bone *createBone(const char *boneName );
|
||||
|
||||
CCBone *createBone(const char *boneName );
|
||||
|
||||
CC_SYNTHESIZE_RETAIN(ArmatureAnimation *, _animation, Animation);
|
||||
|
||||
CC_SYNTHESIZE(ArmatureData *, _armatureData, ArmatureData);
|
||||
//! Update blend function
|
||||
void updateBlendType(CCBlendType blendType);
|
||||
|
||||
CC_SYNTHESIZE(BatchNode*, _batchNode, BatchNode);
|
||||
CC_SYNTHESIZE(CCArmatureData *, m_pArmatureData, ArmatureData);
|
||||
|
||||
CC_SYNTHESIZE_PASS_BY_REF(std::string, _name, Name);
|
||||
CC_SYNTHESIZE(CCBatchNode *, m_pBatchNode, BatchNode);
|
||||
|
||||
CC_SYNTHESIZE(TextureAtlas*, _atlas, TextureAtlas);
|
||||
CC_SYNTHESIZE(std::string, m_strName, Name);
|
||||
|
||||
CC_SYNTHESIZE(TextureAtlas *, m_pAtlas, TextureAtlas);
|
||||
|
||||
CC_SYNTHESIZE(CCBone *, m_pParentBone, ParentBone);
|
||||
|
||||
CC_SYNTHESIZE(float, m_fVersion, Version);
|
||||
|
||||
CC_SYNTHESIZE(Bone*, _parentBone, ParentBone);
|
||||
protected:
|
||||
Dictionary *_boneDic; //! The dictionary of the bones, include all bones in the armature, no matter it is the direct bone or the indirect bone. It is different from _chindren.
|
||||
mutable bool m_bArmatureTransformDirty;
|
||||
|
||||
Array *_topBoneList;
|
||||
Dictionary *m_pBoneDic; //! The dictionary of the bones, include all bones in the armature, no matter it is the direct bone or the indirect bone. It is different from m_pChindren.
|
||||
|
||||
static std::map<int, Armature*> _armatureIndexDic; //! Use to save armature zorder info,
|
||||
Array *m_pTopBoneList;
|
||||
|
||||
BlendFunc _blendFunc; //! It's required for TextureProtocol inheritance
|
||||
static std::map<int, CCArmature *> m_sArmatureIndexDic; //! Use to save armature zorder info,
|
||||
|
||||
Point _offsetPoint;
|
||||
BlendFunc m_sBlendFunc; //! It's required for CCTextureProtocol inheritance
|
||||
|
||||
Point m_pOffsetPoint;
|
||||
|
||||
CCArmatureAnimation *m_pAnimation;
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
CC_PROPERTY(b2Body *, m_pBody, Body);
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_PROPERTY(cpBody *, m_pBody, Body);
|
||||
#endif
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCARMATURE_H__*/
|
||||
|
|
|
@ -29,12 +29,12 @@ THE SOFTWARE.
|
|||
#include "utils/CCTransformHelp.h"
|
||||
#include "display/CCDisplayManager.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
Bone *Bone::create()
|
||||
CCBone *CCBone::create()
|
||||
{
|
||||
|
||||
Bone *pBone = new Bone();
|
||||
CCBone *pBone = new CCBone();
|
||||
if (pBone && pBone->init())
|
||||
{
|
||||
pBone->autorelease();
|
||||
|
@ -45,10 +45,10 @@ Bone *Bone::create()
|
|||
|
||||
}
|
||||
|
||||
Bone *Bone::create(const char *name)
|
||||
CCBone *CCBone::create(const char *name)
|
||||
{
|
||||
|
||||
Bone *pBone = new Bone();
|
||||
CCBone *pBone = new CCBone();
|
||||
if (pBone && pBone->init(name))
|
||||
{
|
||||
pBone->autorelease();
|
||||
|
@ -58,45 +58,46 @@ Bone *Bone::create(const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Bone::Bone()
|
||||
CCBone::CCBone()
|
||||
{
|
||||
_tweenData = NULL;
|
||||
_parent = NULL;
|
||||
_armature = NULL;
|
||||
_childArmature = NULL;
|
||||
_boneData = NULL;
|
||||
_tween = NULL;
|
||||
_tween = NULL;
|
||||
m_pTweenData = NULL;
|
||||
m_pParentBone = NULL;
|
||||
m_pArmature = NULL;
|
||||
m_pChildArmature = NULL;
|
||||
m_pBoneData = NULL;
|
||||
m_pTween = NULL;
|
||||
m_pTween = NULL;
|
||||
_children = NULL;
|
||||
_displayManager = NULL;
|
||||
_ignoreMovementBoneData = false;
|
||||
_worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);
|
||||
_transformDirty = true;
|
||||
m_pDisplayManager = NULL;
|
||||
m_bIgnoreMovementBoneData = false;
|
||||
m_tWorldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);
|
||||
m_bBoneTransformDirty = true;
|
||||
m_eBlendType = BLEND_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
Bone::~Bone(void)
|
||||
CCBone::~CCBone(void)
|
||||
{
|
||||
CC_SAFE_DELETE(_tweenData);
|
||||
CC_SAFE_DELETE(m_pTweenData);
|
||||
CC_SAFE_DELETE(_children);
|
||||
CC_SAFE_DELETE(_tween);
|
||||
CC_SAFE_DELETE(_displayManager);
|
||||
CC_SAFE_DELETE(m_pTween);
|
||||
CC_SAFE_DELETE(m_pDisplayManager);
|
||||
|
||||
if(_boneData)
|
||||
if(m_pBoneData)
|
||||
{
|
||||
_boneData->release();
|
||||
m_pBoneData->release();
|
||||
}
|
||||
|
||||
CC_SAFE_RELEASE(_childArmature);
|
||||
CC_SAFE_RELEASE(m_pChildArmature);
|
||||
}
|
||||
|
||||
bool Bone::init()
|
||||
bool CCBone::init()
|
||||
{
|
||||
return Bone::init(NULL);
|
||||
return CCBone::init(NULL);
|
||||
}
|
||||
|
||||
|
||||
bool Bone::init(const char *name)
|
||||
bool CCBone::init(const char *name)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
|
@ -104,19 +105,19 @@ bool Bone::init(const char *name)
|
|||
|
||||
if(NULL != name)
|
||||
{
|
||||
_name = name;
|
||||
m_strName = name;
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(_tweenData);
|
||||
_tweenData = new FrameData();
|
||||
CC_SAFE_DELETE(m_pTweenData);
|
||||
m_pTweenData = new CCFrameData();
|
||||
|
||||
CC_SAFE_DELETE(_tween);
|
||||
_tween = new Tween();
|
||||
_tween->init(this);
|
||||
CC_SAFE_DELETE(m_pTween);
|
||||
m_pTween = new CCTween();
|
||||
m_pTween->init(this);
|
||||
|
||||
CC_SAFE_DELETE(_displayManager);
|
||||
_displayManager = new DisplayManager();
|
||||
_displayManager->init(this);
|
||||
CC_SAFE_DELETE(m_pDisplayManager);
|
||||
m_pDisplayManager = new CCDisplayManager();
|
||||
m_pDisplayManager->init(this);
|
||||
|
||||
|
||||
bRet = true;
|
||||
|
@ -126,108 +127,123 @@ bool Bone::init(const char *name)
|
|||
return bRet;
|
||||
}
|
||||
|
||||
void Bone::setBoneData(BoneData *boneData)
|
||||
void CCBone::setBoneData(CCBoneData *boneData)
|
||||
{
|
||||
CCASSERT(NULL != boneData, "_boneData must not be NULL");
|
||||
CCAssert(NULL != boneData, "_boneData must not be NULL");
|
||||
|
||||
_boneData = boneData;
|
||||
_boneData->retain();
|
||||
m_pBoneData = boneData;
|
||||
m_pBoneData->retain();
|
||||
|
||||
_name = _boneData->name;
|
||||
_ZOrder = _boneData->zOrder;
|
||||
m_strName = m_pBoneData->name;
|
||||
_ZOrder = m_pBoneData->zOrder;
|
||||
|
||||
_displayManager->initDisplayList(boneData);
|
||||
m_pDisplayManager->initDisplayList(boneData);
|
||||
}
|
||||
|
||||
BoneData *Bone::getBoneData()
|
||||
CCBoneData *CCBone::getBoneData()
|
||||
{
|
||||
return _boneData;
|
||||
return m_pBoneData;
|
||||
}
|
||||
|
||||
void Bone::setArmature(Armature *armature)
|
||||
void CCBone::setArmature(CCArmature *armature)
|
||||
{
|
||||
_armature = armature;
|
||||
_tween->setAnimation(_armature->getAnimation());
|
||||
}
|
||||
|
||||
|
||||
Armature *Bone::getArmature()
|
||||
{
|
||||
return _armature;
|
||||
}
|
||||
|
||||
void Bone::update(float delta)
|
||||
{
|
||||
if (_parent)
|
||||
_transformDirty = _transformDirty || _parent->isTransformDirty();
|
||||
|
||||
if (_transformDirty)
|
||||
m_pArmature = armature;
|
||||
if (m_pArmature)
|
||||
{
|
||||
float cosX = cos(_tweenData->skewX);
|
||||
float cosY = cos(_tweenData->skewY);
|
||||
float sinX = sin(_tweenData->skewX);
|
||||
float sinY = sin(_tweenData->skewY);
|
||||
m_pTween->setAnimation(m_pArmature->getAnimation());
|
||||
}
|
||||
}
|
||||
|
||||
_worldTransform.a = _tweenData->scaleX * cosY;
|
||||
_worldTransform.b = _tweenData->scaleX * sinY;
|
||||
_worldTransform.c = _tweenData->scaleY * sinX;
|
||||
_worldTransform.d = _tweenData->scaleY * cosX;
|
||||
_worldTransform.tx = _tweenData->x;
|
||||
_worldTransform.ty = _tweenData->y;
|
||||
|
||||
_worldTransform = AffineTransformConcat(getNodeToParentTransform(), _worldTransform);
|
||||
CCArmature *CCBone::getArmature()
|
||||
{
|
||||
return m_pArmature;
|
||||
}
|
||||
|
||||
if(_parent)
|
||||
void CCBone::update(float delta)
|
||||
{
|
||||
if (m_pParentBone)
|
||||
m_bBoneTransformDirty = m_bBoneTransformDirty || m_pParentBone->isTransformDirty();
|
||||
|
||||
if (m_bBoneTransformDirty)
|
||||
{
|
||||
if (m_pArmature->getArmatureData()->dataVersion >= VERSION_COMBINED)
|
||||
{
|
||||
_worldTransform = AffineTransformConcat(_worldTransform, _parent->_worldTransform);
|
||||
CCTransformHelp::nodeConcat(*m_pTweenData, *m_pBoneData);
|
||||
m_pTweenData->scaleX -= 1;
|
||||
m_pTweenData->scaleY -= 1;
|
||||
}
|
||||
|
||||
CCTransformHelp::nodeToMatrix(*m_pTweenData, m_tWorldTransform);
|
||||
|
||||
m_tWorldTransform = AffineTransformConcat(getNodeToParentTransform(), m_tWorldTransform);
|
||||
|
||||
if(m_pParentBone)
|
||||
{
|
||||
m_tWorldTransform = AffineTransformConcat(m_tWorldTransform, m_pParentBone->m_tWorldTransform);
|
||||
}
|
||||
}
|
||||
|
||||
DisplayFactory::updateDisplay(this, _displayManager->getCurrentDecorativeDisplay(), delta, _transformDirty);
|
||||
CCDisplayFactory::updateDisplay(this, m_pDisplayManager->getCurrentDecorativeDisplay(), delta, m_bBoneTransformDirty || m_pArmature->getArmatureTransformDirty());
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Bone *childBone = static_cast<Bone *>(object);
|
||||
CCBone *childBone = (CCBone *)object;
|
||||
childBone->update(delta);
|
||||
}
|
||||
|
||||
_transformDirty = false;
|
||||
m_bBoneTransformDirty = false;
|
||||
}
|
||||
|
||||
|
||||
void Bone::updateDisplayedColor(const Color3B &parentColor)
|
||||
void CCBone::updateDisplayedColor(const Color3B &parentColor)
|
||||
{
|
||||
_realColor = Color3B(255, 255, 255);
|
||||
NodeRGBA::updateDisplayedColor(parentColor);
|
||||
updateColor();
|
||||
}
|
||||
|
||||
void Bone::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
void CCBone::updateDisplayedOpacity(GLubyte parentOpacity)
|
||||
{
|
||||
_realOpacity = 255;
|
||||
NodeRGBA::updateDisplayedOpacity(parentOpacity);
|
||||
updateColor();
|
||||
}
|
||||
|
||||
void Bone::updateColor()
|
||||
void CCBone::updateColor()
|
||||
{
|
||||
Node *display = _displayManager->getDisplayRenderNode();
|
||||
Node *display = m_pDisplayManager->getDisplayRenderNode();
|
||||
RGBAProtocol *protocol = dynamic_cast<RGBAProtocol *>(display);
|
||||
if(protocol != NULL)
|
||||
{
|
||||
protocol->setColor(Color3B(_displayedColor.r * _tweenData->r / 255, _displayedColor.g * _tweenData->g / 255, _displayedColor.b * _tweenData->b / 255));
|
||||
protocol->setOpacity(_displayedOpacity * _tweenData->a / 255);
|
||||
protocol->setColor(Color3B(_displayedColor.r * m_pTweenData->r / 255, _displayedColor.g * m_pTweenData->g / 255, _displayedColor.b * m_pTweenData->b / 255));
|
||||
protocol->setOpacity(_displayedOpacity * m_pTweenData->a / 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Bone::addChildBone(Bone *child)
|
||||
void CCBone::updateZOrder()
|
||||
{
|
||||
CCASSERT( NULL != child, "Argument must be non-nil");
|
||||
CCASSERT( NULL == child->_parent, "child already added. It can't be added again");
|
||||
if (m_pArmature->getArmatureData()->dataVersion >= VERSION_COMBINED)
|
||||
{
|
||||
int zorder = m_pTweenData->zOrder + m_pBoneData->zOrder;
|
||||
setZOrder(zorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
setZOrder(m_pTweenData->zOrder);
|
||||
}
|
||||
}
|
||||
|
||||
void CCBone::addChildBone(CCBone *child)
|
||||
{
|
||||
CCAssert( NULL != child, "Argument must be non-nil");
|
||||
CCAssert( NULL == child->m_pParentBone, "child already added. It can't be added again");
|
||||
|
||||
if(!_children)
|
||||
{
|
||||
childrenAlloc();
|
||||
_children = Array::createWithCapacity(4);
|
||||
_children->retain();
|
||||
}
|
||||
|
||||
if (_children->getIndexOfObject(child) == UINT_MAX)
|
||||
|
@ -237,7 +253,7 @@ void Bone::addChildBone(Bone *child)
|
|||
}
|
||||
}
|
||||
|
||||
void Bone::removeChildBone(Bone *bone, bool recursion)
|
||||
void CCBone::removeChildBone(CCBone *bone, bool recursion)
|
||||
{
|
||||
if ( _children->getIndexOfObject(bone) != UINT_MAX )
|
||||
{
|
||||
|
@ -247,7 +263,7 @@ void Bone::removeChildBone(Bone *bone, bool recursion)
|
|||
Object *_object = NULL;
|
||||
CCARRAY_FOREACH(_ccbones, _object)
|
||||
{
|
||||
Bone *_ccBone = static_cast<Bone *>(_object);
|
||||
CCBone *_ccBone = (CCBone *)_object;
|
||||
bone->removeChildBone(_ccBone, recursion);
|
||||
}
|
||||
}
|
||||
|
@ -260,86 +276,101 @@ void Bone::removeChildBone(Bone *bone, bool recursion)
|
|||
}
|
||||
}
|
||||
|
||||
void Bone::removeFromParent(bool recursion)
|
||||
void CCBone::removeFromParent(bool recursion)
|
||||
{
|
||||
if (NULL != _parent)
|
||||
if (NULL != m_pParentBone)
|
||||
{
|
||||
_parent->removeChildBone(this, recursion);
|
||||
m_pParentBone->removeChildBone(this, recursion);
|
||||
}
|
||||
}
|
||||
|
||||
void Bone::setParentBone(Bone *parent)
|
||||
void CCBone::setParentBone(CCBone *parent)
|
||||
{
|
||||
_parent = parent;
|
||||
m_pParentBone = parent;
|
||||
}
|
||||
|
||||
Bone *Bone::getParentBone()
|
||||
CCBone *CCBone::getParentBone()
|
||||
{
|
||||
return _parent;
|
||||
return m_pParentBone;
|
||||
}
|
||||
|
||||
void Bone::childrenAlloc(void)
|
||||
void CCBone::setChildArmature(CCArmature *armature)
|
||||
{
|
||||
CC_SAFE_DELETE(_children);
|
||||
_children = Array::createWithCapacity(4);
|
||||
_children->retain();
|
||||
}
|
||||
|
||||
|
||||
void Bone::setChildArmature(Armature *armature)
|
||||
{
|
||||
if (_childArmature != armature)
|
||||
if (m_pChildArmature != armature)
|
||||
{
|
||||
CC_SAFE_RETAIN(armature);
|
||||
CC_SAFE_RELEASE(_childArmature);
|
||||
_childArmature = armature;
|
||||
CC_SAFE_RELEASE(m_pChildArmature);
|
||||
m_pChildArmature = armature;
|
||||
}
|
||||
}
|
||||
|
||||
Armature *Bone::getChildArmature()
|
||||
CCArmature *CCBone::getChildArmature()
|
||||
{
|
||||
return _childArmature;
|
||||
return m_pChildArmature;
|
||||
}
|
||||
|
||||
Array *Bone::getChildren()
|
||||
CCTween *CCBone::getTween()
|
||||
{
|
||||
return _children;
|
||||
return m_pTween;
|
||||
}
|
||||
|
||||
Tween *Bone::getTween()
|
||||
{
|
||||
return _tween;
|
||||
}
|
||||
|
||||
void Bone::setZOrder(int zOrder)
|
||||
void CCBone::setZOrder(int zOrder)
|
||||
{
|
||||
if (_ZOrder != zOrder)
|
||||
Node::setZOrder(zOrder);
|
||||
}
|
||||
|
||||
void Bone::setTransformDirty(bool dirty)
|
||||
void CCBone::setTransformDirty(bool dirty)
|
||||
{
|
||||
_transformDirty = dirty;
|
||||
m_bBoneTransformDirty = dirty;
|
||||
}
|
||||
|
||||
bool Bone::isTransformDirty()
|
||||
bool CCBone::isTransformDirty()
|
||||
{
|
||||
return _transformDirty;
|
||||
return m_bBoneTransformDirty;
|
||||
}
|
||||
|
||||
AffineTransform Bone::nodeToArmatureTransform()
|
||||
AffineTransform CCBone::getNodeToArmatureTransform() const
|
||||
{
|
||||
return _worldTransform;
|
||||
return m_tWorldTransform;
|
||||
}
|
||||
|
||||
void Bone::addDisplay(DisplayData *_displayData, int _index)
|
||||
AffineTransform CCBone::getNodeToWorldTransform() const
|
||||
{
|
||||
_displayManager->addDisplay(_displayData, _index);
|
||||
return AffineTransformConcat(m_tWorldTransform, m_pArmature->getNodeToWorldTransform());
|
||||
}
|
||||
|
||||
void Bone::changeDisplayByIndex(int _index, bool _force)
|
||||
Node *CCBone::getDisplayRenderNode()
|
||||
{
|
||||
_displayManager->changeDisplayByIndex(_index, _force);
|
||||
return m_pDisplayManager->getDisplayRenderNode();
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
void CCBone::addDisplay(CCDisplayData *displayData, int index)
|
||||
{
|
||||
m_pDisplayManager->addDisplay(displayData, index);
|
||||
}
|
||||
|
||||
void CCBone::addDisplay(Node *display, int index)
|
||||
{
|
||||
m_pDisplayManager->addDisplay(display, index);
|
||||
}
|
||||
|
||||
void CCBone::changeDisplayByIndex(int index, bool force)
|
||||
{
|
||||
m_pDisplayManager->changeDisplayByIndex(index, force);
|
||||
}
|
||||
|
||||
Array *CCBone::getColliderBodyList()
|
||||
{
|
||||
if (CCDecorativeDisplay *decoDisplay = m_pDisplayManager->getCurrentDecorativeDisplay())
|
||||
{
|
||||
if (CCColliderDetector *detector = decoDisplay->getColliderDetector())
|
||||
{
|
||||
return detector->getColliderBodyList();
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,97 +28,95 @@ THE SOFTWARE.
|
|||
#include "utils/CCArmatureDefine.h"
|
||||
#include "datas/CCDatas.h"
|
||||
#include "animation/CCTween.h"
|
||||
#include "external_tool/CCTexture2DMutable.h"
|
||||
#include "display/CCDecorativeDisplay.h"
|
||||
#include "display/CCDisplayManager.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class Armature;
|
||||
|
||||
class Bone : public NodeRGBA
|
||||
class CCArmature;
|
||||
|
||||
class CCBone : public NodeRGBA
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Allocates and initializes a bone.
|
||||
* @return A initialized bone which is marked as "autorelease".
|
||||
*/
|
||||
static Bone *create();
|
||||
static CCBone *create();
|
||||
/**
|
||||
* Allocates and initializes a bone.
|
||||
*
|
||||
* @param name If name is not null, then set name to the bone's name
|
||||
* @return A initialized bone which is marked as "autorelease".
|
||||
*/
|
||||
static Bone *create(const char *name);
|
||||
static CCBone *create(const char *name);
|
||||
|
||||
public:
|
||||
Bone();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Bone(void);
|
||||
CCBone();
|
||||
virtual ~CCBone(void);
|
||||
|
||||
/**
|
||||
* Initializes an empty Bone with nothing init.
|
||||
* Initializes an empty CCBone with nothing init.
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/**
|
||||
* Initializes a Bone with the specified name
|
||||
* @param name Bone's name.
|
||||
* Initializes a CCBone with the specified name
|
||||
* @param name CCBone's name.
|
||||
*/
|
||||
virtual bool init(const char *name);
|
||||
|
||||
/**
|
||||
* Add display and use _DisplayData init the display.
|
||||
* Add display and use displayData to init the display.
|
||||
* If index already have a display, then replace it.
|
||||
* If index is current display index, then also change display to _index
|
||||
*
|
||||
* @param displayData it include the display information, like DisplayType.
|
||||
* If you want to create a sprite display, then create a SpriteDisplayData param
|
||||
* If you want to create a sprite display, then create a CCSpriteDisplayData param
|
||||
*
|
||||
* @param index the index of the display you want to replace or add to
|
||||
* -1 : append display from back
|
||||
*/
|
||||
void addDisplay(DisplayData *displayData, int index);
|
||||
void addDisplay(CCDisplayData *displayData, int index);
|
||||
|
||||
void addDisplay(Node *display, int index);
|
||||
|
||||
void changeDisplayByIndex(int index, bool force);
|
||||
|
||||
/**
|
||||
* Add a child to this bone, and it will let this child call setParent(Bone *_parent) function to set self to it's parent
|
||||
* @param child The child you want to add.
|
||||
* Add a child to this bone, and it will let this child call setParent(CCBone *parent) function to set self to it's parent
|
||||
* @param child the child you want to add
|
||||
*/
|
||||
void addChildBone(Bone *child);
|
||||
void addChildBone(CCBone *child);
|
||||
|
||||
/**
|
||||
* Set parent bone.
|
||||
* If _parent is NUll, then also remove this bone from armature.
|
||||
* It will not set the Armature, if you want to add the bone to a Armature, you should use Armature::addBone(Bone *bone, const char* _parentName).
|
||||
* If parent is NUll, then also remove this bone from armature.
|
||||
* It will not set the CCArmature, if you want to add the bone to a CCArmature, you should use CCArmature::addBone(CCBone *bone, const char* parentName).
|
||||
*
|
||||
* @param parent the parent bone.
|
||||
* NULL : remove this bone from armature
|
||||
*/
|
||||
void setParentBone(Bone *parent);
|
||||
void setParentBone(CCBone *parent);
|
||||
|
||||
/**
|
||||
* Get parent bone
|
||||
* @return parent bone
|
||||
*/
|
||||
Bone *getParentBone();
|
||||
CCBone *getParentBone();
|
||||
|
||||
/**
|
||||
* Remove itself from its parent Bone.
|
||||
* @param recursion Whether to remove Child display
|
||||
* Remove itself from its parent.
|
||||
* @param recursion whether or not to remove childBone's display
|
||||
*/
|
||||
void removeFromParent(bool recursion);
|
||||
|
||||
/**
|
||||
* Removes a child Bone
|
||||
* @param bone The bone you want to remove.
|
||||
* Removes a child CCBone
|
||||
* @param bone the bone you want to remove
|
||||
*/
|
||||
void removeChildBone(Bone *bone, bool recursion);
|
||||
void removeChildBone(CCBone *bone, bool recursion);
|
||||
|
||||
void update(float delta);
|
||||
|
||||
|
@ -128,10 +126,13 @@ public:
|
|||
//! Update color to render display
|
||||
void updateColor();
|
||||
|
||||
Array *getChildren();
|
||||
Tween *getTween();
|
||||
//! Update zorder
|
||||
void updateZOrder();
|
||||
|
||||
virtual void setZOrder(int zOrder);
|
||||
|
||||
CCTween *getTween();
|
||||
|
||||
/*
|
||||
* Whether or not the bone's transform property changed. if true, the bone will update the transform.
|
||||
*/
|
||||
|
@ -139,48 +140,53 @@ public:
|
|||
|
||||
virtual bool isTransformDirty();
|
||||
|
||||
virtual AffineTransform nodeToArmatureTransform();
|
||||
virtual AffineTransform getNodeToArmatureTransform() const;
|
||||
virtual AffineTransform getNodeToWorldTransform() const;
|
||||
|
||||
Node *getDisplayRenderNode();
|
||||
|
||||
/*
|
||||
* Get the ColliderBody list in this bone. The object in the Array is ColliderBody.
|
||||
*/
|
||||
virtual Array *getColliderBodyList();
|
||||
|
||||
public:
|
||||
/*
|
||||
* The origin state of the Bone. Display's state is effected by _boneData, _node, _tweenData
|
||||
* when call setData function, it will copy from the BoneData.
|
||||
* The origin state of the CCBone. Display's state is effected by m_pBoneData, m_pNode, m_pTweenData
|
||||
* when call setData function, it will copy from the CCBoneData.
|
||||
*/
|
||||
CC_PROPERTY(BoneData *, _boneData, BoneData);
|
||||
CC_PROPERTY(CCBoneData *, m_pBoneData, BoneData);
|
||||
|
||||
//! A weak reference to the Armature
|
||||
CC_PROPERTY(Armature *, _armature, Armature);
|
||||
//! A weak reference to the CCArmature
|
||||
CC_PROPERTY(CCArmature *, m_pArmature, Armature);
|
||||
|
||||
//! A weak reference to the child Armature
|
||||
CC_PROPERTY(Armature *, _childArmature, ChildArmature);
|
||||
//! A weak reference to the child CCArmature
|
||||
CC_PROPERTY(CCArmature *, m_pChildArmature, ChildArmature);
|
||||
|
||||
CC_SYNTHESIZE(DisplayManager *, _displayManager, DisplayManager)
|
||||
CC_SYNTHESIZE(CCDisplayManager *, m_pDisplayManager, DisplayManager)
|
||||
|
||||
/*
|
||||
* When Armature play a animation, if there is not a MovementBoneData of this bone in this MovementData, this bone will hide.
|
||||
* Set IgnoreMovementBoneData to true, then this bone will also show.
|
||||
* When CCArmature play an animation, if there is not a CCMovementBoneData of this bone in this CCMovementData, this bone will be hidden.
|
||||
* Set IgnoreMovementBoneData to true, then this bone will also be shown.
|
||||
*/
|
||||
CC_SYNTHESIZE_PASS_BY_REF(bool, _ignoreMovementBoneData, IgnoreMovementBoneData)
|
||||
CC_SYNTHESIZE(bool, m_bIgnoreMovementBoneData, IgnoreMovementBoneData)
|
||||
|
||||
CC_SYNTHESIZE(CCBlendType, m_eBlendType, BlendType)
|
||||
protected:
|
||||
Tween *_tween; //! Calculate tween effect
|
||||
CCTween *m_pTween; //! Calculate tween effect
|
||||
|
||||
//! Used for make tween effect between every frame
|
||||
CC_SYNTHESIZE_READONLY(FrameData *, _tweenData, TweenData);
|
||||
//! Used for making tween effect in every frame
|
||||
CC_SYNTHESIZE_READONLY(CCFrameData *, m_pTweenData, TweenData);
|
||||
|
||||
CC_SYNTHESIZE_PASS_BY_REF(std::string, _name, Name);
|
||||
CC_SYNTHESIZE(std::string, m_strName, Name);
|
||||
|
||||
//! Lazy allocs
|
||||
void childrenAlloc(void);
|
||||
Array *_children;
|
||||
|
||||
Bone *_parent; //! A weak reference to it's parent
|
||||
bool _transformDirty; //! Whether or not transform dirty
|
||||
CCBone *m_pParentBone; //! A weak reference to its parent
|
||||
bool m_bBoneTransformDirty; //! Whether or not transform dirty
|
||||
|
||||
//! self Transform, use this to change display's state
|
||||
AffineTransform _worldTransform;
|
||||
AffineTransform m_tWorldTransform;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCBONE_H__*/
|
||||
|
|
|
@ -27,15 +27,14 @@ THE SOFTWARE.
|
|||
#include "../CCBone.h"
|
||||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../utils/CCUtilMath.h"
|
||||
#include "../utils/CCConstValue.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
ArmatureAnimation *ArmatureAnimation::create(Armature *armature)
|
||||
CCArmatureAnimation *CCArmatureAnimation::create(CCArmature *armature)
|
||||
{
|
||||
ArmatureAnimation *pArmatureAnimation = new ArmatureAnimation();
|
||||
CCArmatureAnimation *pArmatureAnimation = new CCArmatureAnimation();
|
||||
if (pArmatureAnimation && pArmatureAnimation->init(armature))
|
||||
{
|
||||
pArmatureAnimation->autorelease();
|
||||
|
@ -46,32 +45,40 @@ ArmatureAnimation *ArmatureAnimation::create(Armature *armature)
|
|||
}
|
||||
|
||||
|
||||
ArmatureAnimation::ArmatureAnimation()
|
||||
: _animationData(NULL)
|
||||
, _armature(NULL)
|
||||
, _movementID("")
|
||||
, _toIndex(0)
|
||||
CCArmatureAnimation::CCArmatureAnimation()
|
||||
: m_pAnimationData(NULL)
|
||||
, m_fSpeedScale(1)
|
||||
, m_pMovementData(NULL)
|
||||
, m_pArmature(NULL)
|
||||
, m_strMovementID("")
|
||||
, m_iToIndex(0)
|
||||
|
||||
, m_sMovementEventCallFunc(NULL)
|
||||
, m_sFrameEventCallFunc(NULL)
|
||||
, m_sMovementEventTarget(NULL)
|
||||
, m_sFrameEventTarget(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ArmatureAnimation::~ArmatureAnimation(void)
|
||||
CCArmatureAnimation::~CCArmatureAnimation(void)
|
||||
{
|
||||
CCLOGINFO("deallocing ArmatureAnimation: %p", this);
|
||||
CC_SAFE_RELEASE_NULL(m_pTweenList);
|
||||
CC_SAFE_RELEASE_NULL(m_pAnimationData);
|
||||
|
||||
CC_SAFE_RELEASE_NULL(_tweenList);
|
||||
CC_SAFE_RELEASE_NULL(_animationData);
|
||||
CC_SAFE_RELEASE_NULL(m_sMovementEventTarget);
|
||||
CC_SAFE_RELEASE_NULL(m_sFrameEventTarget);
|
||||
}
|
||||
|
||||
bool ArmatureAnimation::init(Armature *armature)
|
||||
bool CCArmatureAnimation::init(CCArmature *armature)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
_armature = armature;
|
||||
m_pArmature = armature;
|
||||
|
||||
_tweenList = new Array();
|
||||
_tweenList->init();
|
||||
m_pTweenList = new Array();
|
||||
m_pTweenList->init();
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -81,124 +88,171 @@ bool ArmatureAnimation::init(Armature *armature)
|
|||
}
|
||||
|
||||
|
||||
void ArmatureAnimation:: pause()
|
||||
void CCArmatureAnimation:: pause()
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_tweenList, object)
|
||||
CCARRAY_FOREACH(m_pTweenList, object)
|
||||
{
|
||||
static_cast<Tween *>(object)->pause();
|
||||
((CCTween *)object)->pause();
|
||||
}
|
||||
ProcessBase::pause();
|
||||
CCProcessBase::pause();
|
||||
}
|
||||
|
||||
void ArmatureAnimation::resume()
|
||||
void CCArmatureAnimation::resume()
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_tweenList, object)
|
||||
CCARRAY_FOREACH(m_pTweenList, object)
|
||||
{
|
||||
static_cast<Tween *>(object)->resume();
|
||||
((CCTween *)object)->resume();
|
||||
}
|
||||
ProcessBase::resume();
|
||||
CCProcessBase::resume();
|
||||
}
|
||||
|
||||
void ArmatureAnimation::stop()
|
||||
void CCArmatureAnimation::stop()
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_tweenList, object)
|
||||
CCARRAY_FOREACH(m_pTweenList, object)
|
||||
{
|
||||
static_cast<Tween *>(object)->stop();
|
||||
((CCTween *)object)->stop();
|
||||
}
|
||||
_tweenList->removeAllObjects();
|
||||
ProcessBase::stop();
|
||||
m_pTweenList->removeAllObjects();
|
||||
CCProcessBase::stop();
|
||||
}
|
||||
|
||||
void ArmatureAnimation::setAnimationScale(float animationScale )
|
||||
void CCArmatureAnimation::setAnimationScale(float animationScale )
|
||||
{
|
||||
if(animationScale == _animationScale)
|
||||
setSpeedScale(animationScale);
|
||||
}
|
||||
|
||||
float CCArmatureAnimation::getAnimationScale() const
|
||||
{
|
||||
return getSpeedScale();
|
||||
}
|
||||
|
||||
|
||||
void CCArmatureAnimation::setSpeedScale(float speedScale)
|
||||
{
|
||||
if(speedScale == m_fSpeedScale)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_animationScale = animationScale;
|
||||
m_fSpeedScale = speedScale;
|
||||
|
||||
m_fProcessScale = !m_pMovementData ? m_fSpeedScale : m_fSpeedScale * m_pMovementData->scale;
|
||||
|
||||
DictElement *element = NULL;
|
||||
Dictionary *dict = _armature->getBoneDic();
|
||||
Dictionary *dict = m_pArmature->getBoneDic();
|
||||
CCDICT_FOREACH(dict, element)
|
||||
{
|
||||
Bone *bone = (Bone *)element->getObject();
|
||||
bone->getTween()->setAnimationScale(_animationScale);
|
||||
CCBone *bone = (CCBone *)element->getObject();
|
||||
|
||||
bone->getTween()->setProcessScale(m_fProcessScale);
|
||||
if (bone->getChildArmature())
|
||||
{
|
||||
bone->getChildArmature()->getAnimation()->setAnimationScale(_animationScale);
|
||||
bone->getChildArmature()->getAnimation()->setProcessScale(m_fProcessScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float CCArmatureAnimation::getSpeedScale() const
|
||||
{
|
||||
return m_fSpeedScale;
|
||||
}
|
||||
|
||||
void CCArmatureAnimation::setAnimationInternal(float animationInternal)
|
||||
{
|
||||
if(animationInternal == m_fAnimationInternal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_fAnimationInternal = animationInternal;
|
||||
|
||||
DictElement *element = NULL;
|
||||
Dictionary *dict = m_pArmature->getBoneDic();
|
||||
CCDICT_FOREACH(dict, element)
|
||||
{
|
||||
CCBone *bone = (CCBone *)element->getObject();
|
||||
bone->getTween()->setAnimationInternal(m_fAnimationInternal);
|
||||
if (bone->getChildArmature())
|
||||
{
|
||||
bone->getChildArmature()->getAnimation()->setAnimationInternal(m_fAnimationInternal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ArmatureAnimation::play(const char *animationName, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
void CCArmatureAnimation::play(const char *animationName, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
CCASSERT(_animationData, "_animationData can not be null");
|
||||
CCAssert(m_pAnimationData, "m_pAnimationData can not be null");
|
||||
|
||||
_movementData = _animationData->getMovement(animationName);
|
||||
CCASSERT(_movementData, "_movementData can not be null");
|
||||
m_pMovementData = m_pAnimationData->getMovement(animationName);
|
||||
CCAssert(m_pMovementData, "m_pMovementData can not be null");
|
||||
|
||||
//! Get key frame count
|
||||
_rawDuration = _movementData->duration;
|
||||
m_iRawDuration = m_pMovementData->duration;
|
||||
|
||||
_movementID = animationName;
|
||||
m_strMovementID = animationName;
|
||||
|
||||
m_fProcessScale = m_fSpeedScale * m_pMovementData->scale;
|
||||
|
||||
//! Further processing parameters
|
||||
durationTo = (durationTo == -1) ? _movementData->durationTo : durationTo;
|
||||
durationTo = (durationTo == -1) ? m_pMovementData->durationTo : durationTo;
|
||||
|
||||
durationTween = (durationTween == -1) ? _movementData->durationTween : durationTween;
|
||||
durationTween = (durationTween == 0) ? _movementData->duration : durationTween;
|
||||
durationTween = (durationTween == -1) ? m_pMovementData->durationTween : durationTween;
|
||||
durationTween = (durationTween == 0) ? m_pMovementData->duration : durationTween;
|
||||
|
||||
tweenEasing = (tweenEasing == TWEEN_EASING_MAX) ? _movementData->tweenEasing : tweenEasing;
|
||||
loop = (loop < 0) ? _movementData->loop : loop;
|
||||
tweenEasing = (tweenEasing == TWEEN_EASING_MAX) ? m_pMovementData->tweenEasing : tweenEasing;
|
||||
loop = (loop < 0) ? m_pMovementData->loop : loop;
|
||||
|
||||
|
||||
ProcessBase::play((void *)animationName, durationTo, durationTween, loop, tweenEasing);
|
||||
CCProcessBase::play((void *)animationName, durationTo, durationTween, loop, tweenEasing);
|
||||
|
||||
|
||||
if (_rawDuration == 1)
|
||||
if (m_iRawDuration == 0)
|
||||
{
|
||||
_loopType = SINGLE_FRAME;
|
||||
m_eLoopType = SINGLE_FRAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
_loopType = ANIMATION_TO_LOOP_FRONT;
|
||||
m_eLoopType = ANIMATION_TO_LOOP_FRONT;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loopType = ANIMATION_NO_LOOP;
|
||||
_rawDuration --;
|
||||
m_eLoopType = ANIMATION_NO_LOOP;
|
||||
m_iRawDuration --;
|
||||
}
|
||||
_durationTween = durationTween;
|
||||
m_iDurationTween = durationTween;
|
||||
}
|
||||
|
||||
MovementBoneData *movementBoneData = NULL;
|
||||
_tweenList->removeAllObjects();
|
||||
CCMovementBoneData *movementBoneData = NULL;
|
||||
m_pTweenList->removeAllObjects();
|
||||
|
||||
DictElement *element = NULL;
|
||||
Dictionary *dict = _armature->getBoneDic();
|
||||
Dictionary *dict = m_pArmature->getBoneDic();
|
||||
|
||||
CCDICT_FOREACH(dict, element)
|
||||
{
|
||||
Bone *bone = (Bone *)element->getObject();
|
||||
movementBoneData = (MovementBoneData *)_movementData->movBoneDataDic->objectForKey(bone->getName());
|
||||
CCBone *bone = (CCBone *)element->getObject();
|
||||
movementBoneData = (CCMovementBoneData *)m_pMovementData->movBoneDataDic.objectForKey(bone->getName());
|
||||
|
||||
Tween *tween = bone->getTween();
|
||||
if(movementBoneData && movementBoneData->frameList->count() > 0)
|
||||
CCTween *tween = bone->getTween();
|
||||
if(movementBoneData && movementBoneData->frameList.count() > 0)
|
||||
{
|
||||
_tweenList->addObject(tween);
|
||||
m_pTweenList->addObject(tween);
|
||||
movementBoneData->duration = m_pMovementData->duration;
|
||||
tween->play(movementBoneData, durationTo, durationTween, loop, tweenEasing);
|
||||
|
||||
tween->setAnimationScale(_animationScale);
|
||||
tween->setProcessScale(m_fProcessScale);
|
||||
tween->setAnimationInternal(m_fAnimationInternal);
|
||||
|
||||
if (bone->getChildArmature())
|
||||
{
|
||||
bone->getChildArmature()->getAnimation()->setAnimationScale(_animationScale);
|
||||
bone->getChildArmature()->getAnimation()->setProcessScale(m_fProcessScale);
|
||||
bone->getChildArmature()->getAnimation()->setAnimationInternal(m_fAnimationInternal);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -212,14 +266,12 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
//_armature->update(0);
|
||||
}
|
||||
|
||||
|
||||
void ArmatureAnimation::playByIndex(int animationIndex, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
void CCArmatureAnimation::playByIndex(int animationIndex, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
std::vector<std::string> &movName = _animationData->movementNames;
|
||||
std::vector<std::string> &movName = m_pAnimationData->movementNames;
|
||||
CC_ASSERT((animationIndex > -1) && ((unsigned int)animationIndex < movName.size()));
|
||||
|
||||
std::string animationName = movName.at(animationIndex);
|
||||
|
@ -228,41 +280,44 @@ void ArmatureAnimation::playByIndex(int animationIndex, int durationTo, int dura
|
|||
|
||||
|
||||
|
||||
int ArmatureAnimation::getMovementCount()
|
||||
int CCArmatureAnimation::getMovementCount()
|
||||
{
|
||||
return _animationData->getMovementCount();
|
||||
return m_pAnimationData->getMovementCount();
|
||||
}
|
||||
|
||||
void ArmatureAnimation::update(float dt)
|
||||
void CCArmatureAnimation::update(float dt)
|
||||
{
|
||||
ProcessBase::update(dt);
|
||||
CCProcessBase::update(dt);
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_tweenList, object)
|
||||
CCARRAY_FOREACH(m_pTweenList, object)
|
||||
{
|
||||
static_cast<Tween *>(object)->update(dt);
|
||||
((CCTween *)object)->update(dt);
|
||||
}
|
||||
}
|
||||
|
||||
void ArmatureAnimation::updateHandler()
|
||||
void CCArmatureAnimation::updateHandler()
|
||||
{
|
||||
if (_currentPercent >= 1)
|
||||
if (m_fCurrentPercent >= 1)
|
||||
{
|
||||
switch(_loopType)
|
||||
switch(m_eLoopType)
|
||||
{
|
||||
case ANIMATION_NO_LOOP:
|
||||
{
|
||||
_loopType = ANIMATION_MAX;
|
||||
_currentFrame = (_currentPercent - 1) * _nextFrameIndex;
|
||||
_currentPercent = _currentFrame / _durationTween;
|
||||
m_eLoopType = ANIMATION_MAX;
|
||||
m_fCurrentFrame = (m_fCurrentPercent - 1) * m_iNextFrameIndex;
|
||||
m_fCurrentPercent = m_fCurrentFrame / m_iDurationTween;
|
||||
|
||||
if (_currentPercent >= 1.0f)
|
||||
if (m_fCurrentPercent >= 1.0f)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
_nextFrameIndex = _durationTween;
|
||||
m_iNextFrameIndex = m_iDurationTween;
|
||||
|
||||
MovementEventSignal.emit(_armature, START, _movementID.c_str());
|
||||
if (m_sMovementEventTarget && m_sMovementEventCallFunc)
|
||||
{
|
||||
(m_sMovementEventTarget->*m_sMovementEventCallFunc)(m_pArmature, START, m_strMovementID.c_str());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -271,47 +326,81 @@ void ArmatureAnimation::updateHandler()
|
|||
case ANIMATION_MAX:
|
||||
case SINGLE_FRAME:
|
||||
{
|
||||
_currentPercent = 1;
|
||||
_isComplete = true;
|
||||
m_fCurrentPercent = 1;
|
||||
m_bIsComplete = true;
|
||||
m_bIsPlaying = false;
|
||||
|
||||
MovementEventSignal.emit(_armature, COMPLETE, _movementID.c_str());
|
||||
if (m_sMovementEventTarget && m_sMovementEventCallFunc)
|
||||
{
|
||||
(m_sMovementEventTarget->*m_sMovementEventCallFunc)(m_pArmature, COMPLETE, m_strMovementID.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ANIMATION_TO_LOOP_FRONT:
|
||||
{
|
||||
_loopType = ANIMATION_LOOP_FRONT;
|
||||
_currentPercent = fmodf(_currentPercent, 1);
|
||||
_currentFrame = fmodf(_currentFrame, _nextFrameIndex);
|
||||
_nextFrameIndex = _durationTween > 0 ? _durationTween : 1;
|
||||
m_eLoopType = ANIMATION_LOOP_FRONT;
|
||||
m_fCurrentPercent = fmodf(m_fCurrentPercent, 1);
|
||||
m_fCurrentFrame = m_iNextFrameIndex == 0 ? 0 : fmodf(m_fCurrentFrame, m_iNextFrameIndex);
|
||||
m_iNextFrameIndex = m_iDurationTween > 0 ? m_iDurationTween : 1;
|
||||
|
||||
MovementEventSignal.emit(_armature, START, _movementID.c_str());
|
||||
if (m_sMovementEventTarget && m_sMovementEventCallFunc)
|
||||
{
|
||||
(m_sMovementEventTarget->*m_sMovementEventCallFunc)(m_pArmature, START, m_strMovementID.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
_currentPercent = fmodf(_currentPercent, 1);
|
||||
_currentFrame = fmodf(_currentFrame, _nextFrameIndex);
|
||||
_toIndex = 0;
|
||||
//m_fCurrentPercent = fmodf(m_fCurrentPercent, 1);
|
||||
m_fCurrentFrame = fmodf(m_fCurrentFrame, m_iNextFrameIndex);
|
||||
m_iToIndex = 0;
|
||||
|
||||
MovementEventSignal.emit(_armature, LOOP_COMPLETE, _movementID.c_str());
|
||||
if (m_sMovementEventTarget && m_sMovementEventCallFunc)
|
||||
{
|
||||
(m_sMovementEventTarget->*m_sMovementEventCallFunc)(m_pArmature, LOOP_COMPLETE, m_strMovementID.c_str());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_loopType == ANIMATION_LOOP_FRONT || _loopType == ANIMATION_LOOP_BACK)
|
||||
std::string CCArmatureAnimation::getCurrentMovementID()
|
||||
{
|
||||
if (m_bIsComplete)
|
||||
{
|
||||
updateFrameData(_currentPercent);
|
||||
return "";
|
||||
}
|
||||
return m_strMovementID;
|
||||
}
|
||||
|
||||
void CCArmatureAnimation::setMovementEventCallFunc(Object *target, SEL_MovementEventCallFunc callFunc)
|
||||
{
|
||||
if (target != m_sMovementEventTarget)
|
||||
{
|
||||
CC_SAFE_RETAIN(target);
|
||||
CC_SAFE_RELEASE_NULL(m_sMovementEventTarget);
|
||||
m_sMovementEventTarget = target;
|
||||
}
|
||||
m_sMovementEventCallFunc = callFunc;
|
||||
}
|
||||
|
||||
void CCArmatureAnimation::setFrameEventCallFunc(Object *target, SEL_FrameEventCallFunc callFunc)
|
||||
{
|
||||
if (target != m_sFrameEventTarget)
|
||||
{
|
||||
CC_SAFE_RETAIN(target);
|
||||
CC_SAFE_RELEASE_NULL(m_sFrameEventTarget);
|
||||
m_sFrameEventTarget = target;
|
||||
}
|
||||
m_sFrameEventCallFunc = callFunc;
|
||||
}
|
||||
|
||||
void CCArmatureAnimation::frameEvent(CCBone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex)
|
||||
{
|
||||
if (m_sFrameEventTarget && m_sFrameEventCallFunc)
|
||||
{
|
||||
(m_sFrameEventTarget->*m_sFrameEventCallFunc)(bone, frameEventName, originFrameIndex, currentFrameIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ArmatureAnimation::updateFrameData(float currentPercent)
|
||||
{
|
||||
_prevFrameIndex = _curFrameIndex;
|
||||
_curFrameIndex = _rawDuration * currentPercent;
|
||||
_curFrameIndex = _curFrameIndex % _rawDuration;
|
||||
}
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -27,52 +27,62 @@ THE SOFTWARE.
|
|||
#define __CCANIMATION_H__
|
||||
|
||||
#include "CCProcessBase.h"
|
||||
#include "../external_tool/sigslot.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
|
||||
enum MovementEventType
|
||||
{
|
||||
START,
|
||||
COMPLETE,
|
||||
LOOP_COMPLETE
|
||||
START,
|
||||
COMPLETE,
|
||||
LOOP_COMPLETE
|
||||
};
|
||||
|
||||
|
||||
class Armature;
|
||||
class Bone;
|
||||
class CCArmature;
|
||||
class CCBone;
|
||||
|
||||
class ArmatureAnimation : public ProcessBase
|
||||
typedef void (Object::*SEL_MovementEventCallFunc)(CCArmature *, MovementEventType, const char *);
|
||||
typedef void (Object::*SEL_FrameEventCallFunc)(CCBone *, const char *, int, int);
|
||||
|
||||
#define movementEvent_selector(_SELECTOR) (SEL_MovementEventCallFunc)(&_SELECTOR)
|
||||
#define frameEvent_selector(_SELECTOR) (SEL_FrameEventCallFunc)(&_SELECTOR)
|
||||
|
||||
|
||||
class CCArmatureAnimation : public CCProcessBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create with a Armature
|
||||
* @param armature The Armature ArmatureAnimation will bind to
|
||||
* Create with a CCArmature
|
||||
* @param armature The CCArmature CCArmatureAnimation will bind to
|
||||
*/
|
||||
static ArmatureAnimation *create(Armature *armature);
|
||||
static CCArmatureAnimation *create(CCArmature *armature);
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ArmatureAnimation();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ArmatureAnimation(void);
|
||||
CCArmatureAnimation();
|
||||
virtual ~CCArmatureAnimation(void);
|
||||
|
||||
/**
|
||||
* Init with a Armature
|
||||
* @param armature The Armature ArmatureAnimation will bind to
|
||||
* Init with a CCArmature
|
||||
* @param armature The CCArmature CCArmatureAnimation will bind to
|
||||
*/
|
||||
virtual bool init(Armature *armature);
|
||||
virtual bool init(CCArmature *armature);
|
||||
|
||||
/**
|
||||
* Scale animation play speed.
|
||||
* @param animationScale Scale value
|
||||
*/
|
||||
virtual void setAnimationScale(float animationScale);
|
||||
virtual float getAnimationScale() const;
|
||||
|
||||
/**
|
||||
* Scale animation play speed.
|
||||
* @param animationScale Scale value
|
||||
*/
|
||||
virtual void setSpeedScale(float speedScale);
|
||||
virtual float getSpeedScale() const;
|
||||
|
||||
//! The animation update speed
|
||||
virtual void setAnimationInternal(float animationInternal);
|
||||
|
||||
/**
|
||||
* Play animation by animation name.
|
||||
|
@ -81,21 +91,21 @@ public:
|
|||
* @param durationTo The frames between two animation changing-over.
|
||||
* It's meaning is changing to this animation need how many frames
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* -1 : use the value from CCMovementData get from flash design panel
|
||||
* @param durationTween The frame count you want to play in the game.
|
||||
* if _durationTween is 80, then the animation will played 80 frames in a loop
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* -1 : use the value from CCMovementData get from flash design panel
|
||||
*
|
||||
* @param loop Whether the animation is loop
|
||||
*
|
||||
* loop < 0 : use the value from MovementData get from flash design panel
|
||||
* loop < 0 : use the value from CCMovementData get from flash design panel
|
||||
* loop = 0 : this animation is not loop
|
||||
* loop > 0 : this animation is loop
|
||||
*
|
||||
* @param tweenEasing Tween easing is used for calculate easing effect
|
||||
* @param tweenEasing CCTween easing is used for calculate easing effect
|
||||
*
|
||||
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
|
||||
* TWEEN_EASING_MAX : use the value from CCMovementData get from flash design panel
|
||||
* -1 : fade out
|
||||
* 0 : line
|
||||
* 1 : fade in
|
||||
|
@ -106,7 +116,7 @@ public:
|
|||
|
||||
/**
|
||||
* Play animation by index, the other param is the same to play.
|
||||
* @param animationIndex the animation index you want to play
|
||||
* @param _animationIndex the animation index you want to play
|
||||
*/
|
||||
void playByIndex(int animationIndex, int durationTo = -1, int durationTween = -1, int loop = -1, int tweenEasing = TWEEN_EASING_MAX);
|
||||
|
||||
|
@ -130,6 +140,25 @@ public:
|
|||
int getMovementCount();
|
||||
|
||||
void update(float dt);
|
||||
|
||||
/**
|
||||
* Get current movementID
|
||||
* @return The name of current movement
|
||||
*/
|
||||
std::string getCurrentMovementID();
|
||||
|
||||
/**
|
||||
* Set armature's movement event callback function
|
||||
* To disconnect this event, just setMovementEventCallFunc(NULL, NULL);
|
||||
*/
|
||||
void setMovementEventCallFunc(Object *target, SEL_MovementEventCallFunc callFunc);
|
||||
|
||||
/**
|
||||
* Set armature's frame event callback function
|
||||
* To disconnect this event, just setFrameEventCallFunc(NULL, NULL);
|
||||
*/
|
||||
void setFrameEventCallFunc(Object *target, SEL_FrameEventCallFunc callFunc);
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
@ -142,31 +171,52 @@ protected:
|
|||
*/
|
||||
void updateFrameData(float currentPercent);
|
||||
|
||||
protected:
|
||||
//! AnimationData save all MovementDatas this animation used.
|
||||
CC_SYNTHESIZE_RETAIN(AnimationData *, _animationData, AnimationData);
|
||||
|
||||
|
||||
MovementData *_movementData; //! MovementData save all MovementFrameDatas this animation used.
|
||||
|
||||
Armature *_armature; //! A weak reference of armature
|
||||
|
||||
std::string _movementID; //! Current movment's name
|
||||
|
||||
int _prevFrameIndex; //! Prev key frame index
|
||||
int _toIndex; //! The frame index in MovementData->_movFrameDataArr, it's different from _frameIndex.
|
||||
|
||||
Array *_tweenList;
|
||||
public:
|
||||
/**
|
||||
* MovementEvent signal. This will emit a signal when trigger a event.
|
||||
* The 1st param is the Armature. The 2nd param is Event Type, like START, COMPLETE. The 3rd param is Movement ID, also called Movement Name.
|
||||
* Emit a frame event
|
||||
*/
|
||||
sigslot::signal3<Armature *, MovementEventType, const char *> MovementEventSignal;
|
||||
void frameEvent(CCBone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex);
|
||||
|
||||
sigslot::signal2<Bone *, const char *> FrameEventSignal;
|
||||
friend class CCTween;
|
||||
protected:
|
||||
//! CCAnimationData save all MovementDatas this animation used.
|
||||
CC_SYNTHESIZE_RETAIN(CCAnimationData *, m_pAnimationData, AnimationData);
|
||||
|
||||
//! Scale the animation speed
|
||||
float m_fSpeedScale;
|
||||
|
||||
CCMovementData *m_pMovementData; //! CCMovementData save all MovementFrameDatas this animation used.
|
||||
|
||||
CCArmature *m_pArmature; //! A weak reference of armature
|
||||
|
||||
std::string m_strMovementID; //! Current movment's name
|
||||
|
||||
int m_iToIndex; //! The frame index in CCMovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.
|
||||
|
||||
Array *m_pTweenList;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* MovementEvent CallFunc.
|
||||
* @param CCArmature* a CCArmature
|
||||
* @param MovementEventType, Event Type, like START, COMPLETE.
|
||||
* @param const char*, Movement ID, also called Movement Name
|
||||
*/
|
||||
SEL_MovementEventCallFunc m_sMovementEventCallFunc;
|
||||
|
||||
/**
|
||||
* FrameEvent CallFunc.
|
||||
* @param CCBone*, a CCBone
|
||||
* @param const char*, the name of this frame event
|
||||
* @param int, origin frame index
|
||||
* @param int, current frame index, animation may be delayed
|
||||
*/
|
||||
SEL_FrameEventCallFunc m_sFrameEventCallFunc;
|
||||
|
||||
|
||||
Object *m_sMovementEventTarget;
|
||||
Object *m_sFrameEventTarget;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCANIMATION_H__*/
|
||||
|
|
|
@ -25,121 +25,128 @@ THE SOFTWARE.
|
|||
#include "CCProcessBase.h"
|
||||
#include "../utils/CCUtilMath.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
ProcessBase::ProcessBase(void)
|
||||
: _animationScale(1)
|
||||
, _isPause(true)
|
||||
, _isComplete(true)
|
||||
, _isPlaying(false)
|
||||
, _currentPercent(0.0f)
|
||||
, _rawDuration(0)
|
||||
, _loopType(ANIMATION_LOOP_BACK)
|
||||
, _tweenEasing(Linear)
|
||||
, _durationTween(0)
|
||||
, _currentFrame(0)
|
||||
, _curFrameIndex(0)
|
||||
, _isLoopBack(false)
|
||||
CCProcessBase::CCProcessBase(void)
|
||||
: m_fProcessScale(1)
|
||||
, m_bIsPause(true)
|
||||
, m_bIsComplete(true)
|
||||
, m_bIsPlaying(false)
|
||||
, m_fCurrentPercent(0.0f)
|
||||
, m_iRawDuration(0)
|
||||
, m_eLoopType(ANIMATION_LOOP_BACK)
|
||||
, m_eTweenEasing(Linear)
|
||||
, m_iDurationTween(0)
|
||||
, m_fCurrentFrame(0)
|
||||
, m_iCurFrameIndex(0)
|
||||
, m_bIsLoopBack(false)
|
||||
{
|
||||
/*
|
||||
* set _animationInternal defualt value to Director::getInstance()
|
||||
* set m_fAnimationInternal defualt value to CCDirector::sharedDirector()
|
||||
* ->getAnimationInterval(), in line with game update speed
|
||||
*/
|
||||
_animationInternal = Director::getInstance()->getAnimationInterval();
|
||||
m_fAnimationInternal = CCDirector::getInstance()->getAnimationInterval();
|
||||
}
|
||||
|
||||
|
||||
ProcessBase::~ProcessBase(void)
|
||||
CCProcessBase::~CCProcessBase(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void ProcessBase::pause()
|
||||
void CCProcessBase::pause()
|
||||
{
|
||||
_isPause = true;
|
||||
m_bIsPause = true;
|
||||
m_bIsPlaying = false;
|
||||
}
|
||||
|
||||
|
||||
void ProcessBase::resume()
|
||||
void CCProcessBase::resume()
|
||||
{
|
||||
_isPause = false;
|
||||
m_bIsPause = false;
|
||||
m_bIsPlaying = true;
|
||||
}
|
||||
|
||||
void ProcessBase::stop()
|
||||
void CCProcessBase::stop()
|
||||
{
|
||||
_isComplete = true;
|
||||
_currentFrame = 0;
|
||||
_currentPercent = 0;
|
||||
m_bIsComplete = true;
|
||||
m_bIsPlaying = false;
|
||||
m_fCurrentFrame = 0;
|
||||
m_fCurrentPercent = 0;
|
||||
}
|
||||
|
||||
void ProcessBase::play(void *animation, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
void CCProcessBase::play(void *animation, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
_isComplete = false;
|
||||
_isPause = false;
|
||||
_isPlaying = true;
|
||||
_currentFrame = 0;
|
||||
m_bIsComplete = false;
|
||||
m_bIsPause = false;
|
||||
m_bIsPlaying = true;
|
||||
m_fCurrentFrame = 0;
|
||||
|
||||
/*
|
||||
* Set _totalFrames to durationTo, it is used for change tween between two animation.
|
||||
* When changing end, _totalFrames will be setted to _durationTween
|
||||
* Set m_iTotalFrames to durationTo, it is used for change tween between two animation.
|
||||
* When changing end, m_iTotalFrames will be setted to _durationTween
|
||||
*/
|
||||
_nextFrameIndex = durationTo;
|
||||
_tweenEasing = (TweenType)tweenEasing;
|
||||
m_iNextFrameIndex = durationTo;
|
||||
m_eTweenEasing = (CCTweenType)tweenEasing;
|
||||
|
||||
}
|
||||
|
||||
void ProcessBase::update(float dt)
|
||||
void CCProcessBase::update(float dt)
|
||||
{
|
||||
|
||||
if (_isComplete || _isPause)
|
||||
if (m_bIsComplete || m_bIsPause)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fileter the _duration <=0 and dt >1
|
||||
* Fileter the m_iDuration <=0 and dt >1
|
||||
* If dt>1, generally speaking the reason is the device is stuck.
|
||||
*/
|
||||
if(_rawDuration <= 0 || dt > 1)
|
||||
if(m_iRawDuration <= 0 || dt > 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_nextFrameIndex <= 0)
|
||||
if (m_iNextFrameIndex <= 0)
|
||||
{
|
||||
_currentFrame = _nextFrameIndex = 1;
|
||||
m_fCurrentPercent = 1;
|
||||
m_fCurrentFrame = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* update _currentFrame, every update add the frame passed.
|
||||
* dt/_animationInternal determine it is not a frame animation. If frame speed changed, it will not make our
|
||||
* animation speed slower or quicker.
|
||||
*/
|
||||
_currentFrame += _animationScale * (dt / _animationInternal);
|
||||
else
|
||||
{
|
||||
/*
|
||||
* update m_fCurrentFrame, every update add the frame passed.
|
||||
* dt/m_fAnimationInternal determine it is not a frame animation. If frame speed changed, it will not make our
|
||||
* animation speed slower or quicker.
|
||||
*/
|
||||
m_fCurrentFrame += m_fProcessScale * (dt / m_fAnimationInternal);
|
||||
|
||||
|
||||
_currentPercent = _currentFrame / _nextFrameIndex;
|
||||
m_fCurrentPercent = m_fCurrentFrame / m_iNextFrameIndex;
|
||||
|
||||
/*
|
||||
* if _currentFrame is bigger or equal than _totalFrames, then reduce it util _currentFrame is
|
||||
* smaller than _totalFrames
|
||||
*/
|
||||
_currentFrame = fmodf(_currentFrame, _nextFrameIndex);
|
||||
/*
|
||||
* if m_fCurrentFrame is bigger or equal than m_iTotalFrames, then reduce it util m_fCurrentFrame is
|
||||
* smaller than m_iTotalFrames
|
||||
*/
|
||||
m_fCurrentFrame = fmodf(m_fCurrentFrame, m_iNextFrameIndex);
|
||||
}
|
||||
|
||||
updateHandler();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ProcessBase::gotoFrame(int frameIndex)
|
||||
void CCProcessBase::gotoFrame(int frameIndex)
|
||||
{
|
||||
_curFrameIndex = frameIndex;
|
||||
stop();
|
||||
m_iCurFrameIndex = frameIndex;
|
||||
pause();
|
||||
}
|
||||
|
||||
int ProcessBase::getCurrentFrameIndex()
|
||||
int CCProcessBase::getCurrentFrameIndex()
|
||||
{
|
||||
return _curFrameIndex;
|
||||
m_iCurFrameIndex = m_iRawDuration * m_fCurrentPercent;
|
||||
return m_iCurFrameIndex;
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,7 +29,7 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
enum AnimationType
|
||||
{
|
||||
|
@ -47,41 +47,34 @@ enum AnimationType
|
|||
};
|
||||
|
||||
|
||||
class ProcessBase : public Object
|
||||
class CCProcessBase : public Object
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ProcessBase(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ProcessBase(void);
|
||||
CCProcessBase(void);
|
||||
~CCProcessBase(void);
|
||||
|
||||
/**
|
||||
* Play animation by animation name.
|
||||
*
|
||||
* @param animation It will not used in the ProcessBase Class
|
||||
* @param animation It will not used in the CCProcessBase Class
|
||||
* @param durationTo The frames between two animation changing-over.
|
||||
* It's meaning is changing to this animation need how many frames
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* -1 : use the value from CCMovementData get from flash design panel
|
||||
* @param durationTween The frame count you want to play in the game.
|
||||
* if _durationTween is 80, then the animation will played 80 frames in a loop
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* -1 : use the value from CCMovementData get from flash design panel
|
||||
*
|
||||
* @param loop Whether the animation is loop
|
||||
*
|
||||
* loop < 0 : use the value from MovementData get from flash design panel
|
||||
* loop < 0 : use the value from CCMovementData get from flash design panel
|
||||
* loop = 0 : this animation is not loop
|
||||
* loop > 0 : this animation is loop
|
||||
*
|
||||
* @param tweenEasing Tween easing is used for calculate easing effect
|
||||
* @param tweenEasing CCTween easing is used for calculate easing effect
|
||||
*
|
||||
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
|
||||
* TWEEN_EASING_MAX : use the value from CCMovementData get from flash design panel
|
||||
* -1 : fade out
|
||||
* 0 : line
|
||||
* 1 : fade in
|
||||
|
@ -110,7 +103,7 @@ public:
|
|||
* You should never call this function, unless you know what you do
|
||||
* Update the Process, include current process, current frame and son on
|
||||
*
|
||||
* @param dt The duration since last update
|
||||
* @param The duration since last update
|
||||
*/
|
||||
virtual void update(float dt);
|
||||
|
||||
|
@ -125,50 +118,50 @@ protected:
|
|||
virtual void updateHandler() {};
|
||||
|
||||
protected:
|
||||
//! Scale the animation speed
|
||||
CC_SYNTHESIZE_PASS_BY_REF(float, _animationScale, AnimationScale);
|
||||
//! Scale the process speed
|
||||
CC_SYNTHESIZE(float, m_fProcessScale, ProcessScale);
|
||||
|
||||
//! Set and get whether the aniamtion is pause
|
||||
CC_SYNTHESIZE_PASS_BY_REF(bool, _isPause, IsPause);
|
||||
CC_SYNTHESIZE(bool, m_bIsPause, IsPause);
|
||||
|
||||
//! Set and get whether the aniamtion is complete
|
||||
CC_SYNTHESIZE_PASS_BY_REF(bool, _isComplete, IsComplete);
|
||||
CC_SYNTHESIZE(bool, m_bIsComplete, IsComplete);
|
||||
|
||||
//! Set and get whether the aniamtion is playing
|
||||
CC_SYNTHESIZE_PASS_BY_REF(bool, _isPlaying, IsPlaying);
|
||||
CC_SYNTHESIZE(bool, m_bIsPlaying, IsPlaying);
|
||||
|
||||
//! Current percent this process arrived
|
||||
CC_SYNTHESIZE_PASS_BY_REF(float, _currentPercent, CurrentPercent);
|
||||
CC_SYNTHESIZE(float, m_fCurrentPercent, CurrentPercent);
|
||||
|
||||
//! The raw duration
|
||||
CC_SYNTHESIZE_PASS_BY_REF(int, _rawDuration, RawDuration);
|
||||
CC_SYNTHESIZE(int, m_iRawDuration, RawDuration);
|
||||
|
||||
//! The animation whether or not loop
|
||||
CC_SYNTHESIZE_PASS_BY_REF(AnimationType, _loopType, LoopType);
|
||||
CC_SYNTHESIZE(AnimationType, m_eLoopType, LoopType);
|
||||
|
||||
//! The tween easing effect
|
||||
CC_SYNTHESIZE_PASS_BY_REF(TweenType, _tweenEasing, TweenEasing);
|
||||
CC_SYNTHESIZE(CCTweenType, m_eTweenEasing, TweenEasing);
|
||||
|
||||
//! The animation update speed
|
||||
CC_SYNTHESIZE_PASS_BY_REF(float, _animationInternal, AnimationInternal);
|
||||
CC_SYNTHESIZE(float, m_fAnimationInternal, AnimationInternal);
|
||||
|
||||
|
||||
protected:
|
||||
//! The durantion frame count will run
|
||||
int _durationTween;
|
||||
int m_iDurationTween;
|
||||
|
||||
//! Current frame this process arrived, this frame is tween frame
|
||||
float _currentFrame;
|
||||
float m_fCurrentFrame;
|
||||
//! Frame index it the time line
|
||||
int _curFrameIndex;
|
||||
int m_iCurFrameIndex;
|
||||
|
||||
//! Next frame this process need run to
|
||||
int _nextFrameIndex;
|
||||
int m_iNextFrameIndex;
|
||||
|
||||
|
||||
bool _isLoopBack;
|
||||
bool m_bIsLoopBack;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCPROCESSBASE_H__*/
|
||||
|
|
|
@ -29,13 +29,14 @@ THE SOFTWARE.
|
|||
#include "../CCArmature.h"
|
||||
#include "../utils/CCUtilMath.h"
|
||||
#include "../utils/CCTweenFunction.h"
|
||||
#include "../utils/CCTransformHelp.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
Tween *Tween::create(Bone *bone)
|
||||
CCTween *CCTween::create(CCBone *bone)
|
||||
{
|
||||
Tween *pTween = new Tween();
|
||||
CCTween *pTween = new CCTween();
|
||||
if (pTween && pTween->init(bone))
|
||||
{
|
||||
pTween->autorelease();
|
||||
|
@ -48,43 +49,43 @@ Tween *Tween::create(Bone *bone)
|
|||
|
||||
|
||||
|
||||
Tween::Tween()
|
||||
: _movementBoneData(NULL)
|
||||
, _tweenData(NULL)
|
||||
, _from(NULL)
|
||||
, _to(NULL)
|
||||
, _between(NULL)
|
||||
, _currentKeyFrame(NULL)
|
||||
, _bone(NULL)
|
||||
|
||||
, _frameTweenEasing(Linear)
|
||||
, _fromIndex(0)
|
||||
, _toIndex(0)
|
||||
, _animation(NULL)
|
||||
CCTween::CCTween()
|
||||
: m_pMovementBoneData(NULL)
|
||||
, m_pTweenData(NULL)
|
||||
, m_pFrom(NULL)
|
||||
, m_pTo(NULL)
|
||||
, m_pBetween(NULL)
|
||||
, m_pBone(NULL)
|
||||
|
||||
, m_eFrameTweenEasing(Linear)
|
||||
, m_iFromIndex(0)
|
||||
, m_iToIndex(0)
|
||||
, m_pAnimation(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Tween::~Tween(void)
|
||||
CCTween::~CCTween(void)
|
||||
{
|
||||
CC_SAFE_DELETE( _from );
|
||||
CC_SAFE_DELETE( _between );
|
||||
CC_SAFE_DELETE( m_pFrom );
|
||||
CC_SAFE_DELETE( m_pBetween );
|
||||
}
|
||||
|
||||
|
||||
bool Tween::init(Bone *bone)
|
||||
bool CCTween::init(CCBone *bone)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
_from = new FrameData();
|
||||
_between = new FrameData();
|
||||
m_pFrom = new CCFrameData();
|
||||
m_pBetween = new CCFrameData();
|
||||
|
||||
_bone = bone;
|
||||
_tweenData = _bone->getTweenData();
|
||||
m_pBone = bone;
|
||||
m_pTweenData = m_pBone->getTweenData();
|
||||
m_pTweenData->displayIndex = -1;
|
||||
|
||||
_animation = _bone->getArmature() != NULL ? _bone->getArmature()->getAnimation() : NULL;
|
||||
m_pAnimation = m_pBone->getArmature() != NULL ? m_pBone->getArmature()->getAnimation() : NULL;
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -94,200 +95,201 @@ bool Tween::init(Bone *bone)
|
|||
}
|
||||
|
||||
|
||||
void Tween::play(MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
void CCTween::play(CCMovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing)
|
||||
{
|
||||
ProcessBase::play(NULL, durationTo, durationTween, loop, tweenEasing);
|
||||
CCProcessBase::play(NULL, durationTo, durationTween, loop, tweenEasing);
|
||||
|
||||
_loopType = (AnimationType)loop;
|
||||
m_eLoopType = (AnimationType)loop;
|
||||
|
||||
_currentKeyFrame = NULL;
|
||||
_isTweenKeyFrame = false;
|
||||
m_iTotalDuration = 0;
|
||||
m_iBetweenDuration = 0;
|
||||
m_iFromIndex = m_iToIndex = 0;
|
||||
|
||||
_totalDuration = 0;
|
||||
betweenDuration = 0;
|
||||
_toIndex = 0;
|
||||
bool difMovement = movementBoneData != m_pMovementBoneData;
|
||||
|
||||
setMovementBoneData(movementBoneData);
|
||||
m_iRawDuration = m_pMovementBoneData->duration;
|
||||
|
||||
CCFrameData *nextKeyFrame = m_pMovementBoneData->getFrameData(0);
|
||||
m_pTweenData->displayIndex = nextKeyFrame->displayIndex;
|
||||
|
||||
if (_movementBoneData->frameList->count() == 1)
|
||||
if (m_pBone->getArmature()->getArmatureData()->dataVersion >= VERSION_COMBINED)
|
||||
{
|
||||
_loopType = SINGLE_FRAME;
|
||||
FrameData *_nextKeyFrame = _movementBoneData->getFrameData(0);
|
||||
CCTransformHelp::nodeSub(*m_pTweenData, *m_pBone->getBoneData());
|
||||
m_pTweenData->scaleX += 1;
|
||||
m_pTweenData->scaleY += 1;
|
||||
}
|
||||
|
||||
if (m_iRawDuration == 0 )
|
||||
{
|
||||
m_eLoopType = SINGLE_FRAME;
|
||||
if(durationTo == 0)
|
||||
{
|
||||
setBetween(_nextKeyFrame, _nextKeyFrame);
|
||||
setBetween(nextKeyFrame, nextKeyFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tweenData->displayIndex = _nextKeyFrame->displayIndex;
|
||||
setBetween(_tweenData, _nextKeyFrame);
|
||||
setBetween(m_pTweenData, nextKeyFrame);
|
||||
}
|
||||
_isTweenKeyFrame = true;
|
||||
_frameTweenEasing = Linear;
|
||||
_rawDuration = _movementBoneData->duration;
|
||||
_fromIndex = _toIndex = 0;
|
||||
m_eFrameTweenEasing = Linear;
|
||||
}
|
||||
else if (_movementBoneData->frameList->count() > 1)
|
||||
else if (m_pMovementBoneData->frameList.count() > 1)
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
_loopType = ANIMATION_TO_LOOP_BACK;
|
||||
_rawDuration = _movementBoneData->duration;
|
||||
m_eLoopType = ANIMATION_TO_LOOP_BACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loopType = ANIMATION_NO_LOOP;
|
||||
_rawDuration = _movementBoneData->duration - 1;
|
||||
m_eLoopType = ANIMATION_NO_LOOP;
|
||||
}
|
||||
|
||||
_durationTween = durationTween * _movementBoneData->scale;
|
||||
m_iDurationTween = durationTween * m_pMovementBoneData->scale;
|
||||
|
||||
if (loop && _movementBoneData->delay != 0)
|
||||
if (loop && m_pMovementBoneData->delay != 0)
|
||||
{
|
||||
setBetween(_tweenData, tweenNodeTo(updateFrameData(1 - _movementBoneData->delay), _between));
|
||||
|
||||
setBetween(m_pTweenData, tweenNodeTo(updateFrameData(1 - m_pMovementBoneData->delay), m_pBetween));
|
||||
}
|
||||
else
|
||||
{
|
||||
FrameData *_nextKeyFrame = _movementBoneData->getFrameData(0);
|
||||
setBetween(_tweenData, _nextKeyFrame);
|
||||
_isTweenKeyFrame = true;
|
||||
if (!difMovement || durationTo == 0)
|
||||
{
|
||||
setBetween(nextKeyFrame, nextKeyFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
setBetween(m_pTweenData, nextKeyFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tweenNodeTo(0);
|
||||
}
|
||||
|
||||
void Tween::updateHandler()
|
||||
void CCTween::updateHandler()
|
||||
{
|
||||
|
||||
|
||||
if (_currentPercent >= 1)
|
||||
if (m_fCurrentPercent >= 1)
|
||||
{
|
||||
switch(_loopType)
|
||||
switch(m_eLoopType)
|
||||
{
|
||||
case SINGLE_FRAME:
|
||||
{
|
||||
_currentPercent = 1;
|
||||
_isComplete = true;
|
||||
m_fCurrentPercent = 1;
|
||||
m_bIsComplete = true;
|
||||
m_bIsPlaying = false;
|
||||
}
|
||||
break;
|
||||
case ANIMATION_NO_LOOP:
|
||||
{
|
||||
_loopType = ANIMATION_MAX;
|
||||
m_eLoopType = ANIMATION_MAX;
|
||||
|
||||
|
||||
if (_durationTween <= 0)
|
||||
if (m_iDurationTween <= 0)
|
||||
{
|
||||
_currentPercent = 1;
|
||||
m_fCurrentPercent = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPercent = (_currentPercent - 1) * _nextFrameIndex / _durationTween;
|
||||
m_fCurrentPercent = (m_fCurrentPercent - 1) * m_iNextFrameIndex / m_iDurationTween;
|
||||
}
|
||||
|
||||
if (_currentPercent >= 1)
|
||||
if (m_fCurrentPercent >= 1)
|
||||
{
|
||||
_currentPercent = 1;
|
||||
_isComplete = true;
|
||||
m_fCurrentPercent = 1;
|
||||
m_bIsComplete = true;
|
||||
m_bIsPlaying = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
_nextFrameIndex = _durationTween;
|
||||
_currentFrame = _currentPercent * _nextFrameIndex;
|
||||
_totalDuration = 0;
|
||||
betweenDuration = 0;
|
||||
_toIndex = 0;
|
||||
m_iNextFrameIndex = m_iDurationTween;
|
||||
m_fCurrentFrame = m_fCurrentPercent * m_iNextFrameIndex;
|
||||
m_iTotalDuration = 0;
|
||||
m_iBetweenDuration = 0;
|
||||
m_iFromIndex = m_iToIndex = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ANIMATION_TO_LOOP_BACK:
|
||||
{
|
||||
_loopType = ANIMATION_LOOP_BACK;
|
||||
m_eLoopType = ANIMATION_LOOP_BACK;
|
||||
|
||||
_nextFrameIndex = _durationTween > 0 ? _durationTween : 1;
|
||||
m_iNextFrameIndex = m_iDurationTween > 0 ? m_iDurationTween : 1;
|
||||
|
||||
if (_movementBoneData->delay != 0)
|
||||
if (m_pMovementBoneData->delay != 0)
|
||||
{
|
||||
//
|
||||
_currentFrame = (1 - _movementBoneData->delay) * (float)_nextFrameIndex;
|
||||
_currentPercent = _currentFrame / _nextFrameIndex;
|
||||
|
||||
|
||||
m_fCurrentFrame = (1 - m_pMovementBoneData->delay) * (float)m_iNextFrameIndex;
|
||||
m_fCurrentPercent = m_fCurrentFrame / m_iNextFrameIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentPercent = 0;
|
||||
_currentFrame = 0;
|
||||
m_fCurrentPercent = 0;
|
||||
m_fCurrentFrame = 0;
|
||||
}
|
||||
|
||||
_totalDuration = 0;
|
||||
betweenDuration = 0;
|
||||
_toIndex = 0;
|
||||
m_iTotalDuration = 0;
|
||||
m_iBetweenDuration = 0;
|
||||
m_iFromIndex = m_iToIndex = 0;
|
||||
}
|
||||
break;
|
||||
case ANIMATION_MAX:
|
||||
{
|
||||
_currentPercent = 1;
|
||||
_isComplete = true;
|
||||
m_fCurrentPercent = 1;
|
||||
m_bIsComplete = true;
|
||||
m_bIsPlaying = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
_currentPercent = fmodf(_currentPercent, 1);
|
||||
_currentFrame = fmodf(_currentFrame, _nextFrameIndex);
|
||||
m_fCurrentFrame = fmodf(m_fCurrentFrame, m_iNextFrameIndex);
|
||||
|
||||
_totalDuration = 0;
|
||||
betweenDuration = 0;
|
||||
_toIndex = 0;
|
||||
m_iTotalDuration = 0;
|
||||
m_iBetweenDuration = 0;
|
||||
m_iFromIndex = m_iToIndex = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_currentPercent < 1 && _loopType <= ANIMATION_TO_LOOP_BACK)
|
||||
if (m_fCurrentPercent < 1 && m_eLoopType <= ANIMATION_TO_LOOP_BACK)
|
||||
{
|
||||
_currentPercent = sin(_currentPercent * CC_HALF_PI);
|
||||
m_fCurrentPercent = sin(m_fCurrentPercent * CC_HALF_PI);
|
||||
}
|
||||
|
||||
float percent = _currentPercent;
|
||||
float percent = m_fCurrentPercent;
|
||||
|
||||
if (_loopType > ANIMATION_TO_LOOP_BACK)
|
||||
if (m_eLoopType > ANIMATION_TO_LOOP_BACK)
|
||||
{
|
||||
percent = updateFrameData(percent, true);
|
||||
percent = updateFrameData(percent);
|
||||
}
|
||||
|
||||
if(_frameTweenEasing != TWEEN_EASING_MAX)
|
||||
if(m_eFrameTweenEasing != TWEEN_EASING_MAX)
|
||||
{
|
||||
tweenNodeTo(percent);
|
||||
}
|
||||
else if(_currentKeyFrame)
|
||||
{
|
||||
tweenNodeTo(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Tween::setBetween(FrameData *from, FrameData *to)
|
||||
void CCTween::setBetween(CCFrameData *from, CCFrameData *to)
|
||||
{
|
||||
do
|
||||
{
|
||||
if(to->displayIndex < 0 && from->displayIndex > 0)
|
||||
if(from->displayIndex < 0 && to->displayIndex >= 0)
|
||||
{
|
||||
_from->copy(from);
|
||||
_between->subtract(to, to);
|
||||
m_pFrom->copy(to);
|
||||
m_pBetween->subtract(to, to);
|
||||
break;
|
||||
}
|
||||
else if(from->displayIndex < 0 && to->displayIndex > 0)
|
||||
else if(to->displayIndex < 0 && from->displayIndex >= 0)
|
||||
{
|
||||
_from->copy(to);
|
||||
_between->subtract(to, to);
|
||||
m_pFrom->copy(from);
|
||||
m_pBetween->subtract(to, to);
|
||||
break;
|
||||
}
|
||||
|
||||
_from->copy(from);
|
||||
_between->subtract(from, to);
|
||||
m_pFrom->copy(from);
|
||||
m_pBetween->subtract(from, to);
|
||||
}
|
||||
while (0);
|
||||
|
||||
|
@ -295,145 +297,158 @@ void Tween::setBetween(FrameData *from, FrameData *to)
|
|||
}
|
||||
|
||||
|
||||
void Tween::arriveKeyFrame(FrameData *keyFrameData)
|
||||
void CCTween::arriveKeyFrame(CCFrameData *keyFrameData)
|
||||
{
|
||||
if(keyFrameData)
|
||||
{
|
||||
CCDisplayManager *displayManager = m_pBone->getDisplayManager();
|
||||
|
||||
//! Change bone's display
|
||||
int displayIndex = keyFrameData->displayIndex;
|
||||
|
||||
if (!_bone->getDisplayManager()->getForceChangeDisplay())
|
||||
if (!displayManager->getForceChangeDisplay())
|
||||
{
|
||||
_bone->getDisplayManager()->changeDisplayByIndex(displayIndex, false);
|
||||
displayManager->changeDisplayByIndex(displayIndex, false);
|
||||
}
|
||||
|
||||
//! Update bone zorder, bone's zorder is determined by frame zorder and bone zorder
|
||||
m_pTweenData->zOrder = keyFrameData->zOrder;
|
||||
m_pBone->updateZOrder();
|
||||
|
||||
_bone->setZOrder(keyFrameData->zOrder);
|
||||
|
||||
Armature *childAramture = _bone->getChildArmature();
|
||||
//! Update blend type
|
||||
m_pBone->setBlendType(keyFrameData->blendType);
|
||||
|
||||
//! Update child armature's movement
|
||||
CCArmature *childAramture = m_pBone->getChildArmature();
|
||||
if(childAramture)
|
||||
{
|
||||
if(keyFrameData->_movement.length() != 0)
|
||||
if(keyFrameData->strMovement.length() != 0)
|
||||
{
|
||||
childAramture->getAnimation()->play(keyFrameData->_movement.c_str());
|
||||
childAramture->getAnimation()->play(keyFrameData->strMovement.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(keyFrameData->_event.length() != 0)
|
||||
{
|
||||
_animation->FrameEventSignal.emit(_bone, keyFrameData->_event.c_str());
|
||||
}
|
||||
// if(keyFrameData->_sound.length() != 0)
|
||||
// {
|
||||
// //soundManager.dispatchEventWith(Event.SOUND_FRAME, _currentKeyFrame->sound);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FrameData *Tween::tweenNodeTo(float percent, FrameData *node)
|
||||
CCFrameData *CCTween::tweenNodeTo(float percent, CCFrameData *node)
|
||||
{
|
||||
node = node == NULL ? m_pTweenData : node;
|
||||
|
||||
node = node == NULL ? _tweenData : node;
|
||||
node->x = m_pFrom->x + percent * m_pBetween->x;
|
||||
node->y = m_pFrom->y + percent * m_pBetween->y;
|
||||
node->scaleX = m_pFrom->scaleX + percent * m_pBetween->scaleX;
|
||||
node->scaleY = m_pFrom->scaleY + percent * m_pBetween->scaleY;
|
||||
node->skewX = m_pFrom->skewX + percent * m_pBetween->skewX;
|
||||
node->skewY = m_pFrom->skewY + percent * m_pBetween->skewY;
|
||||
|
||||
node->x = _from->x + percent * _between->x;
|
||||
node->y = _from->y + percent * _between->y;
|
||||
node->scaleX = _from->scaleX + percent * _between->scaleX;
|
||||
node->scaleY = _from->scaleY + percent * _between->scaleY;
|
||||
node->skewX = _from->skewX + percent * _between->skewX;
|
||||
node->skewY = _from->skewY + percent * _between->skewY;
|
||||
m_pBone->setTransformDirty(true);
|
||||
|
||||
_bone->setTransformDirty(true);
|
||||
|
||||
if(_between->isUseColorInfo)
|
||||
if (node && m_pBetween->isUseColorInfo)
|
||||
{
|
||||
node->a = _from->a + percent * _between->a;
|
||||
node->r = _from->r + percent * _between->r;
|
||||
node->g = _from->g + percent * _between->g;
|
||||
node->b = _from->b + percent * _between->b;
|
||||
_bone->updateColor();
|
||||
tweenColorTo(percent, node);
|
||||
}
|
||||
|
||||
// Point p1 = Point(_from->x, _from->y);
|
||||
// Point p2 = Point(100, 0);
|
||||
// Point p3 = Point(200, 400);
|
||||
// Point p4 = Point(_from->x + _between->x, _from->y + _between->y);
|
||||
//
|
||||
// Point p = bezierTo(percent, p1, p2, p3, p4);
|
||||
// node->x = p.x;
|
||||
// node->y = p.y;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
float Tween::updateFrameData(float currentPrecent, bool activeFrame)
|
||||
void CCTween::tweenColorTo(float percent, CCFrameData *node)
|
||||
{
|
||||
node->a = m_pFrom->a + percent * m_pBetween->a;
|
||||
node->r = m_pFrom->r + percent * m_pBetween->r;
|
||||
node->g = m_pFrom->g + percent * m_pBetween->g;
|
||||
node->b = m_pFrom->b + percent * m_pBetween->b;
|
||||
m_pBone->updateColor();
|
||||
}
|
||||
|
||||
float playedTime = (float)_rawDuration * currentPrecent;
|
||||
float CCTween::updateFrameData(float currentPercent)
|
||||
{
|
||||
if (currentPercent > 1 && m_pMovementBoneData->delay != 0)
|
||||
{
|
||||
currentPercent = fmodf(currentPercent, 1);
|
||||
}
|
||||
|
||||
float playedTime = (float)m_iRawDuration * currentPercent;
|
||||
|
||||
FrameData *from;
|
||||
FrameData *to;
|
||||
bool isListEnd;
|
||||
|
||||
//! If play to current frame's front or back, then find current frame again
|
||||
if (playedTime >= _totalDuration || playedTime < _totalDuration - betweenDuration)
|
||||
if (playedTime < m_iTotalDuration || playedTime >= m_iTotalDuration + m_iBetweenDuration)
|
||||
{
|
||||
/*
|
||||
* Get frame length, if _toIndex >= _length, then set _toIndex to 0, start anew.
|
||||
* _toIndex is next index will play
|
||||
* Get frame length, if m_iToIndex >= _length, then set m_iToIndex to 0, start anew.
|
||||
* m_iToIndex is next index will play
|
||||
*/
|
||||
int length = _movementBoneData->frameList->count();
|
||||
int length = m_pMovementBoneData->frameList.count();
|
||||
CCFrameData **frames = (CCFrameData **)m_pMovementBoneData->frameList.data->arr;
|
||||
|
||||
CCFrameData *from = NULL;
|
||||
CCFrameData *to = NULL;
|
||||
|
||||
if (playedTime < frames[0]->frameID)
|
||||
{
|
||||
from = to = frames[0];
|
||||
setBetween(from, to);
|
||||
return currentPercent;
|
||||
}
|
||||
else if(playedTime >= frames[length - 1]->frameID)
|
||||
{
|
||||
from = to = frames[length - 1];
|
||||
setBetween(from, to);
|
||||
return currentPercent;
|
||||
}
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
betweenDuration = _movementBoneData->getFrameData(_toIndex)->duration;
|
||||
_totalDuration += betweenDuration;
|
||||
_fromIndex = _toIndex;
|
||||
from = frames[m_iFromIndex];
|
||||
m_iTotalDuration = from->frameID;
|
||||
|
||||
if (++_toIndex >= length)
|
||||
if (++m_iToIndex >= length)
|
||||
{
|
||||
_toIndex = 0;
|
||||
m_iToIndex = 0;
|
||||
}
|
||||
|
||||
m_iFromIndex = m_iToIndex;
|
||||
to = frames[m_iToIndex];
|
||||
|
||||
//! Guaranteed to trigger frame event
|
||||
if(from->strEvent.length() != 0)
|
||||
{
|
||||
m_pAnimation->frameEvent(m_pBone, from->strEvent.c_str(), from->frameID, playedTime);
|
||||
}
|
||||
|
||||
if (playedTime == from->frameID)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (playedTime >= _totalDuration);
|
||||
while (playedTime < from->frameID || playedTime >= to->frameID);
|
||||
|
||||
m_iBetweenDuration = to->frameID - from->frameID;
|
||||
|
||||
isListEnd = _loopType == ANIMATION_MAX && _toIndex == 0;
|
||||
|
||||
if(isListEnd)
|
||||
{
|
||||
to = from = _movementBoneData->getFrameData(_fromIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
from = _movementBoneData->getFrameData(_fromIndex);
|
||||
to = _movementBoneData->getFrameData(_toIndex);
|
||||
}
|
||||
|
||||
_frameTweenEasing = from->tweenEasing;
|
||||
m_eFrameTweenEasing = from->tweenEasing;
|
||||
|
||||
setBetween(from, to);
|
||||
|
||||
}
|
||||
currentPrecent = 1 - (_totalDuration - playedTime) / (float)betweenDuration;
|
||||
currentPercent = m_iBetweenDuration == 0 ? 0 : (playedTime - m_iTotalDuration) / (float)m_iBetweenDuration;
|
||||
|
||||
|
||||
/*
|
||||
* If frame tween easing equal to TWEEN_EASING_MAX, then it will not do tween.
|
||||
*/
|
||||
|
||||
TweenType tweenType;
|
||||
CCTweenType tweenType;
|
||||
|
||||
if ( _frameTweenEasing != TWEEN_EASING_MAX)
|
||||
if ( m_eFrameTweenEasing != TWEEN_EASING_MAX)
|
||||
{
|
||||
tweenType = (_tweenEasing == TWEEN_EASING_MAX) ? _frameTweenEasing : _tweenEasing;
|
||||
if (tweenType != TWEEN_EASING_MAX)
|
||||
tweenType = (m_eTweenEasing == TWEEN_EASING_MAX) ? m_eFrameTweenEasing : m_eTweenEasing;
|
||||
if (tweenType != TWEEN_EASING_MAX && tweenType != Linear)
|
||||
{
|
||||
currentPrecent = TweenFunction::tweenTo(0, 1, currentPrecent, 1, tweenType);
|
||||
currentPercent = CCTweenFunction::tweenTo(0, 1, currentPercent, 1, tweenType);
|
||||
}
|
||||
}
|
||||
|
||||
return currentPrecent;
|
||||
return currentPercent;
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,68 +29,61 @@ THE SOFTWARE.
|
|||
#include "CCProcessBase.h"
|
||||
#include "../utils/CCTweenFunction.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class Bone;
|
||||
class ArmatureAnimation;
|
||||
class CCBone;
|
||||
class CCArmatureAnimation;
|
||||
|
||||
class Tween : public ProcessBase
|
||||
class CCTween : public CCProcessBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create with a Bone
|
||||
* @param bone the Bone Tween will bind to
|
||||
* Create with a CCBone
|
||||
* @param bone the CCBone CCTween will bind to
|
||||
*/
|
||||
static Tween *create(Bone *bone);
|
||||
static CCTween *create(CCBone *bone);
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Tween(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Tween(void);
|
||||
CCTween(void);
|
||||
virtual ~CCTween(void);
|
||||
|
||||
/**
|
||||
* Init with a Bone
|
||||
* @param bone the Bone Tween will bind to
|
||||
* Init with a CCBone
|
||||
* @param bone the CCBone CCTween will bind to
|
||||
*/
|
||||
virtual bool init(Bone *bone);
|
||||
virtual bool init(CCBone *bone);
|
||||
|
||||
/**
|
||||
* Start the Process
|
||||
*
|
||||
* @param movementBoneData the MovementBoneData include all frame datas
|
||||
* @param durationTo the frames between two animation changing-over.
|
||||
* It's meaning is changing to this animation need how many frames
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* @param durationTween the frame count you want to play in the game.
|
||||
* if _durationTween is 80, then the animation will played 80 frames in a loop
|
||||
*
|
||||
* -1 : use the value from MovementData get from flash design panel
|
||||
* @param movementBoneData the CCMovementBoneData include all CCFrameData
|
||||
* @param durationTo the number of frames changing to this animation needs.
|
||||
* @param durationTween the number of frames this animation actual last.
|
||||
*
|
||||
* @param loop whether the animation is loop
|
||||
*
|
||||
* loop < 0 : use the value from MovementData get from flash design panel
|
||||
* loop < 0 : use the value from CCMovementData get from Action Editor
|
||||
* loop = 0 : this animation is not loop
|
||||
* loop > 0 : this animation is loop
|
||||
*
|
||||
* @param tweenEasing tween easing is used for calculate easing effect
|
||||
*
|
||||
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
|
||||
* TWEEN_EASING_MAX : use the value from CCMovementData get from Action Editor
|
||||
* -1 : fade out
|
||||
* 0 : line
|
||||
* 1 : fade in
|
||||
* 2 : fade in and out
|
||||
*
|
||||
*/
|
||||
virtual void play(MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing);
|
||||
virtual void play(CCMovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing);
|
||||
|
||||
inline void setAnimation(ArmatureAnimation *animation) { _animation = animation; }
|
||||
inline ArmatureAnimation *getAnimation() const { return _animation; }
|
||||
inline void setAnimation(CCArmatureAnimation *animation)
|
||||
{
|
||||
m_pAnimation = animation;
|
||||
}
|
||||
inline CCArmatureAnimation *getAnimation() const
|
||||
{
|
||||
return m_pAnimation;
|
||||
}
|
||||
protected:
|
||||
|
||||
/**
|
||||
|
@ -101,49 +94,52 @@ protected:
|
|||
/**
|
||||
* Calculate which frame arrived, and if current frame have event, then call the event listener
|
||||
*/
|
||||
virtual float updateFrameData(float currentPrecent, bool activeFrame = false);
|
||||
virtual float updateFrameData(float currentPercent);
|
||||
|
||||
/**
|
||||
* Calculate the between value of _from and _to, and give it to between frame data
|
||||
*/
|
||||
virtual void setBetween(FrameData *from, FrameData *to);
|
||||
virtual void setBetween(CCFrameData *from, CCFrameData *to);
|
||||
|
||||
/**
|
||||
* According to the percent to calculate current FrameData with tween effect
|
||||
* According to the percent to calculate current CCFrameData with tween effect
|
||||
*/
|
||||
virtual FrameData *tweenNodeTo(float percent, FrameData *node = NULL);
|
||||
virtual CCFrameData *tweenNodeTo(float percent, CCFrameData *node = NULL);
|
||||
|
||||
/**
|
||||
* According to the percent to calculate current color with tween effect
|
||||
*/
|
||||
virtual void tweenColorTo(float percent, CCFrameData *node);
|
||||
|
||||
/**
|
||||
* Update display index and process the key frame event when arrived a key frame
|
||||
*/
|
||||
virtual void arriveKeyFrame(FrameData *keyFrameData);
|
||||
virtual void arriveKeyFrame(CCFrameData *keyFrameData);
|
||||
protected:
|
||||
//! A weak reference to the current MovementBoneData. The data is in the data pool
|
||||
CC_SYNTHESIZE(MovementBoneData *, _movementBoneData, MovementBoneData)
|
||||
//! A weak reference to the current CCMovementBoneData. The data is in the data pool
|
||||
CC_SYNTHESIZE(CCMovementBoneData *, m_pMovementBoneData, MovementBoneData)
|
||||
|
||||
FrameData *_tweenData; //! The computational tween frame data, //! A weak reference to the Bone's tweenData
|
||||
FrameData *_from; //! From frame data, used for calculate between value
|
||||
FrameData *_to; //! To frame data, used for calculate between value
|
||||
FrameData *_between; //! Between frame data, used for calculate current FrameData(_node) value
|
||||
|
||||
FrameData *_currentKeyFrame; //! A weak reference to the current FrameData. The data is in the data pool
|
||||
|
||||
Bone *_bone; //! A weak reference to the Bone
|
||||
|
||||
TweenType _frameTweenEasing; //! Dedermine which tween effect current frame use
|
||||
|
||||
bool _isTweenKeyFrame;
|
||||
|
||||
int betweenDuration; //! Current key frame will last betweenDuration frames
|
||||
int _totalDuration;
|
||||
CCFrameData *m_pTweenData; //! The computational tween frame data, //! A weak reference to the CCBone's tweenData
|
||||
CCFrameData *m_pFrom; //! From frame data, used for calculate between value
|
||||
CCFrameData *m_pTo; //! To frame data, used for calculate between value
|
||||
CCFrameData *m_pBetween; //! Between frame data, used for calculate current CCFrameData(m_pNode) value
|
||||
|
||||
|
||||
int _fromIndex; //! The current frame index in FrameList of MovementBoneData, it's different from _frameIndex
|
||||
int _toIndex; //! The next frame index in FrameList of MovementBoneData, it's different from _frameIndex
|
||||
CCBone *m_pBone; //! A weak reference to the CCBone
|
||||
|
||||
CCTweenType m_eFrameTweenEasing; //! Dedermine which tween effect current frame use
|
||||
|
||||
int m_iBetweenDuration; //! Current key frame will last m_iBetweenDuration frames
|
||||
int m_iTotalDuration;
|
||||
|
||||
|
||||
int m_iFromIndex; //! The current frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex
|
||||
int m_iToIndex; //! The next frame index in FrameList of CCMovementBoneData, it's different from m_iFrameIndex
|
||||
|
||||
CCArmatureAnimation *m_pAnimation;
|
||||
|
||||
ArmatureAnimation *_animation;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCTWEEN_H__*/
|
||||
|
|
|
@ -24,102 +24,119 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCDatas.h"
|
||||
#include "../utils/CCUtilMath.h"
|
||||
#include "../utils/CCTransformHelp.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
|
||||
BaseData::BaseData()
|
||||
: x(0.0f)
|
||||
, y(0.0f)
|
||||
, zOrder(0)
|
||||
CCBaseData::CCBaseData()
|
||||
: x(0.0f)
|
||||
, y(0.0f)
|
||||
, zOrder(0)
|
||||
|
||||
, skewX(0.0f)
|
||||
, skewY(0.0f)
|
||||
, scaleX(1.0f)
|
||||
, scaleY(1.0f)
|
||||
, skewX(0.0f)
|
||||
, skewY(0.0f)
|
||||
, scaleX(1.0f)
|
||||
, scaleY(1.0f)
|
||||
|
||||
, tweenRotate(0.0f)
|
||||
, tweenRotate(0.0f)
|
||||
|
||||
, isUseColorInfo(false)
|
||||
, a(255)
|
||||
, r(255)
|
||||
, g(255)
|
||||
, b(255)
|
||||
, isUseColorInfo(false)
|
||||
, a(255)
|
||||
, r(255)
|
||||
, g(255)
|
||||
, b(255)
|
||||
{
|
||||
}
|
||||
|
||||
BaseData::~BaseData()
|
||||
CCBaseData::~CCBaseData()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseData::copy(const BaseData *node )
|
||||
void CCBaseData::copy(const CCBaseData *node )
|
||||
{
|
||||
x = node->x;
|
||||
y = node->y;
|
||||
zOrder = node->zOrder;
|
||||
x = node->x;
|
||||
y = node->y;
|
||||
zOrder = node->zOrder;
|
||||
|
||||
scaleX = node->scaleX;
|
||||
scaleY = node->scaleY;
|
||||
skewX = node->skewX;
|
||||
skewY = node->skewY;
|
||||
scaleX = node->scaleX;
|
||||
scaleY = node->scaleY;
|
||||
skewX = node->skewX;
|
||||
skewY = node->skewY;
|
||||
|
||||
tweenRotate = node->tweenRotate;
|
||||
tweenRotate = node->tweenRotate;
|
||||
|
||||
isUseColorInfo = node->isUseColorInfo;
|
||||
r = node->r;
|
||||
g = node->g;
|
||||
b = node->b;
|
||||
a = node->a;
|
||||
isUseColorInfo = node->isUseColorInfo;
|
||||
r = node->r;
|
||||
g = node->g;
|
||||
b = node->b;
|
||||
a = node->a;
|
||||
}
|
||||
|
||||
|
||||
void BaseData::subtract(BaseData *from, BaseData *to)
|
||||
void CCBaseData::subtract(CCBaseData *from, CCBaseData *to)
|
||||
{
|
||||
x = to->x - from->x;
|
||||
y = to->y - from->y;
|
||||
scaleX = to->scaleX - from->scaleX;
|
||||
scaleY = to->scaleY - from->scaleY;
|
||||
skewX = to->skewX - from->skewX;
|
||||
skewY = to->skewY - from->skewY;
|
||||
x = to->x - from->x;
|
||||
y = to->y - from->y;
|
||||
scaleX = to->scaleX - from->scaleX;
|
||||
scaleY = to->scaleY - from->scaleY;
|
||||
skewX = to->skewX - from->skewX;
|
||||
skewY = to->skewY - from->skewY;
|
||||
|
||||
if(from->isUseColorInfo || to->isUseColorInfo)
|
||||
{
|
||||
a = to->a - from->a;
|
||||
r = to->r - from->r;
|
||||
g = to->g - from->g;
|
||||
b = to->b - from->b;
|
||||
if(isUseColorInfo || from->isUseColorInfo || to->isUseColorInfo)
|
||||
{
|
||||
a = to->a - from->a;
|
||||
r = to->r - from->r;
|
||||
g = to->g - from->g;
|
||||
b = to->b - from->b;
|
||||
|
||||
isUseColorInfo = true;
|
||||
}
|
||||
isUseColorInfo = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = r = g = b = 0;
|
||||
isUseColorInfo = false;
|
||||
}
|
||||
|
||||
if (skewX > M_PI)
|
||||
{
|
||||
skewX -= (float)CC_DOUBLE_PI;
|
||||
}
|
||||
if (skewX < -M_PI)
|
||||
{
|
||||
skewX += (float)CC_DOUBLE_PI;
|
||||
}
|
||||
|
||||
if (skewX > M_PI)
|
||||
{
|
||||
skewX -= (float)CC_DOUBLE_PI;
|
||||
}
|
||||
if (skewX < -M_PI)
|
||||
{
|
||||
skewX += (float)CC_DOUBLE_PI;
|
||||
}
|
||||
if (skewY > M_PI)
|
||||
{
|
||||
skewY -= (float)CC_DOUBLE_PI;
|
||||
}
|
||||
if (skewY < -M_PI)
|
||||
{
|
||||
skewY += (float)CC_DOUBLE_PI;
|
||||
}
|
||||
|
||||
if (skewY > M_PI)
|
||||
{
|
||||
skewY -= (float)CC_DOUBLE_PI;
|
||||
}
|
||||
if (skewY < -M_PI)
|
||||
{
|
||||
skewY += (float)CC_DOUBLE_PI;
|
||||
}
|
||||
|
||||
if (to->tweenRotate)
|
||||
{
|
||||
skewX += to->tweenRotate;
|
||||
skewY -= to->tweenRotate;
|
||||
}
|
||||
if (to->tweenRotate)
|
||||
{
|
||||
skewX += to->tweenRotate;
|
||||
skewY -= to->tweenRotate;
|
||||
}
|
||||
}
|
||||
|
||||
void CCBaseData::setColor(const Color4B &color)
|
||||
{
|
||||
r = color.r;
|
||||
g = color.g;
|
||||
b = color.b;
|
||||
a = color.a;
|
||||
}
|
||||
|
||||
const char *DisplayData::changeDisplayToTexture(const char *displayName)
|
||||
Color4B CCBaseData::getColor()
|
||||
{
|
||||
return Color4B(r, g, b, a);
|
||||
}
|
||||
|
||||
const char *CCDisplayData::changeDisplayToTexture(const char *displayName)
|
||||
{
|
||||
// remove .xxx
|
||||
std::string textureName = displayName;
|
||||
|
@ -133,304 +150,274 @@ const char *DisplayData::changeDisplayToTexture(const char *displayName)
|
|||
return textureName.c_str();
|
||||
}
|
||||
|
||||
DisplayData::DisplayData(void)
|
||||
: displayType(CS_DISPLAY_SPRITE)
|
||||
CCDisplayData::CCDisplayData(void)
|
||||
: displayType(CS_DISPLAY_MAX)
|
||||
{
|
||||
}
|
||||
|
||||
DisplayData::~DisplayData(void)
|
||||
CCDisplayData::~CCDisplayData(void)
|
||||
{
|
||||
}
|
||||
|
||||
SpriteDisplayData::SpriteDisplayData(void)
|
||||
CCSpriteDisplayData::CCSpriteDisplayData(void)
|
||||
: displayName("")
|
||||
{
|
||||
displayType = CS_DISPLAY_SPRITE;
|
||||
}
|
||||
|
||||
SpriteDisplayData::~SpriteDisplayData()
|
||||
CCSpriteDisplayData::~CCSpriteDisplayData()
|
||||
{
|
||||
}
|
||||
|
||||
void SpriteDisplayData::copy(SpriteDisplayData *displayData)
|
||||
void CCSpriteDisplayData::copy(CCSpriteDisplayData *displayData)
|
||||
{
|
||||
displayName = displayData->displayName;
|
||||
displayType = displayData->displayType;
|
||||
|
||||
skinData = displayData->skinData;
|
||||
}
|
||||
|
||||
ArmatureDisplayData::ArmatureDisplayData(void)
|
||||
CCArmatureDisplayData::CCArmatureDisplayData(void)
|
||||
: displayName("")
|
||||
{
|
||||
displayType = CS_DISPLAY_ARMATURE;
|
||||
}
|
||||
|
||||
ArmatureDisplayData::~ArmatureDisplayData()
|
||||
CCArmatureDisplayData::~CCArmatureDisplayData()
|
||||
{
|
||||
}
|
||||
|
||||
void ArmatureDisplayData::copy(ArmatureDisplayData *displayData)
|
||||
void CCArmatureDisplayData::copy(CCArmatureDisplayData *displayData)
|
||||
{
|
||||
displayName = displayData->displayName;
|
||||
displayType = displayData->displayType;
|
||||
}
|
||||
|
||||
ParticleDisplayData::ParticleDisplayData(void)
|
||||
CCParticleDisplayData::CCParticleDisplayData(void)
|
||||
: plist("")
|
||||
{
|
||||
displayType = CS_DISPLAY_PARTICLE;
|
||||
}
|
||||
|
||||
void ParticleDisplayData::copy(ParticleDisplayData *displayData)
|
||||
void CCParticleDisplayData::copy(CCParticleDisplayData *displayData)
|
||||
{
|
||||
plist = displayData->plist;
|
||||
displayType = displayData->displayType;
|
||||
}
|
||||
|
||||
ShaderDisplayData::ShaderDisplayData(void)
|
||||
: vert("")
|
||||
, frag("")
|
||||
{
|
||||
displayType = CS_DISPLAY_SHADER;
|
||||
}
|
||||
|
||||
void ShaderDisplayData::copy(ShaderDisplayData *displayData)
|
||||
{
|
||||
vert = displayData->vert;
|
||||
frag = displayData->frag;
|
||||
displayType = displayData->displayType;
|
||||
}
|
||||
|
||||
|
||||
BoneData::BoneData(void)
|
||||
CCBoneData::CCBoneData(void)
|
||||
: name("")
|
||||
, parentName("")
|
||||
{
|
||||
}
|
||||
|
||||
BoneData::~BoneData(void)
|
||||
CCBoneData::~CCBoneData(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(displayDataList);
|
||||
}
|
||||
|
||||
bool BoneData::init()
|
||||
bool CCBoneData::init()
|
||||
{
|
||||
displayDataList = new Array;
|
||||
displayDataList->init();
|
||||
displayDataList.init();
|
||||
return true;
|
||||
}
|
||||
|
||||
void BoneData::addDisplayData(DisplayData *displayData)
|
||||
void CCBoneData::addDisplayData(CCDisplayData *displayData)
|
||||
{
|
||||
displayDataList->addObject(displayData);
|
||||
displayDataList.addObject(displayData);
|
||||
}
|
||||
|
||||
DisplayData *BoneData::getDisplayData(int index)
|
||||
CCDisplayData *CCBoneData::getDisplayData(int index)
|
||||
{
|
||||
return static_cast<DisplayData *>( displayDataList->getObjectAtIndex(index) );
|
||||
return (CCDisplayData *)displayDataList.getObjectAtIndex(index);
|
||||
}
|
||||
|
||||
ArmatureData::ArmatureData()
|
||||
|
||||
CCArmatureData::CCArmatureData()
|
||||
: dataVersion(0.1f)
|
||||
{
|
||||
}
|
||||
|
||||
ArmatureData::~ArmatureData()
|
||||
CCArmatureData::~CCArmatureData()
|
||||
{
|
||||
CC_SAFE_RELEASE(boneList);
|
||||
CC_SAFE_RELEASE(boneDataDic);
|
||||
}
|
||||
|
||||
bool ArmatureData::init()
|
||||
bool CCArmatureData::init()
|
||||
{
|
||||
boneList = new Array;
|
||||
boneList->init();
|
||||
|
||||
boneDataDic = new Dictionary;
|
||||
boneDataDic->init();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ArmatureData::addBoneData(BoneData *boneData)
|
||||
void CCArmatureData::addBoneData(CCBoneData *boneData)
|
||||
{
|
||||
boneDataDic->setObject(boneData, boneData->name);
|
||||
boneList->addObject(boneData);
|
||||
boneDataDic.setObject(boneData, boneData->name);
|
||||
}
|
||||
|
||||
BoneData *ArmatureData::getBoneData(const char *boneName)
|
||||
CCBoneData *CCArmatureData::getBoneData(const char *boneName)
|
||||
{
|
||||
return static_cast<BoneData *>( boneDataDic->objectForKey(boneName) );
|
||||
return (CCBoneData *)boneDataDic.objectForKey(boneName);
|
||||
}
|
||||
|
||||
FrameData::FrameData(void)
|
||||
: duration(1)
|
||||
CCFrameData::CCFrameData(void)
|
||||
: frameID(0)
|
||||
, duration(1)
|
||||
, tweenEasing(Linear)
|
||||
, displayIndex(0)
|
||||
, blendType(BLEND_NORMAL)
|
||||
|
||||
, _movement("")
|
||||
, _event("")
|
||||
, _sound("")
|
||||
, _soundEffect("")
|
||||
, strEvent("")
|
||||
, strMovement("")
|
||||
, strSound("")
|
||||
, strSoundEffect("")
|
||||
{
|
||||
}
|
||||
|
||||
FrameData::~FrameData(void)
|
||||
CCFrameData::~CCFrameData(void)
|
||||
{
|
||||
}
|
||||
|
||||
void FrameData::copy(FrameData *frameData)
|
||||
void CCFrameData::copy(const CCBaseData *baseData)
|
||||
{
|
||||
BaseData::copy(frameData);
|
||||
|
||||
duration = frameData->duration;
|
||||
displayIndex = frameData->displayIndex;
|
||||
tweenEasing = frameData->tweenEasing;
|
||||
CCBaseData::copy(baseData);
|
||||
|
||||
if (const CCFrameData *frameData = dynamic_cast<const CCFrameData*>(baseData))
|
||||
{
|
||||
duration = frameData->duration;
|
||||
displayIndex = frameData->displayIndex;
|
||||
tweenEasing = frameData->tweenEasing;
|
||||
blendType = frameData->blendType;
|
||||
}
|
||||
}
|
||||
|
||||
MovementBoneData::MovementBoneData()
|
||||
CCMovementBoneData::CCMovementBoneData()
|
||||
: delay(0.0f)
|
||||
, scale(1.0f)
|
||||
, duration(0)
|
||||
, name("")
|
||||
{
|
||||
frameList = new Array;
|
||||
frameList->init();
|
||||
}
|
||||
|
||||
MovementBoneData::~MovementBoneData(void)
|
||||
CCMovementBoneData::~CCMovementBoneData(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(frameList);
|
||||
}
|
||||
|
||||
bool MovementBoneData::init()
|
||||
bool CCMovementBoneData::init()
|
||||
{
|
||||
return true;
|
||||
return frameList.init();
|
||||
}
|
||||
|
||||
void MovementBoneData::addFrameData(FrameData *frameData)
|
||||
void CCMovementBoneData::addFrameData(CCFrameData *frameData)
|
||||
{
|
||||
frameList->addObject(frameData);
|
||||
duration += frameData->duration;
|
||||
frameList.addObject(frameData);
|
||||
}
|
||||
|
||||
FrameData *MovementBoneData::getFrameData(int index)
|
||||
CCFrameData *CCMovementBoneData::getFrameData(int index)
|
||||
{
|
||||
return static_cast<FrameData *>( frameList->getObjectAtIndex(index) );
|
||||
return (CCFrameData *)frameList.getObjectAtIndex(index);
|
||||
}
|
||||
|
||||
MovementData::MovementData(void)
|
||||
|
||||
|
||||
CCMovementData::CCMovementData(void)
|
||||
: name("")
|
||||
, duration(0)
|
||||
, scale(1.0f)
|
||||
, durationTo(0)
|
||||
, durationTween(0)
|
||||
, loop(true)
|
||||
, tweenEasing(Linear)
|
||||
{
|
||||
movBoneDataDic = new Dictionary;
|
||||
movBoneDataDic->init();
|
||||
}
|
||||
|
||||
MovementData::~MovementData(void)
|
||||
CCMovementData::~CCMovementData(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(movBoneDataDic);
|
||||
}
|
||||
|
||||
void MovementData::addMovementBoneData(MovementBoneData *movBoneData)
|
||||
void CCMovementData::addMovementBoneData(CCMovementBoneData *movBoneData)
|
||||
{
|
||||
movBoneDataDic->setObject(movBoneData, movBoneData->name);
|
||||
movBoneDataDic.setObject(movBoneData, movBoneData->name);
|
||||
}
|
||||
|
||||
MovementBoneData *MovementData::getMovementBoneData(const char *boneName)
|
||||
CCMovementBoneData *CCMovementData::getMovementBoneData(const char *boneName)
|
||||
{
|
||||
return static_cast<MovementBoneData *>( movBoneDataDic->objectForKey(boneName) );
|
||||
return (CCMovementBoneData *)movBoneDataDic.objectForKey(boneName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AnimationData::AnimationData(void)
|
||||
CCAnimationData::CCAnimationData(void)
|
||||
{
|
||||
movementDataDic = new Dictionary;
|
||||
movementDataDic->init();
|
||||
}
|
||||
|
||||
AnimationData::~AnimationData(void)
|
||||
CCAnimationData::~CCAnimationData(void)
|
||||
{
|
||||
CC_SAFE_RELEASE(movementDataDic);
|
||||
}
|
||||
|
||||
void AnimationData::release()
|
||||
void CCAnimationData::addMovement(CCMovementData *movData)
|
||||
{
|
||||
Object::release();
|
||||
}
|
||||
|
||||
void AnimationData::retain()
|
||||
{
|
||||
Object::retain();
|
||||
}
|
||||
|
||||
void AnimationData::addMovement(MovementData *movData)
|
||||
{
|
||||
movementDataDic->setObject(movData, movData->name);
|
||||
movementDataDic.setObject(movData, movData->name);
|
||||
movementNames.push_back(movData->name);
|
||||
}
|
||||
|
||||
MovementData *AnimationData::getMovement(const char *movementName)
|
||||
CCMovementData *CCAnimationData::getMovement(const char *movementName)
|
||||
{
|
||||
return (MovementData *)movementDataDic->objectForKey(movementName);
|
||||
return (CCMovementData *)movementDataDic.objectForKey(movementName);
|
||||
}
|
||||
|
||||
int AnimationData::getMovementCount()
|
||||
int CCAnimationData::getMovementCount()
|
||||
{
|
||||
return movementDataDic->count();
|
||||
return movementDataDic.count();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ContourData::ContourData()
|
||||
CCContourData::CCContourData()
|
||||
{
|
||||
vertexList = new Array;
|
||||
vertexList->init();
|
||||
}
|
||||
|
||||
ContourData::~ContourData()
|
||||
CCContourData::~CCContourData()
|
||||
{
|
||||
CC_SAFE_RELEASE(vertexList);
|
||||
}
|
||||
|
||||
bool ContourData::init()
|
||||
bool CCContourData::init()
|
||||
{
|
||||
return true;
|
||||
return vertexList.init();
|
||||
}
|
||||
|
||||
TextureData::TextureData()
|
||||
void CCContourData::addVertex(Point *vertex)
|
||||
{
|
||||
CCContourVertex2 *vertex2 = new CCContourVertex2(vertex->x, vertex->y);
|
||||
vertex2->autorelease();
|
||||
|
||||
vertexList.addObject(vertex2);
|
||||
}
|
||||
|
||||
CCTextureData::CCTextureData()
|
||||
: height(0.0f)
|
||||
, width(0.0f)
|
||||
, pivotX(0.5f)
|
||||
, pivotY(0.5f)
|
||||
, name("")
|
||||
{
|
||||
contourDataList = new Array;
|
||||
contourDataList->init();
|
||||
}
|
||||
|
||||
TextureData::~TextureData()
|
||||
CCTextureData::~CCTextureData()
|
||||
{
|
||||
CC_SAFE_RELEASE(contourDataList);
|
||||
}
|
||||
|
||||
bool TextureData::init()
|
||||
bool CCTextureData::init()
|
||||
{
|
||||
return true;
|
||||
return contourDataList.init();
|
||||
}
|
||||
|
||||
void TextureData::addContourData(ContourData *contourData)
|
||||
void CCTextureData::addContourData(CCContourData *contourData)
|
||||
{
|
||||
contourDataList->addObject(contourData);
|
||||
contourDataList.addObject(contourData);
|
||||
}
|
||||
|
||||
ContourData *TextureData::getContourData(int index)
|
||||
CCContourData *CCTextureData::getContourData(int index)
|
||||
{
|
||||
return static_cast<ContourData *>( contourDataList->getObjectAtIndex(index) );
|
||||
return (CCContourData *)contourDataList.getObjectAtIndex(index);
|
||||
}
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,69 +29,65 @@ THE SOFTWARE.
|
|||
#include "../utils/CCTweenFunction.h"
|
||||
|
||||
|
||||
#define CS_CREATE_NO_PARAM_NO_INIT(varType)\
|
||||
#define CC_CREATE_NO_PARAM_NO_INIT(varType)\
|
||||
public: \
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var)\
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var)\
|
||||
{\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
}\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
}
|
||||
|
||||
#define CS_CREATE_NO_PARAM(varType)\
|
||||
#define CC_CREATE_NO_PARAM(varType)\
|
||||
public: \
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var && var->init())\
|
||||
static inline varType *create(void){ \
|
||||
varType *var = new varType();\
|
||||
if (var && var->init())\
|
||||
{\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
var->autorelease();\
|
||||
return var;\
|
||||
}\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
CC_SAFE_DELETE(var);\
|
||||
return NULL;\
|
||||
}
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
/**
|
||||
* the base node include a lot of attribute.
|
||||
* The base node include a lot of attributes.
|
||||
*/
|
||||
class BaseData : public Object
|
||||
class CCBaseData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(BaseData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCBaseData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
BaseData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~BaseData(void);
|
||||
CCBaseData();
|
||||
~CCBaseData(void);
|
||||
|
||||
/*
|
||||
* Copy datas from node
|
||||
* @param node A BaseData to copy datas
|
||||
* Copy data from node
|
||||
* @param node A CCBaseData to copy data
|
||||
*/
|
||||
virtual void copy(const BaseData *node);
|
||||
virtual void copy(const CCBaseData *node);
|
||||
|
||||
/*
|
||||
* Calculate two BaseData's between value(to - from) and set to self
|
||||
* Calculate two CCBaseData's between value(to - from) and set to self
|
||||
*
|
||||
* @param from from BaseData
|
||||
* @param to to BaseData
|
||||
* @param from from CCBaseData
|
||||
* @param to to CCBaseData
|
||||
*/
|
||||
virtual void subtract(BaseData *from, BaseData *to);
|
||||
virtual void subtract(CCBaseData *from, CCBaseData *to);
|
||||
|
||||
virtual void setColor(const Color4B &color);
|
||||
virtual Color4B getColor();
|
||||
public:
|
||||
float x; //! position x attribute
|
||||
float y; //! position y attribute
|
||||
int zOrder; //! zorder attribute, used to order the Bone's depth order
|
||||
float x; //! position x attribute
|
||||
float y; //! position y attribute
|
||||
int zOrder; //! zorder attribute, used to order the CCBone's depth order
|
||||
|
||||
/**
|
||||
* x y skewX skewY scaleX scaleY used to calculate transform matrix
|
||||
|
@ -103,383 +99,308 @@ public:
|
|||
float scaleX;
|
||||
float scaleY;
|
||||
|
||||
float tweenRotate; //! SkewX, SkewY, and TweenRotate effect the rotation
|
||||
float tweenRotate; //! SkewX, SkewY, and TweenRotate effect the rotation
|
||||
|
||||
bool isUseColorInfo; //! Whether or not this frame have the color changed Info
|
||||
bool isUseColorInfo; //! Whether or not this frame have the color changed Info
|
||||
int a, r, g, b;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* DisplayType distinguish which type you display is.
|
||||
* DisplayType distinguish which type your display is.
|
||||
*/
|
||||
enum DisplayType
|
||||
{
|
||||
CS_DISPLAY_SPRITE, //! display is a single Sprite
|
||||
CS_DISPLAY_ARMATURE, //! display is a Armature
|
||||
CS_DISPLAY_PARTICLE, //! display is a Particle.
|
||||
CS_DISPLAY_SHADER, //! display is a shader
|
||||
CS_DISPLAY_SPRITE, //! display is a single Sprite
|
||||
CS_DISPLAY_ARMATURE, //! display is a CCArmature
|
||||
CS_DISPLAY_PARTICLE, //! display is a CCParticle.
|
||||
|
||||
CS_DISPLAY_MAX
|
||||
};
|
||||
|
||||
class DisplayData : public Object
|
||||
class CCDisplayData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(DisplayData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCDisplayData)
|
||||
|
||||
static const char *changeDisplayToTexture(const char *);
|
||||
static const char *changeDisplayToTexture(const char *displayName);
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DisplayData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~DisplayData(void);
|
||||
CCDisplayData();
|
||||
virtual ~CCDisplayData(void);
|
||||
|
||||
DisplayType displayType; //! mark which type your display is
|
||||
};
|
||||
|
||||
|
||||
|
||||
class SpriteDisplayData : public DisplayData
|
||||
class CCSpriteDisplayData : public CCDisplayData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(SpriteDisplayData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCSpriteDisplayData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
SpriteDisplayData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~SpriteDisplayData();
|
||||
CCSpriteDisplayData();
|
||||
virtual ~CCSpriteDisplayData();
|
||||
|
||||
inline void setParam(const char *displayName)
|
||||
{
|
||||
this->displayName = displayName;
|
||||
}
|
||||
void copy(SpriteDisplayData *displayData);
|
||||
void copy(CCSpriteDisplayData *displayData);
|
||||
public:
|
||||
/**
|
||||
* If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from SpriteFrameCache.
|
||||
* It should note that when use this name to create Sprite from SpriteFrameCache, you should use _displayName + ".png", because when use Texture Packer to pack single image file, the name have ".png".
|
||||
* If DisplayType is CS_DISPLAY_SPRITE, then CCBone will use this image name to create a Sprite from CCSpriteFrameCache.
|
||||
* It should note that when use this name to create Sprite from CCSpriteFrameCache, you should use m_strDisplayName + ".png", because when use Texture Packer to pack single image file, the name have ".png".
|
||||
*
|
||||
* If DisplayType is CS_DISPLAY_ARMATURE, the name is the Armature's name. When Bone init display and type is CS_DISPLAY_ARMATURE,
|
||||
* then Bone will create a Armature.
|
||||
* If DisplayType is CS_DISPLAY_ARMATURE, the name is the CCArmature's name. When CCBone init display and type is CS_DISPLAY_ARMATURE,
|
||||
* then CCBone will create a CCArmature.
|
||||
*/
|
||||
std::string displayName;
|
||||
|
||||
CCBaseData skinData;
|
||||
};
|
||||
|
||||
|
||||
class CCArmatureDisplayData : public CCDisplayData
|
||||
{
|
||||
public:
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCArmatureDisplayData)
|
||||
public:
|
||||
CCArmatureDisplayData();
|
||||
virtual ~CCArmatureDisplayData();
|
||||
|
||||
inline void setParam(const char *displayName)
|
||||
{
|
||||
this->displayName = displayName;
|
||||
}
|
||||
void copy(CCArmatureDisplayData *displayData);
|
||||
public:
|
||||
/**
|
||||
* If DisplayType is CS_DISPLAY_SPRITE, then CCBone will use this image name to create a Sprite from CCSpriteFrameCache.
|
||||
* It should note that when use this name to create Sprite from CCSpriteFrameCache, you should use m_strDisplayName + ".png", because when use Texture Packer to pack single image file, the name have ".png".
|
||||
*
|
||||
* If DisplayType is CS_DISPLAY_ARMATURE, the name is the CCArmature's name. When CCBone init display and type is CS_DISPLAY_ARMATURE,
|
||||
* then CCBone will create a CCArmature.
|
||||
*/
|
||||
std::string displayName;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ArmatureDisplayData : public DisplayData
|
||||
class CCParticleDisplayData : public CCDisplayData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(ArmatureDisplayData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCParticleDisplayData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ArmatureDisplayData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ArmatureDisplayData();
|
||||
|
||||
inline void setParam(const char *displayName)
|
||||
{
|
||||
this->displayName = displayName;
|
||||
}
|
||||
void copy(ArmatureDisplayData *displayData);
|
||||
public:
|
||||
/**
|
||||
* If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from SpriteFrameCache.
|
||||
* It should note that when use this name to create Sprite from SpriteFrameCache, you should use _displayName + ".png", because when use Texture Packer to pack single image file, the name have ".png".
|
||||
*
|
||||
* If DisplayType is CS_DISPLAY_ARMATURE, the name is the Armature's name. When Bone init display and type is CS_DISPLAY_ARMATURE,
|
||||
* then Bone will create a Armature.
|
||||
*/
|
||||
std::string displayName;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class ParticleDisplayData : public DisplayData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(ParticleDisplayData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ParticleDisplayData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ParticleDisplayData() {};
|
||||
CCParticleDisplayData();
|
||||
virtual ~CCParticleDisplayData() {};
|
||||
|
||||
void setParam(const char *plist)
|
||||
{
|
||||
this->plist = plist;
|
||||
}
|
||||
|
||||
void copy(ParticleDisplayData *displayData);
|
||||
void copy(CCParticleDisplayData *displayData);
|
||||
public:
|
||||
std::string plist;
|
||||
};
|
||||
|
||||
|
||||
class ShaderDisplayData : public DisplayData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(ShaderDisplayData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ShaderDisplayData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ShaderDisplayData() {};
|
||||
|
||||
inline void setParam(const char *vert, const char *frag)
|
||||
{
|
||||
this->vert = vert;
|
||||
this->frag = frag;
|
||||
}
|
||||
|
||||
void copy(ShaderDisplayData *displayData);
|
||||
public:
|
||||
std::string vert;
|
||||
std::string frag;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* BoneData used to init a Bone.
|
||||
* BoneData keeps a DisplayData list, a Bone can have many display to change.
|
||||
* The display information saved in the DisplayData
|
||||
* CCBoneData used to init a CCBone.
|
||||
* CCBoneData keeps a CCDisplayData list, a CCBone can have many display to change.
|
||||
* The display information saved in the CCDisplayData
|
||||
*/
|
||||
class BoneData : public BaseData
|
||||
class CCBoneData : public CCBaseData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM(BoneData)
|
||||
CC_CREATE_NO_PARAM(CCBoneData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
BoneData(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~BoneData(void);
|
||||
CCBoneData(void);
|
||||
~CCBoneData(void);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
void addDisplayData(DisplayData *displayData);
|
||||
DisplayData *getDisplayData(int index);
|
||||
void addDisplayData(CCDisplayData *displayData);
|
||||
CCDisplayData *getDisplayData(int index);
|
||||
public:
|
||||
std::string name; //! the bone's name
|
||||
std::string parentName; //! the bone parent's name
|
||||
Array *displayDataList; //! save DisplayData informations for the Bone
|
||||
std::string name; //! the bone's name
|
||||
std::string parentName; //! the bone parent's name
|
||||
Array displayDataList; //! save CCDisplayData informations for the CCBone
|
||||
AffineTransform boneDataTransform;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* ArmatureData saved the Armature name and Bonedatas needed for the Bones in this Armature
|
||||
* When we create a Armature, we need to get each Bone's BoneData as it's init information.
|
||||
* So we can get a BoneData from the Dictionary saved in the ArmatureData.
|
||||
* CCArmatureData saved the CCArmature name and Bonedata needed for the CCBones in this CCArmature
|
||||
* When we create a CCArmature, we need to get each CCBone's CCBoneData as it's init information.
|
||||
* So we can get a CCBoneData from the Dictionary saved in the CCArmatureData.
|
||||
*/
|
||||
class ArmatureData : public Object
|
||||
class CCArmatureData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM(ArmatureData)
|
||||
CC_CREATE_NO_PARAM(CCArmatureData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ArmatureData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ArmatureData();
|
||||
CCArmatureData();
|
||||
~CCArmatureData();
|
||||
|
||||
bool init();
|
||||
void addBoneData(BoneData *boneData);
|
||||
BoneData *getBoneData(const char *boneName);
|
||||
void addBoneData(CCBoneData *boneData);
|
||||
CCBoneData *getBoneData(const char *boneName);
|
||||
public:
|
||||
std::string name;
|
||||
Dictionary *boneDataDic;
|
||||
Array *boneList;
|
||||
Dictionary boneDataDic;
|
||||
float dataVersion;
|
||||
};
|
||||
|
||||
enum CCBlendType
|
||||
{
|
||||
BLEND_NORMAL,
|
||||
BLEND_LAYER,
|
||||
BLEND_DARKEN,
|
||||
BLEND_MULTIPLY,
|
||||
BLEND_LIGHTEN,
|
||||
BLEND_SCREEN,
|
||||
BLEND_OVERLAY,
|
||||
BLEND_HARD_LIGHT,
|
||||
BLEND_ADD,
|
||||
BLEND_SUBSTRACT,
|
||||
BLEND_DIFFERENCE,
|
||||
BLEND_INVERT,
|
||||
BLEND_ALPHA,
|
||||
BLEND_ERASE
|
||||
};
|
||||
|
||||
|
||||
class FrameData : public BaseData
|
||||
class CCFrameData : public CCBaseData
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(FrameData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCFrameData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
FrameData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~FrameData();
|
||||
CCFrameData();
|
||||
~CCFrameData();
|
||||
|
||||
virtual void copy(FrameData *frameData);
|
||||
virtual void copy(const CCBaseData *baseData);
|
||||
public:
|
||||
int duration; //! The frame will last _duration frames
|
||||
TweenType tweenEasing; //! Every frame's tween easing effect
|
||||
int frameID;
|
||||
int duration; //! The frame will last duration frames
|
||||
CCTweenType tweenEasing; //! Every frame's tween easing effect
|
||||
|
||||
/**
|
||||
* The current display index when change to this frame.
|
||||
* If value is -1, then display will not show.
|
||||
* If value is -1, then display will not be shown.
|
||||
*/
|
||||
int displayIndex;
|
||||
|
||||
CCBlendType blendType;
|
||||
|
||||
std::string strEvent;
|
||||
/**
|
||||
* _movement, _event, _sound, _soundEffect do not support yet
|
||||
* strMovement, strEvent, strSound, strSoundEffect do not support yet
|
||||
*/
|
||||
std::string _movement;
|
||||
std::string _event;
|
||||
std::string _sound;
|
||||
std::string _soundEffect;
|
||||
std::string strMovement;
|
||||
std::string strSound;
|
||||
std::string strSoundEffect;
|
||||
};
|
||||
|
||||
|
||||
class MovementBoneData : public Object
|
||||
class CCMovementBoneData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM(MovementBoneData)
|
||||
CC_CREATE_NO_PARAM(CCMovementBoneData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MovementBoneData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~MovementBoneData(void);
|
||||
CCMovementBoneData();
|
||||
~CCMovementBoneData(void);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
void addFrameData(FrameData *frameData);
|
||||
FrameData *getFrameData(int index);
|
||||
void addFrameData(CCFrameData *frameData);
|
||||
CCFrameData *getFrameData(int index);
|
||||
public:
|
||||
float delay; //! movement delay percent, this value can produce a delay effect
|
||||
float scale; //! scale this movement
|
||||
float duration; //! this Bone in this movement will last _duration frames
|
||||
std::string name; //! bone name
|
||||
float delay; //! movement delay percent, this value can produce a delay effect
|
||||
float scale; //! scale this movement
|
||||
float duration; //! this CCBone in this movement will last m_iDuration frames
|
||||
std::string name; //! bone name
|
||||
|
||||
Array *frameList;
|
||||
Array frameList;
|
||||
};
|
||||
|
||||
|
||||
class MovementData : public Object
|
||||
class CCMovementData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(MovementData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCMovementData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
MovementData(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~MovementData(void);
|
||||
CCMovementData(void);
|
||||
~CCMovementData(void);
|
||||
|
||||
void addMovementBoneData(MovementBoneData *movBoneData);
|
||||
MovementBoneData *getMovementBoneData(const char *boneName);
|
||||
void addMovementBoneData(CCMovementBoneData *movBoneData);
|
||||
CCMovementBoneData *getMovementBoneData(const char *boneName);
|
||||
public:
|
||||
std::string name;
|
||||
int duration; //! the frames this movement will last
|
||||
float scale; //! scale this movement
|
||||
|
||||
/**
|
||||
* Change to this movement will last _durationTo frames. Use this effect can avoid too suddenly changing.
|
||||
* Change to this movement will last durationTo frames. Use this effect can avoid too suddenly changing.
|
||||
*
|
||||
* Example : current movement is "stand", we want to change to "run", then we fill _durationTo frames before
|
||||
* Example : current movement is "stand", we want to change to "run", then we fill durationTo frames before
|
||||
* change to "run" instead of changing to "run" directly.
|
||||
*/
|
||||
int durationTo;
|
||||
|
||||
/*
|
||||
* This is different from _duration, _durationTween contain tween effect.
|
||||
*
|
||||
* Example : If we edit 10 frames in the flash, then _duration is 10. When we set _durationTween to 50, the movement will last 50 frames, the extra 40 frames will auto filled with tween effect
|
||||
* This is different from duration, durationTween contain tween effect.
|
||||
* duration is the raw time that the animation will last, it's the same with the time you edit in the Action Editor.
|
||||
* durationTween is the actual time you want this animation last.
|
||||
* Example : If we edit 10 frames in the flash, then duration is 10. When we set durationTween to 50, the movement will last 50 frames, the extra 40 frames will auto filled with tween effect
|
||||
*/
|
||||
int durationTween;
|
||||
|
||||
bool loop; //! whether the movement is looped
|
||||
bool loop; //! whether the movement was looped
|
||||
|
||||
/**
|
||||
* Which tween easing effect the movement use
|
||||
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
|
||||
* TWEEN_EASING_MAX : use the value from CCMovementData get from flash design panel
|
||||
*/
|
||||
TweenType tweenEasing;
|
||||
CCTweenType tweenEasing;
|
||||
|
||||
/**
|
||||
* Dictionary to save movment bone data.
|
||||
* Key type is std::string, value type is MovementBoneData *.
|
||||
*/
|
||||
Dictionary *movBoneDataDic;
|
||||
* @brief save movment bone data
|
||||
* @key const char *
|
||||
* @value CCMovementBoneData *
|
||||
*/
|
||||
Dictionary movBoneDataDic;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* AnimationData include all movement infomation for the Armature
|
||||
* The struct is AnimationData -> MovementData -> MovementBoneData -> FrameData
|
||||
* CCAnimationData include all movement infomation for the CCArmature
|
||||
* The struct is CCAnimationData -> CCMovementData -> CCMovementBoneData -> CCFrameData
|
||||
* -> MovementFrameData
|
||||
*/
|
||||
class AnimationData : public Object
|
||||
class CCAnimationData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM_NO_INIT(AnimationData)
|
||||
CC_CREATE_NO_PARAM_NO_INIT(CCAnimationData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
AnimationData(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~AnimationData(void);
|
||||
CCAnimationData(void);
|
||||
~CCAnimationData(void);
|
||||
|
||||
void release();
|
||||
void retain();
|
||||
|
||||
void addMovement(MovementData *movData);
|
||||
MovementData *getMovement(const char *movementName);
|
||||
void addMovement(CCMovementData *movData);
|
||||
CCMovementData *getMovement(const char *movementName);
|
||||
int getMovementCount();
|
||||
public:
|
||||
std::string name;
|
||||
Dictionary *movementDataDic;
|
||||
Dictionary movementDataDic;
|
||||
std::vector<std::string> movementNames;
|
||||
};
|
||||
|
||||
|
||||
struct ContourVertex2F : public Object
|
||||
struct CCContourVertex2 : public Object
|
||||
{
|
||||
ContourVertex2F(float x, float y)
|
||||
CCContourVertex2(float x, float y)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
|
@ -490,67 +411,54 @@ struct ContourVertex2F : public Object
|
|||
};
|
||||
|
||||
/*
|
||||
* ContourData include a contour vertex information
|
||||
* CCContourData include a contour vertex information
|
||||
*/
|
||||
class ContourData : public Object
|
||||
class CCContourData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM(ContourData)
|
||||
CC_CREATE_NO_PARAM(CCContourData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ContourData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ContourData(void);
|
||||
CCContourData();
|
||||
~CCContourData(void);
|
||||
|
||||
virtual bool init();
|
||||
virtual void addVertex(Point *vertex);
|
||||
public:
|
||||
Array *vertexList; //! Save contour vertex info, vertex saved in a Point
|
||||
Array vertexList; //! Save contour vertex info, vertex saved in a Point
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* TextureData include a texture's information
|
||||
* CCTextureData include a texture's information
|
||||
*/
|
||||
class TextureData : public Object
|
||||
class CCTextureData : public Object
|
||||
{
|
||||
public:
|
||||
CS_CREATE_NO_PARAM(TextureData)
|
||||
CC_CREATE_NO_PARAM(CCTextureData)
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TextureData();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~TextureData(void);
|
||||
CCTextureData();
|
||||
~CCTextureData(void);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
void addContourData(ContourData *contourData);
|
||||
ContourData *getContourData(int index);
|
||||
void addContourData(CCContourData *contourData);
|
||||
CCContourData *getContourData(int index);
|
||||
public:
|
||||
|
||||
float height; //! The texture's width, height
|
||||
float height; //! The texture's width, height
|
||||
float width;
|
||||
|
||||
float pivotX; //! The texture's anchor point
|
||||
float pivotX; //! The texture's anchor point
|
||||
float pivotY;
|
||||
|
||||
std::string name; //! The texture's name
|
||||
std::string name; //! The texture's name
|
||||
|
||||
Array *contourDataList;
|
||||
Array contourDataList;
|
||||
};
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCARMATURE_DATAS_H__*/
|
||||
|
|
|
@ -26,11 +26,11 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../CCArmature.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
BatchNode *BatchNode::create()
|
||||
CCBatchNode *CCBatchNode::create()
|
||||
{
|
||||
BatchNode *batchNode = new BatchNode();
|
||||
CCBatchNode *batchNode = new CCBatchNode();
|
||||
if (batchNode && batchNode->init())
|
||||
{
|
||||
batchNode->autorelease();
|
||||
|
@ -40,29 +40,29 @@ BatchNode *BatchNode::create()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BatchNode::BatchNode()
|
||||
: _atlas(NULL)
|
||||
CCBatchNode::CCBatchNode()
|
||||
: m_pAtlas(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
bool BatchNode::init()
|
||||
bool CCBatchNode::init()
|
||||
{
|
||||
bool ret = Node::init();
|
||||
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
setShaderProgram(CCShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BatchNode::addChild(Node *child, int zOrder, int tag)
|
||||
void CCBatchNode::addChild(Node *child, int zOrder, int tag)
|
||||
{
|
||||
Node::addChild(child, zOrder, tag);
|
||||
Armature *armature = dynamic_cast<Armature *>(child);
|
||||
CCArmature *armature = dynamic_cast<CCArmature *>(child);
|
||||
if (armature != NULL)
|
||||
{
|
||||
armature->setBatchNode(this);
|
||||
}
|
||||
}
|
||||
|
||||
void BatchNode::visit()
|
||||
void CCBatchNode::visit()
|
||||
{
|
||||
// quick return if not visible. children won't be drawn.
|
||||
if (!_visible)
|
||||
|
@ -91,29 +91,29 @@ void BatchNode::visit()
|
|||
kmGLPopMatrix();
|
||||
}
|
||||
|
||||
void BatchNode::draw()
|
||||
void CCBatchNode::draw()
|
||||
{
|
||||
CC_NODE_DRAW_SETUP();
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_children, object)
|
||||
{
|
||||
Armature *armature = dynamic_cast<Armature *>(object);
|
||||
CCArmature *armature = dynamic_cast<CCArmature *>(object);
|
||||
if (armature)
|
||||
{
|
||||
armature->visit();
|
||||
_atlas = armature->getTextureAtlas();
|
||||
m_pAtlas = armature->getTextureAtlas();
|
||||
}
|
||||
else
|
||||
{
|
||||
static_cast<Node*>(object)->visit();
|
||||
((Node *)object)->visit();
|
||||
}
|
||||
}
|
||||
|
||||
if (_atlas)
|
||||
if (m_pAtlas)
|
||||
{
|
||||
_atlas->drawQuads();
|
||||
_atlas->removeAllQuads();
|
||||
m_pAtlas->drawQuads();
|
||||
m_pAtlas->removeAllQuads();
|
||||
}
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -27,14 +27,14 @@ THE SOFTWARE.
|
|||
|
||||
#include "../utils/CCArmatureDefine.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class BatchNode : public Node
|
||||
class CCBatchNode : public Node
|
||||
{
|
||||
public:
|
||||
static BatchNode *create();
|
||||
static CCBatchNode *create();
|
||||
public:
|
||||
BatchNode();
|
||||
CCBatchNode();
|
||||
|
||||
virtual bool init();
|
||||
virtual void addChild(Node *child, int zOrder, int tag);
|
||||
|
@ -42,9 +42,9 @@ public:
|
|||
void draw();
|
||||
|
||||
protected:
|
||||
TextureAtlas *_atlas;
|
||||
TextureAtlas *m_pAtlas;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCBATCHNODE_H__*/
|
||||
|
|
|
@ -23,13 +23,12 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCDecorativeDisplay.h"
|
||||
#include "../utils/CCConstValue.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
DecorativeDisplay *DecorativeDisplay::create()
|
||||
CCDecorativeDisplay *CCDecorativeDisplay::create()
|
||||
{
|
||||
DecorativeDisplay *pDisplay = new DecorativeDisplay();
|
||||
CCDecorativeDisplay *pDisplay = new CCDecorativeDisplay();
|
||||
if (pDisplay && pDisplay->init())
|
||||
{
|
||||
pDisplay->autorelease();
|
||||
|
@ -39,35 +38,30 @@ DecorativeDisplay *DecorativeDisplay::create()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
DecorativeDisplay::DecorativeDisplay()
|
||||
: _display(NULL)
|
||||
, _displayData(NULL)
|
||||
CCDecorativeDisplay::CCDecorativeDisplay()
|
||||
: m_pDisplay(NULL)
|
||||
, m_pDisplayData(NULL)
|
||||
|
||||
{
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
_colliderDetector = NULL;
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
m_pColliderDetector = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
DecorativeDisplay::~DecorativeDisplay(void)
|
||||
CCDecorativeDisplay::~CCDecorativeDisplay(void)
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_displayData);
|
||||
CC_SAFE_RELEASE_NULL(_display);
|
||||
CC_SAFE_RELEASE_NULL(m_pDisplayData);
|
||||
CC_SAFE_RELEASE_NULL(m_pDisplay);
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
CC_SAFE_RELEASE_NULL(_colliderDetector);
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_SAFE_RELEASE_NULL(m_pColliderDetector);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DecorativeDisplay::init()
|
||||
bool CCDecorativeDisplay::init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DecorativeDisplay::anchorPointChanged(float pointX, float pointY)
|
||||
{
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,44 +28,34 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "CCDisplayFactory.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
#include "../external_tool/sigslot.h"
|
||||
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
#include "../physics/CCColliderDetector.h"
|
||||
#endif
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class DecorativeDisplay: public Object, public sigslot::has_slots<>
|
||||
class CCDecorativeDisplay: public Object
|
||||
{
|
||||
public:
|
||||
static DecorativeDisplay *create();
|
||||
static CCDecorativeDisplay *create();
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DecorativeDisplay(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~DecorativeDisplay(void);
|
||||
CCDecorativeDisplay(void);
|
||||
~CCDecorativeDisplay(void);
|
||||
|
||||
virtual bool init();
|
||||
|
||||
protected:
|
||||
|
||||
CC_SYNTHESIZE_RETAIN(Node *, _display, Display);
|
||||
CC_SYNTHESIZE_RETAIN(DisplayData *, _displayData, DisplayData);
|
||||
CC_SYNTHESIZE_RETAIN(Node *, m_pDisplay, Display);
|
||||
CC_SYNTHESIZE_RETAIN(CCDisplayData *, m_pDisplayData, DisplayData);
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
CC_SYNTHESIZE_RETAIN(ColliderDetector *, _colliderDetector, ColliderDetector);
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_SYNTHESIZE_RETAIN(CCColliderDetector *, m_pColliderDetector, ColliderDetector);
|
||||
#endif
|
||||
public:
|
||||
void anchorPointChanged(float pointX, float pointY);
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCDECORATIVEDISPLAY_H__*/
|
||||
|
|
|
@ -26,14 +26,13 @@ THE SOFTWARE.
|
|||
#include "../CCBone.h"
|
||||
#include "../CCArmature.h"
|
||||
#include "../display/CCSkin.h"
|
||||
#include "../display/CCShaderNode.h"
|
||||
#include "../utils/CCSpriteFrameCacheHelper.h"
|
||||
#include "../utils/CCArmatureDataManager.h"
|
||||
#include "../utils/CCTransformHelp.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
void DisplayFactory::addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
|
||||
void CCDisplayFactory::addDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData)
|
||||
{
|
||||
switch(displayData->displayType)
|
||||
{
|
||||
|
@ -51,7 +50,7 @@ void DisplayFactory::addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, Disp
|
|||
}
|
||||
}
|
||||
|
||||
void DisplayFactory::createDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
||||
void CCDisplayFactory::createDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay)
|
||||
{
|
||||
switch(decoDisplay->getDisplayData()->displayType)
|
||||
{
|
||||
|
@ -69,56 +68,74 @@ void DisplayFactory::createDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
|||
}
|
||||
}
|
||||
|
||||
void DisplayFactory::updateDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty)
|
||||
void CCDisplayFactory::updateDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, float dt, bool dirty)
|
||||
{
|
||||
CS_RETURN_IF(!decoDisplay);
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (dirty)
|
||||
{
|
||||
ColliderDetector *detector = decoDisplay->getColliderDetector();
|
||||
CCColliderDetector *detector = decoDisplay->getColliderDetector();
|
||||
if (detector)
|
||||
{
|
||||
AffineTransform t = AffineTransformConcat(bone->nodeToArmatureTransform(), bone->getArmature()->getNodeToWorldTransform());
|
||||
detector->updateTransform(t);
|
||||
do
|
||||
{
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
CC_BREAK_IF(!detector->getBody());
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_BREAK_IF(!detector->getBody());
|
||||
#endif
|
||||
Node *node = decoDisplay->getDisplay();
|
||||
AffineTransform displayTransform = node->getNodeToParentTransform();
|
||||
Point anchorPoint = node->getAnchorPointInPoints();
|
||||
anchorPoint = PointApplyAffineTransform(anchorPoint, displayTransform);
|
||||
displayTransform.tx = anchorPoint.x;
|
||||
displayTransform.ty = anchorPoint.y;
|
||||
AffineTransform t = AffineTransformConcat(displayTransform, bone->getArmature()->getNodeToParentTransform());
|
||||
detector->updateTransform(t);
|
||||
}
|
||||
while (0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Node *display = decoDisplay->getDisplay();
|
||||
|
||||
switch(decoDisplay->getDisplayData()->displayType)
|
||||
{
|
||||
case CS_DISPLAY_SPRITE:
|
||||
updateSpriteDisplay(bone, decoDisplay, dt, dirty);
|
||||
updateSpriteDisplay(bone, display, dt, dirty);
|
||||
break;
|
||||
case CS_DISPLAY_PARTICLE:
|
||||
updateParticleDisplay(bone, decoDisplay, dt, dirty);
|
||||
updateParticleDisplay(bone, display, dt, dirty);
|
||||
break;
|
||||
case CS_DISPLAY_ARMATURE:
|
||||
updateArmatureDisplay(bone, decoDisplay, dt, dirty);
|
||||
updateArmatureDisplay(bone, display, dt, dirty);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
{
|
||||
display->setAdditionalTransform(bone->getNodeToArmatureTransform());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DisplayFactory::addSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
|
||||
void CCDisplayFactory::addSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData)
|
||||
{
|
||||
SpriteDisplayData *sdp = SpriteDisplayData::create();
|
||||
sdp->copy((SpriteDisplayData *)displayData);
|
||||
CCSpriteDisplayData *sdp = CCSpriteDisplayData::create();
|
||||
sdp->copy((CCSpriteDisplayData *)displayData);
|
||||
decoDisplay->setDisplayData(sdp);
|
||||
createSpriteDisplay(bone, decoDisplay);
|
||||
}
|
||||
|
||||
void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
||||
void CCDisplayFactory::createSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay)
|
||||
{
|
||||
Skin *skin = NULL;
|
||||
CCSkin *skin = NULL;
|
||||
|
||||
SpriteDisplayData *displayData = (SpriteDisplayData *)decoDisplay->getDisplayData();
|
||||
CCSpriteDisplayData *displayData = (CCSpriteDisplayData *)decoDisplay->getDisplayData();
|
||||
|
||||
//! remove .xxx
|
||||
std::string textureName = displayData->displayName;
|
||||
size_t startPos = textureName.find_last_of(".");
|
||||
|
||||
|
@ -130,75 +147,99 @@ void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisp
|
|||
//! create display
|
||||
if(textureName.length() == 0)
|
||||
{
|
||||
skin = Skin::create();
|
||||
skin = CCSkin::create();
|
||||
}
|
||||
else
|
||||
{
|
||||
skin = Skin::createWithSpriteFrameName((textureName + ".png").c_str());
|
||||
skin = CCSkin::createWithSpriteFrameName((textureName + ".png").c_str());
|
||||
}
|
||||
|
||||
TextureAtlas *atlas = SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->getTextureAtlas((textureName + ".png").c_str());
|
||||
skin->setTextureAtlas(atlas);
|
||||
skin->setBone(bone);
|
||||
|
||||
TextureData *textureData = ArmatureDataManager::sharedArmatureDataManager()->getTextureData(textureName.c_str());
|
||||
initSpriteDisplay(bone, decoDisplay, displayData->displayName.c_str(), skin);
|
||||
|
||||
CCArmature *armature = bone->getArmature();
|
||||
if (armature)
|
||||
{
|
||||
if (armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
|
||||
{
|
||||
skin->setSkinData(displayData->skinData);
|
||||
}
|
||||
else
|
||||
{
|
||||
skin->setSkinData(*bone->getBoneData());
|
||||
}
|
||||
}
|
||||
|
||||
decoDisplay->setDisplay(skin);
|
||||
|
||||
}
|
||||
|
||||
void CCDisplayFactory::initSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, const char *displayName, CCSkin *skin)
|
||||
{
|
||||
//! remove .xxx
|
||||
std::string textureName = displayName;
|
||||
size_t startPos = textureName.find_last_of(".");
|
||||
|
||||
if(startPos != std::string::npos)
|
||||
{
|
||||
textureName = textureName.erase(startPos);
|
||||
}
|
||||
|
||||
CCTextureData *textureData = CCArmatureDataManager::sharedArmatureDataManager()->getTextureData(textureName.c_str());
|
||||
if(textureData)
|
||||
{
|
||||
//! Init display anchorPoint, every Texture have a anchor point
|
||||
skin->setAnchorPoint(Point( textureData->pivotX, textureData->pivotY));
|
||||
}
|
||||
|
||||
skin->setBone(bone);
|
||||
skin->setSkinData(*bone->getBoneData());
|
||||
|
||||
decoDisplay->setDisplay(skin);
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
if (textureData && textureData->contourDataList->count() > 0)
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (textureData && textureData->contourDataList.count() > 0)
|
||||
{
|
||||
|
||||
//! create ContourSprite
|
||||
ColliderDetector *colliderDetector = ColliderDetector::create(bone);
|
||||
colliderDetector->addContourDataList(textureData->contourDataList);
|
||||
CCColliderDetector *colliderDetector = CCColliderDetector::create(bone);
|
||||
colliderDetector->addContourDataList(&textureData->contourDataList);
|
||||
|
||||
decoDisplay->setColliderDetector(colliderDetector);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DisplayFactory::updateSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty)
|
||||
void CCDisplayFactory::updateSpriteDisplay(CCBone *bone, Node *display, float dt, bool dirty)
|
||||
{
|
||||
Skin *skin = (Skin *)decoDisplay->getDisplay();
|
||||
skin->updateTransform();
|
||||
CS_RETURN_IF(!dirty);
|
||||
CCSkin *skin = (CCSkin *)display;
|
||||
skin->updateArmatureTransform();
|
||||
}
|
||||
|
||||
|
||||
void DisplayFactory::addArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
|
||||
void CCDisplayFactory::addArmatureDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData)
|
||||
{
|
||||
ArmatureDisplayData *adp = ArmatureDisplayData::create(); ;
|
||||
adp->copy((ArmatureDisplayData *)displayData);
|
||||
CCArmatureDisplayData *adp = CCArmatureDisplayData::create(); ;
|
||||
adp->copy((CCArmatureDisplayData *)displayData);
|
||||
decoDisplay->setDisplayData(adp);
|
||||
|
||||
createArmatureDisplay(bone, decoDisplay);
|
||||
}
|
||||
void DisplayFactory::createArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
||||
void CCDisplayFactory::createArmatureDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay)
|
||||
{
|
||||
ArmatureDisplayData *displayData = (ArmatureDisplayData *)decoDisplay->getDisplayData();
|
||||
CCArmatureDisplayData *displayData = (CCArmatureDisplayData *)decoDisplay->getDisplayData();
|
||||
|
||||
Armature *armature = Armature::create(displayData->displayName.c_str(), bone);
|
||||
CCArmature *armature = CCArmature::create(displayData->displayName.c_str(), bone);
|
||||
|
||||
/*
|
||||
* because this bone have called this name, so armature should change it's name, or it can't add to
|
||||
* Armature's bone children.
|
||||
* CCArmature's bone children.
|
||||
*/
|
||||
armature->setName((bone->getName() + "_armatureChild").c_str());
|
||||
|
||||
decoDisplay->setDisplay(armature);
|
||||
}
|
||||
void DisplayFactory::updateArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty)
|
||||
void CCDisplayFactory::updateArmatureDisplay(CCBone *bone, Node *display, float dt, bool dirty)
|
||||
{
|
||||
CS_RETURN_IF(!dirty);
|
||||
|
||||
Armature *armature = bone->getChildArmature();
|
||||
CCArmature *armature = (CCArmature *)display;
|
||||
if(armature)
|
||||
{
|
||||
armature->sortAllChildren();
|
||||
|
@ -208,25 +249,25 @@ void DisplayFactory::updateArmatureDisplay(Bone *bone, DecorativeDisplay *decoDi
|
|||
|
||||
|
||||
|
||||
void DisplayFactory::addParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
|
||||
void CCDisplayFactory::addParticleDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData)
|
||||
{
|
||||
ParticleDisplayData *adp = ParticleDisplayData::create(); ;
|
||||
adp->copy((ParticleDisplayData *)displayData);
|
||||
CCParticleDisplayData *adp = CCParticleDisplayData::create(); ;
|
||||
adp->copy((CCParticleDisplayData *)displayData);
|
||||
decoDisplay->setDisplayData(adp);
|
||||
|
||||
createParticleDisplay(bone, decoDisplay);
|
||||
}
|
||||
void DisplayFactory::createParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
||||
void CCDisplayFactory::createParticleDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay)
|
||||
{
|
||||
ParticleDisplayData *displayData = (ParticleDisplayData *)decoDisplay->getDisplayData();
|
||||
CCParticleDisplayData *displayData = (CCParticleDisplayData *)decoDisplay->getDisplayData();
|
||||
ParticleSystem *system = ParticleSystemQuad::create(displayData->plist.c_str());
|
||||
decoDisplay->setDisplay(system);
|
||||
}
|
||||
void DisplayFactory::updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty)
|
||||
void CCDisplayFactory::updateParticleDisplay(CCBone *bone, Node *display, float dt, bool dirty)
|
||||
{
|
||||
ParticleSystem *system = (ParticleSystem *)decoDisplay->getDisplay();
|
||||
BaseData node;
|
||||
TransformHelp::matrixToNode(bone->nodeToArmatureTransform(), node);
|
||||
ParticleSystem *system = (ParticleSystem *)display;
|
||||
CCBaseData node;
|
||||
CCTransformHelp::matrixToNode(bone->getNodeToArmatureTransform(), node);
|
||||
system->setPosition(node.x, node.y);
|
||||
system->setScaleX(node.scaleX);
|
||||
system->setScaleY(node.scaleY);
|
||||
|
@ -234,20 +275,4 @@ void DisplayFactory::updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDi
|
|||
}
|
||||
|
||||
|
||||
|
||||
void DisplayFactory::addShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
|
||||
{
|
||||
ShaderDisplayData *sdp = ShaderDisplayData::create();
|
||||
sdp->copy((ShaderDisplayData *)displayData);
|
||||
decoDisplay->setDisplayData(sdp);
|
||||
|
||||
createShaderDisplay(bone, decoDisplay);
|
||||
}
|
||||
void DisplayFactory::createShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay)
|
||||
{
|
||||
ShaderDisplayData *displayData = (ShaderDisplayData *)decoDisplay->getDisplayData();
|
||||
ShaderNode *sn = ShaderNode::shaderNodeWithVertex(displayData->vert.c_str(), displayData->frag.c_str());
|
||||
decoDisplay->setDisplay(sn);
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,38 +28,36 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class Skin;
|
||||
class Bone;
|
||||
class DecorativeDisplay;
|
||||
class DisplayData;
|
||||
class CCSkin;
|
||||
class CCBone;
|
||||
class CCDecorativeDisplay;
|
||||
class CCDisplayData;
|
||||
|
||||
class DisplayFactory
|
||||
class CCDisplayFactory
|
||||
{
|
||||
public:
|
||||
static void addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
|
||||
static void createDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
|
||||
static void updateDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty);
|
||||
static void addDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData);
|
||||
static void createDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay);
|
||||
static void updateDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, float dt, bool dirty);
|
||||
|
||||
static void addSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
|
||||
static void createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
|
||||
static void updateSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty);
|
||||
static void addSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData);
|
||||
static void createSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay);
|
||||
static void initSpriteDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, const char *displayName, CCSkin *skin);
|
||||
static void updateSpriteDisplay(CCBone *bone, Node *display, float dt, bool dirty);
|
||||
|
||||
static void addArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
|
||||
static void createArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
|
||||
static void updateArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty);
|
||||
|
||||
static void addParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
|
||||
static void createParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
|
||||
static void updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty);
|
||||
|
||||
static void addShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
|
||||
static void createShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
|
||||
static void addArmatureDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData);
|
||||
static void createArmatureDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay);
|
||||
static void updateArmatureDisplay(CCBone *bone, Node *display, float dt, bool dirty);
|
||||
|
||||
static void addParticleDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay, CCDisplayData *displayData);
|
||||
static void createParticleDisplay(CCBone *bone, CCDecorativeDisplay *decoDisplay);
|
||||
static void updateParticleDisplay(CCBone *bone, Node *display, float dt, bool dirty);
|
||||
};
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCDISPLAYFACTORY_H__*/
|
||||
|
|
|
@ -28,11 +28,11 @@ THE SOFTWARE.
|
|||
#include "../utils/CCUtilMath.h"
|
||||
#include "../display/CCSkin.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
DisplayManager *DisplayManager::create(Bone *bone)
|
||||
CCDisplayManager *CCDisplayManager::create(CCBone *bone)
|
||||
{
|
||||
DisplayManager *pDisplayManager = new DisplayManager();
|
||||
CCDisplayManager *pDisplayManager = new CCDisplayManager();
|
||||
if (pDisplayManager && pDisplayManager->init(bone))
|
||||
{
|
||||
pDisplayManager->autorelease();
|
||||
|
@ -43,38 +43,38 @@ DisplayManager *DisplayManager::create(Bone *bone)
|
|||
}
|
||||
|
||||
|
||||
DisplayManager::DisplayManager()
|
||||
: _decoDisplayList(NULL)
|
||||
, _displayRenderNode(NULL)
|
||||
, _currentDecoDisplay(NULL)
|
||||
, _displayIndex(-1)
|
||||
, _forceChangeDisplay(false)
|
||||
, _visible(true)
|
||||
, _bone(NULL)
|
||||
CCDisplayManager::CCDisplayManager()
|
||||
: m_pDecoDisplayList(NULL)
|
||||
, m_pDisplayRenderNode(NULL)
|
||||
, m_pCurrentDecoDisplay(NULL)
|
||||
, m_iDisplayIndex(-1)
|
||||
, m_bForceChangeDisplay(false)
|
||||
, m_bVisible(true)
|
||||
, m_pBone(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
DisplayManager::~DisplayManager()
|
||||
CCDisplayManager::~CCDisplayManager()
|
||||
{
|
||||
CC_SAFE_DELETE(_decoDisplayList);
|
||||
CC_SAFE_DELETE(m_pDecoDisplayList);
|
||||
|
||||
if( _displayRenderNode )
|
||||
if( m_pDisplayRenderNode )
|
||||
{
|
||||
_displayRenderNode->removeFromParentAndCleanup(true);
|
||||
if(_displayRenderNode->retainCount() > 0)
|
||||
CC_SAFE_RELEASE_NULL(_displayRenderNode);
|
||||
m_pDisplayRenderNode->removeFromParentAndCleanup(true);
|
||||
if(m_pDisplayRenderNode->retainCount() > 0)
|
||||
CC_SAFE_RELEASE_NULL(m_pDisplayRenderNode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool DisplayManager::init(Bone *bone)
|
||||
bool CCDisplayManager::init(CCBone *bone)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
_bone = bone;
|
||||
m_pBone = bone;
|
||||
|
||||
initDisplayList(bone->getBoneData());
|
||||
|
||||
|
@ -86,167 +86,239 @@ bool DisplayManager::init(Bone *bone)
|
|||
}
|
||||
|
||||
|
||||
void DisplayManager::addDisplay(DisplayData *displayData, int index)
|
||||
void CCDisplayManager::addDisplay(CCDisplayData *displayData, int index)
|
||||
{
|
||||
DecorativeDisplay *decoDisplay = NULL;
|
||||
CCDecorativeDisplay *decoDisplay = NULL;
|
||||
|
||||
if(index >= 0 && (unsigned int)index < _decoDisplayList->count())
|
||||
if(index >= 0 && (unsigned int)index < m_pDecoDisplayList->count())
|
||||
{
|
||||
decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
|
||||
decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->getObjectAtIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
decoDisplay = DecorativeDisplay::create();
|
||||
_decoDisplayList->addObject(decoDisplay);
|
||||
decoDisplay = CCDecorativeDisplay::create();
|
||||
m_pDecoDisplayList->addObject(decoDisplay);
|
||||
}
|
||||
|
||||
DisplayFactory::addDisplay(_bone, decoDisplay, displayData);
|
||||
CCDisplayFactory::addDisplay(m_pBone, decoDisplay, displayData);
|
||||
|
||||
//! if changed display index is current display index, then change current display to the new display
|
||||
if(index == _displayIndex)
|
||||
if(index == m_iDisplayIndex)
|
||||
{
|
||||
_displayIndex = -1;
|
||||
m_iDisplayIndex = -1;
|
||||
changeDisplayByIndex(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayManager::removeDisplay(int index)
|
||||
void CCDisplayManager::addDisplay(Node *display, int index)
|
||||
{
|
||||
_decoDisplayList->removeObjectAtIndex(index);
|
||||
CCDecorativeDisplay *decoDisplay = NULL;
|
||||
|
||||
if(index == _displayIndex)
|
||||
if(index >= 0 && (unsigned int)index < m_pDecoDisplayList->count())
|
||||
{
|
||||
decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->getObjectAtIndex(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
decoDisplay = CCDecorativeDisplay::create();
|
||||
m_pDecoDisplayList->addObject(decoDisplay);
|
||||
}
|
||||
|
||||
CCDisplayData *displayData = NULL;
|
||||
if (CCSkin *skin = dynamic_cast<CCSkin *>(display))
|
||||
{
|
||||
skin->setBone(m_pBone);
|
||||
displayData = CCSpriteDisplayData::create();
|
||||
|
||||
CCDisplayFactory::initSpriteDisplay(m_pBone, decoDisplay, skin->getDisplayName().c_str(), skin);
|
||||
|
||||
if (CCSpriteDisplayData *spriteDisplayData = (CCSpriteDisplayData *)decoDisplay->getDisplayData())
|
||||
{
|
||||
skin->setSkinData(spriteDisplayData->skinData);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCBaseData baseData;
|
||||
skin->setSkinData(baseData);
|
||||
}
|
||||
}
|
||||
else if (dynamic_cast<ParticleSystemQuad *>(display))
|
||||
{
|
||||
displayData = CCParticleDisplayData::create();
|
||||
}
|
||||
else if(CCArmature *armature = dynamic_cast<CCArmature *>(display))
|
||||
{
|
||||
displayData = CCArmatureDisplayData::create();
|
||||
armature->setParentBone(m_pBone);
|
||||
}
|
||||
else
|
||||
{
|
||||
displayData = CCDisplayData::create();
|
||||
}
|
||||
|
||||
decoDisplay->setDisplay(display);
|
||||
decoDisplay->setDisplayData(displayData);
|
||||
|
||||
//! if changed display index is current display index, then change current display to the new display
|
||||
if(index == m_iDisplayIndex)
|
||||
{
|
||||
m_iDisplayIndex = -1;
|
||||
changeDisplayByIndex(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CCDisplayManager::removeDisplay(int index)
|
||||
{
|
||||
m_pDecoDisplayList->removeObjectAtIndex(index);
|
||||
|
||||
if(index == m_iDisplayIndex)
|
||||
{
|
||||
setCurrentDecorativeDisplay(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayManager::changeDisplayByIndex(int index, bool force)
|
||||
Array *CCDisplayManager::getDecorativeDisplayList()
|
||||
{
|
||||
CCASSERT( (_decoDisplayList ? index < (int)_decoDisplayList->count() : true), "the _index value is out of range");
|
||||
return m_pDecoDisplayList;
|
||||
}
|
||||
|
||||
_forceChangeDisplay = force;
|
||||
void CCDisplayManager::changeDisplayByIndex(int index, bool force)
|
||||
{
|
||||
CCAssert( (m_pDecoDisplayList ? index < (int)m_pDecoDisplayList->count() : true), "the _index value is out of range");
|
||||
|
||||
m_bForceChangeDisplay = force;
|
||||
|
||||
//! If index is equal to current display index,then do nothing
|
||||
if ( _displayIndex == index)
|
||||
if ( m_iDisplayIndex == index)
|
||||
return;
|
||||
|
||||
|
||||
_displayIndex = index;
|
||||
m_iDisplayIndex = index;
|
||||
|
||||
//! If displayIndex < 0, it means you want to hide you display
|
||||
if (_displayIndex < 0)
|
||||
if (m_iDisplayIndex < 0)
|
||||
{
|
||||
if(_displayRenderNode)
|
||||
if(m_pDisplayRenderNode)
|
||||
{
|
||||
_displayRenderNode->removeFromParentAndCleanup(true);
|
||||
m_pDisplayRenderNode->removeFromParentAndCleanup(true);
|
||||
setCurrentDecorativeDisplay(NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DecorativeDisplay *decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(_displayIndex);
|
||||
CCDecorativeDisplay *decoDisplay = (CCDecorativeDisplay *)m_pDecoDisplayList->getObjectAtIndex(m_iDisplayIndex);
|
||||
|
||||
setCurrentDecorativeDisplay(decoDisplay);
|
||||
}
|
||||
|
||||
void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay)
|
||||
void CCDisplayManager::setCurrentDecorativeDisplay(CCDecorativeDisplay *decoDisplay)
|
||||
{
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector())
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (m_pCurrentDecoDisplay && m_pCurrentDecoDisplay->getColliderDetector())
|
||||
{
|
||||
_currentDecoDisplay->getColliderDetector()->setActive(false);
|
||||
m_pCurrentDecoDisplay->getColliderDetector()->setActive(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
_currentDecoDisplay = decoDisplay;
|
||||
m_pCurrentDecoDisplay = decoDisplay;
|
||||
|
||||
#if ENABLE_PHYSICS_DETECT
|
||||
if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector())
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (m_pCurrentDecoDisplay && m_pCurrentDecoDisplay->getColliderDetector())
|
||||
{
|
||||
_currentDecoDisplay->getColliderDetector()->setActive(true);
|
||||
m_pCurrentDecoDisplay->getColliderDetector()->setActive(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
Node *displayRenderNode = _currentDecoDisplay == NULL ? NULL : _currentDecoDisplay->getDisplay();
|
||||
if (_displayRenderNode)
|
||||
Node *displayRenderNode = m_pCurrentDecoDisplay == NULL ? NULL : m_pCurrentDecoDisplay->getDisplay();
|
||||
if (m_pDisplayRenderNode)
|
||||
{
|
||||
if (dynamic_cast<Armature *>(_displayRenderNode) != NULL)
|
||||
if (dynamic_cast<CCArmature *>(m_pDisplayRenderNode) != NULL)
|
||||
{
|
||||
_bone->setChildArmature(NULL);
|
||||
m_pBone->setChildArmature(NULL);
|
||||
}
|
||||
|
||||
_displayRenderNode->removeFromParentAndCleanup(true);
|
||||
_displayRenderNode->release();
|
||||
m_pDisplayRenderNode->removeFromParentAndCleanup(true);
|
||||
m_pDisplayRenderNode->release();
|
||||
}
|
||||
|
||||
_displayRenderNode = displayRenderNode;
|
||||
m_pDisplayRenderNode = displayRenderNode;
|
||||
|
||||
if(_displayRenderNode)
|
||||
if(m_pDisplayRenderNode)
|
||||
{
|
||||
if (dynamic_cast<Armature *>(_displayRenderNode) != NULL)
|
||||
if (CCArmature *armature = dynamic_cast<CCArmature *>(m_pDisplayRenderNode))
|
||||
{
|
||||
_bone->setChildArmature((Armature *)_displayRenderNode);
|
||||
m_pBone->setChildArmature(armature);
|
||||
}
|
||||
_displayRenderNode->retain();
|
||||
_displayRenderNode->setVisible(_visible);
|
||||
else if (ParticleSystemQuad *particle = dynamic_cast<ParticleSystemQuad *>(m_pDisplayRenderNode))
|
||||
{
|
||||
particle->resetSystem();
|
||||
}
|
||||
|
||||
if (RGBAProtocol *rgbaProtocaol = dynamic_cast<RGBAProtocol *>(m_pDisplayRenderNode))
|
||||
{
|
||||
rgbaProtocaol->setColor(m_pBone->getDisplayedColor());
|
||||
rgbaProtocaol->setOpacity(m_pBone->getDisplayedOpacity());
|
||||
}
|
||||
|
||||
m_pDisplayRenderNode->retain();
|
||||
m_pDisplayRenderNode->setVisible(m_bVisible);
|
||||
}
|
||||
}
|
||||
|
||||
Node *DisplayManager::getDisplayRenderNode()
|
||||
Node *CCDisplayManager::getDisplayRenderNode()
|
||||
{
|
||||
return _displayRenderNode;
|
||||
return m_pDisplayRenderNode;
|
||||
}
|
||||
|
||||
int DisplayManager::getCurrentDisplayIndex()
|
||||
int CCDisplayManager::getCurrentDisplayIndex()
|
||||
{
|
||||
return _displayIndex;
|
||||
return m_iDisplayIndex;
|
||||
}
|
||||
|
||||
DecorativeDisplay *DisplayManager::getCurrentDecorativeDisplay()
|
||||
CCDecorativeDisplay *CCDisplayManager::getCurrentDecorativeDisplay()
|
||||
{
|
||||
return _currentDecoDisplay;
|
||||
return m_pCurrentDecoDisplay;
|
||||
}
|
||||
|
||||
DecorativeDisplay *DisplayManager::getDecorativeDisplayByIndex( int index)
|
||||
CCDecorativeDisplay *CCDisplayManager::getDecorativeDisplayByIndex( int index)
|
||||
{
|
||||
return static_cast<DecorativeDisplay *>( _decoDisplayList->getObjectAtIndex(index) );
|
||||
return (CCDecorativeDisplay *)m_pDecoDisplayList->getObjectAtIndex(index);
|
||||
}
|
||||
|
||||
void DisplayManager::initDisplayList(BoneData *boneData)
|
||||
void CCDisplayManager::initDisplayList(CCBoneData *boneData)
|
||||
{
|
||||
CC_SAFE_DELETE(_decoDisplayList);
|
||||
_decoDisplayList = Array::create();
|
||||
_decoDisplayList->retain();
|
||||
CC_SAFE_DELETE(m_pDecoDisplayList);
|
||||
m_pDecoDisplayList = Array::create();
|
||||
m_pDecoDisplayList->retain();
|
||||
|
||||
CS_RETURN_IF(!boneData);
|
||||
|
||||
Object *object = NULL;
|
||||
Array *displayDataList = boneData->displayDataList;
|
||||
Array *displayDataList = &boneData->displayDataList;
|
||||
CCARRAY_FOREACH(displayDataList, object)
|
||||
{
|
||||
DisplayData *displayData = static_cast<DisplayData *>(object);
|
||||
CCDisplayData *displayData = (CCDisplayData *)object;
|
||||
|
||||
DecorativeDisplay *decoDisplay = DecorativeDisplay::create();
|
||||
CCDecorativeDisplay *decoDisplay = CCDecorativeDisplay::create();
|
||||
decoDisplay->setDisplayData(displayData);
|
||||
|
||||
DisplayFactory::createDisplay(_bone, decoDisplay);
|
||||
CCDisplayFactory::createDisplay(m_pBone, decoDisplay);
|
||||
|
||||
_decoDisplayList->addObject(decoDisplay);
|
||||
m_pDecoDisplayList->addObject(decoDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool DisplayManager::containPoint(Point &point)
|
||||
bool CCDisplayManager::containPoint(Point &point)
|
||||
{
|
||||
if(!_visible || _displayIndex < 0)
|
||||
if(!m_bVisible || m_iDisplayIndex < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
|
||||
switch (_currentDecoDisplay->getDisplayData()->displayType)
|
||||
switch (m_pCurrentDecoDisplay->getDisplayData()->displayType)
|
||||
{
|
||||
case CS_DISPLAY_SPRITE:
|
||||
{
|
||||
|
@ -258,7 +330,7 @@ bool DisplayManager::containPoint(Point &point)
|
|||
|
||||
Point outPoint = Point(0, 0);
|
||||
|
||||
Sprite *sprite = (Sprite *)_currentDecoDisplay->getDisplay();
|
||||
Sprite *sprite = (Sprite *)m_pCurrentDecoDisplay->getDisplay();
|
||||
sprite = (Sprite *)sprite->getChildByTag(0);
|
||||
|
||||
ret = CC_SPRITE_CONTAIN_POINT_WITH_RETURN(sprite, point, outPoint);
|
||||
|
@ -272,52 +344,52 @@ bool DisplayManager::containPoint(Point &point)
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool DisplayManager::containPoint(float x, float y)
|
||||
bool CCDisplayManager::containPoint(float x, float y)
|
||||
{
|
||||
Point p = Point(x, y);
|
||||
return containPoint(p);
|
||||
}
|
||||
|
||||
|
||||
void DisplayManager::setVisible(bool visible)
|
||||
void CCDisplayManager::setVisible(bool visible)
|
||||
{
|
||||
if(!_displayRenderNode)
|
||||
if(!m_pDisplayRenderNode)
|
||||
return;
|
||||
|
||||
_visible = visible;
|
||||
_displayRenderNode->setVisible(visible);
|
||||
m_bVisible = visible;
|
||||
m_pDisplayRenderNode->setVisible(visible);
|
||||
}
|
||||
|
||||
bool DisplayManager::isVisible()
|
||||
bool CCDisplayManager::isVisible()
|
||||
{
|
||||
return _visible;
|
||||
return m_bVisible;
|
||||
}
|
||||
|
||||
|
||||
Size DisplayManager::getContentSize()
|
||||
Size CCDisplayManager::getContentSize()
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Size(0, 0);
|
||||
return _displayRenderNode->getContentSize();
|
||||
CS_RETURN_IF(!m_pDisplayRenderNode) Size(0, 0);
|
||||
return m_pDisplayRenderNode->getContentSize();
|
||||
}
|
||||
|
||||
Rect DisplayManager::getBoundingBox()
|
||||
Rect CCDisplayManager::getBoundingBox()
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Rect(0, 0, 0, 0);
|
||||
return _displayRenderNode->getBoundingBox();
|
||||
CS_RETURN_IF(!m_pDisplayRenderNode) Rect(0, 0, 0, 0);
|
||||
return m_pDisplayRenderNode->getBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
Point DisplayManager::getAnchorPoint()
|
||||
Point CCDisplayManager::getAnchorPoint()
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Point(0, 0);
|
||||
return _displayRenderNode->getAnchorPoint();
|
||||
CS_RETURN_IF(!m_pDisplayRenderNode) Point(0, 0);
|
||||
return m_pDisplayRenderNode->getAnchorPoint();
|
||||
}
|
||||
|
||||
Point DisplayManager::getAnchorPointInPoints()
|
||||
Point CCDisplayManager::getAnchorPointInPoints()
|
||||
{
|
||||
CS_RETURN_IF(!_displayRenderNode) Point(0, 0);
|
||||
return _displayRenderNode->getAnchorPointInPoints();
|
||||
CS_RETURN_IF(!m_pDisplayRenderNode) Point(0, 0);
|
||||
return m_pDisplayRenderNode->getAnchorPointInPoints();
|
||||
}
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,35 +29,28 @@ THE SOFTWARE.
|
|||
#include "../display/CCDecorativeDisplay.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class Bone;
|
||||
class CCBone;
|
||||
|
||||
//! DisplayManager manages Bone's display
|
||||
class DisplayManager : public Object
|
||||
//! CCDisplayManager manages CCBone's display
|
||||
class CCDisplayManager : public Object
|
||||
{
|
||||
public:
|
||||
static DisplayManager *create(Bone *bone);
|
||||
static CCDisplayManager *create(CCBone *bone);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DisplayManager();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~DisplayManager();
|
||||
CCDisplayManager();
|
||||
~CCDisplayManager();
|
||||
|
||||
bool init(Bone *bone);
|
||||
bool init(CCBone *bone);
|
||||
|
||||
/**
|
||||
* Use BoneData to init the display list.
|
||||
* Use CCBoneData to init the display list.
|
||||
* If display is a sprite, and it have texture info in the TexutreData, then use TexutreData to init the display's anchor point
|
||||
* If the display is a Armature, then create a new Armature
|
||||
* If the display is a CCArmature, then create a new CCArmature
|
||||
*/
|
||||
void initDisplayList(BoneData *boneData);
|
||||
virtual void initDisplayList(CCBoneData *boneData);
|
||||
|
||||
/**
|
||||
* Add display and use _DisplayData init the display.
|
||||
|
@ -65,12 +58,14 @@ public:
|
|||
* If index is current display index, then also change display to _index
|
||||
*
|
||||
* @param displayData it include the display information, like DisplayType.
|
||||
* If you want to create a sprite display, then create a SpriteDisplayData param
|
||||
* If you want to create a sprite display, then create a CCSpriteDisplayData param
|
||||
*
|
||||
* @param index the index of the display you want to replace or add to
|
||||
* -1 : append display from back
|
||||
*/
|
||||
void addDisplay(DisplayData *displayData, int index);
|
||||
void addDisplay(CCDisplayData *displayData, int index);
|
||||
|
||||
void addDisplay(Node *display, int index);
|
||||
|
||||
void removeDisplay(int index);
|
||||
|
||||
|
@ -92,9 +87,9 @@ public:
|
|||
|
||||
int getCurrentDisplayIndex();
|
||||
|
||||
void setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay);
|
||||
DecorativeDisplay *getCurrentDecorativeDisplay();
|
||||
DecorativeDisplay *getDecorativeDisplayByIndex( int index);
|
||||
virtual void setCurrentDecorativeDisplay(CCDecorativeDisplay *decoDisplay);
|
||||
virtual CCDecorativeDisplay *getCurrentDecorativeDisplay();
|
||||
virtual CCDecorativeDisplay *getDecorativeDisplayByIndex( int index);
|
||||
|
||||
/**
|
||||
* Sets whether the display is visible
|
||||
|
@ -128,22 +123,22 @@ public:
|
|||
virtual bool containPoint(float x, float y);
|
||||
|
||||
protected:
|
||||
Array *_decoDisplayList;
|
||||
//! Display render node.
|
||||
Node *_displayRenderNode;
|
||||
Array *m_pDecoDisplayList;
|
||||
//! Display render node.
|
||||
Node *m_pDisplayRenderNode;
|
||||
//! Include current display information, like contour sprite, etc.
|
||||
DecorativeDisplay *_currentDecoDisplay;
|
||||
CCDecorativeDisplay *m_pCurrentDecoDisplay;
|
||||
//! Current display index
|
||||
int _displayIndex;
|
||||
int m_iDisplayIndex;
|
||||
|
||||
CC_SYNTHESIZE_PASS_BY_REF(bool, _forceChangeDisplay, ForceChangeDisplay)
|
||||
CC_SYNTHESIZE(bool, m_bForceChangeDisplay, ForceChangeDisplay)
|
||||
|
||||
//! Whether of not the bone is visible. Default is true
|
||||
bool _visible;
|
||||
bool m_bVisible;
|
||||
|
||||
Bone *_bone;
|
||||
CCBone *m_pBone;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCDISPLAYMANAGER_H__*/
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCShaderNode.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
enum
|
||||
{
|
||||
SIZE_X = 128,
|
||||
SIZE_Y = 128,
|
||||
};
|
||||
|
||||
ShaderNode::ShaderNode()
|
||||
: _center(Vertex2F(0.0f, 0.0f))
|
||||
, _resolution(Vertex2F(0.0f, 0.0f))
|
||||
, _time(0.0f)
|
||||
, _uniformCenter(0)
|
||||
, _uniformResolution(0)
|
||||
, _uniformTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
ShaderNode *ShaderNode::shaderNodeWithVertex(const char *vert, const char *frag)
|
||||
{
|
||||
ShaderNode *node = new ShaderNode();
|
||||
node->initWithVertex(vert, frag);
|
||||
node->autorelease();
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
bool ShaderNode::initWithVertex(const char *vert, const char *frag)
|
||||
{
|
||||
|
||||
loadShaderVertex(vert, frag);
|
||||
|
||||
_time = 0;
|
||||
_resolution = Vertex2F(SIZE_X, SIZE_Y);
|
||||
|
||||
scheduleUpdate();
|
||||
|
||||
setContentSize(Size(SIZE_X, SIZE_Y));
|
||||
setAnchorPoint(Point(0.5f, 0.5f));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShaderNode::loadShaderVertex(const char *vert, const char *frag)
|
||||
{
|
||||
GLProgram *shader = new GLProgram();
|
||||
shader->initWithVertexShaderFilename(vert, frag);
|
||||
|
||||
shader->addAttribute("aVertex", GLProgram::VERTEX_ATTRIB_POSITION);
|
||||
shader->link();
|
||||
|
||||
shader->updateUniforms();
|
||||
|
||||
_uniformCenter = glGetUniformLocation(shader->getProgram(), "center");
|
||||
_uniformResolution = glGetUniformLocation(shader->getProgram(), "resolution");
|
||||
_uniformTime = glGetUniformLocation(shader->getProgram(), "time");
|
||||
|
||||
this->setShaderProgram(shader);
|
||||
|
||||
shader->release();
|
||||
}
|
||||
|
||||
void ShaderNode::update(float dt)
|
||||
{
|
||||
_time += dt;
|
||||
}
|
||||
|
||||
void ShaderNode::translateFormOtherNode(AffineTransform &transform)
|
||||
{
|
||||
Node::setAdditionalTransform(transform);
|
||||
|
||||
_center = Vertex2F(_additionalTransform.tx * CC_CONTENT_SCALE_FACTOR(), _additionalTransform.ty * CC_CONTENT_SCALE_FACTOR());
|
||||
_resolution = Vertex2F( SIZE_X * _additionalTransform.a, SIZE_Y * _additionalTransform.d);
|
||||
}
|
||||
|
||||
void ShaderNode::setPosition(const Point &newPosition)
|
||||
{
|
||||
Node::setPosition(newPosition);
|
||||
Point position = getPosition();
|
||||
_center = Vertex2F(position.x * CC_CONTENT_SCALE_FACTOR(), position.y * CC_CONTENT_SCALE_FACTOR());
|
||||
}
|
||||
|
||||
void ShaderNode::draw()
|
||||
{
|
||||
CC_NODE_DRAW_SETUP();
|
||||
|
||||
float w = SIZE_X, h = SIZE_Y;
|
||||
GLfloat vertices[12] = {0, 0, w, 0, w, h, 0, 0, 0, h, w, h};
|
||||
|
||||
//
|
||||
// Uniforms
|
||||
//
|
||||
getShaderProgram()->setUniformLocationWith2f(_uniformCenter, _center.x, _center.y);
|
||||
getShaderProgram()->setUniformLocationWith2f(_uniformResolution, _resolution.x, _resolution.y);
|
||||
|
||||
|
||||
// time changes all the time, so it is Ok to call OpenGL directly, and not the "cached" version
|
||||
glUniform1f(_uniformTime, _time);
|
||||
|
||||
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POSITION);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
}
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
|
@ -1,57 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCSHADERNODE_H__
|
||||
#define __CCSHADERNODE_H__
|
||||
|
||||
#include "../utils/CCArmatureDefine.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
class ShaderNode : public Node
|
||||
{
|
||||
public:
|
||||
ShaderNode();
|
||||
|
||||
bool initWithVertex(const char *vert, const char *frag);
|
||||
void loadShaderVertex(const char *vert, const char *frag);
|
||||
|
||||
virtual void update(float dt);
|
||||
virtual void setPosition(const Point &newPosition);
|
||||
virtual void translateFormOtherNode(AffineTransform &transform);
|
||||
virtual void draw();
|
||||
|
||||
static ShaderNode *shaderNodeWithVertex(const char *vert, const char *frag);
|
||||
|
||||
private:
|
||||
|
||||
Vertex2F _center;
|
||||
Vertex2F _resolution;
|
||||
float _time;
|
||||
GLuint _uniformCenter, _uniformResolution, _uniformTime;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
#endif /*__CCSHADERNODE_H__*/
|
|
@ -24,8 +24,10 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCSkin.h"
|
||||
#include "../utils/CCTransformHelp.h"
|
||||
#include "../utils/CCSpriteFrameCacheHelper.h"
|
||||
#include "../CCArmature.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
#if CC_SPRITEBATCHNODE_RENDER_SUBPIXEL
|
||||
#define RENDER_IN_SUBPIXEL
|
||||
|
@ -33,9 +35,9 @@ namespace cocos2d { namespace extension { namespace armature {
|
|||
#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
|
||||
#endif
|
||||
|
||||
Skin *Skin::create()
|
||||
CCSkin *CCSkin::create()
|
||||
{
|
||||
Skin *skin = new Skin();
|
||||
CCSkin *skin = new CCSkin();
|
||||
if(skin && skin->init())
|
||||
{
|
||||
skin->autorelease();
|
||||
|
@ -45,9 +47,9 @@ Skin *Skin::create()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Skin *Skin::createWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||
CCSkin *CCSkin::createWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||
{
|
||||
Skin *skin = new Skin();
|
||||
CCSkin *skin = new CCSkin();
|
||||
if(skin && skin->initWithSpriteFrameName(pszSpriteFrameName))
|
||||
{
|
||||
skin->autorelease();
|
||||
|
@ -57,34 +59,78 @@ Skin *Skin::createWithSpriteFrameName(const char *pszSpriteFrameName)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Skin::Skin()
|
||||
: _bone(NULL)
|
||||
CCSkin *CCSkin::create(const char *pszFileName)
|
||||
{
|
||||
CCSkin *skin = new CCSkin();
|
||||
if(skin && skin->initWithFile(pszFileName))
|
||||
{
|
||||
skin->autorelease();
|
||||
return skin;
|
||||
}
|
||||
CC_SAFE_DELETE(skin);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Skin::setSkinData(const BaseData &var)
|
||||
CCSkin::CCSkin()
|
||||
: m_pBone(NULL)
|
||||
, m_strDisplayName("")
|
||||
{
|
||||
_skinData = var;
|
||||
|
||||
setScaleX(_skinData.scaleX);
|
||||
setScaleY(_skinData.scaleY);
|
||||
setRotation(CC_RADIANS_TO_DEGREES(_skinData.skewX));
|
||||
setPosition(Point(_skinData.x, _skinData.y));
|
||||
|
||||
_skinTransform = getNodeToParentTransform();
|
||||
m_tSkinTransform = AffineTransformIdentity;
|
||||
}
|
||||
|
||||
const BaseData &Skin::getSkinData() const
|
||||
bool CCSkin::initWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||
{
|
||||
return _skinData;
|
||||
bool ret = Sprite::initWithSpriteFrameName(pszSpriteFrameName);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
TextureAtlas *atlas = CCSpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->getTexureAtlasWithTexture(_texture);
|
||||
setTextureAtlas(atlas);
|
||||
|
||||
m_strDisplayName = pszSpriteFrameName;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Skin::updateTransform()
|
||||
bool CCSkin::initWithFile(const char *pszFilename)
|
||||
{
|
||||
_transform = AffineTransformConcat(_skinTransform, _bone->nodeToArmatureTransform());
|
||||
bool ret = Sprite::initWithFile(pszFilename);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
TextureAtlas *atlas = CCSpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->getTexureAtlasWithTexture(_texture);
|
||||
setTextureAtlas(atlas);
|
||||
|
||||
m_strDisplayName = pszFilename;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Skin::draw()
|
||||
void CCSkin::setSkinData(const CCBaseData &var)
|
||||
{
|
||||
m_sSkinData = var;
|
||||
|
||||
setScaleX(m_sSkinData.scaleX);
|
||||
setScaleY(m_sSkinData.scaleY);
|
||||
setRotation(CC_RADIANS_TO_DEGREES(m_sSkinData.skewX));
|
||||
setPosition(Point(m_sSkinData.x, m_sSkinData.y));
|
||||
|
||||
m_tSkinTransform = getNodeToParentTransform();
|
||||
}
|
||||
|
||||
const CCBaseData &CCSkin::getSkinData() const
|
||||
{
|
||||
return m_sSkinData;
|
||||
}
|
||||
|
||||
void CCSkin::updateArmatureTransform()
|
||||
{
|
||||
_transform = AffineTransformConcat(m_tSkinTransform, m_pBone->getNodeToArmatureTransform());
|
||||
}
|
||||
|
||||
void CCSkin::updateTransform()
|
||||
{
|
||||
// If it is not visible, or one of its ancestors is not visible, then do nothing:
|
||||
if( !_visible)
|
||||
|
@ -97,7 +143,7 @@ void Skin::draw()
|
|||
// calculate the Quad based on the Affine Matrix
|
||||
//
|
||||
|
||||
Size size = _rect.size;
|
||||
Size &size = _rect.size;
|
||||
|
||||
float x1 = _offsetPosition.x;
|
||||
float y1 = _offsetPosition.y;
|
||||
|
@ -137,4 +183,22 @@ void Skin::draw()
|
|||
}
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
AffineTransform CCSkin::getNodeToWorldTransform() const
|
||||
{
|
||||
return AffineTransformConcat(_transform, m_pBone->getArmature()->getNodeToWorldTransform());
|
||||
}
|
||||
|
||||
AffineTransform CCSkin::getNodeToWorldTransformAR() const
|
||||
{
|
||||
AffineTransform displayTransform = _transform;
|
||||
Point anchorPoint = _anchorPointInPoints;
|
||||
|
||||
anchorPoint = PointApplyAffineTransform(anchorPoint, displayTransform);
|
||||
|
||||
displayTransform.tx = anchorPoint.x;
|
||||
displayTransform.ty = anchorPoint.y;
|
||||
|
||||
return AffineTransformConcat(displayTransform, m_pBone->getArmature()->getNodeToWorldTransform());
|
||||
}
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,26 +28,34 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../CCBone.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class Skin : public Sprite
|
||||
class CCSkin : public Sprite
|
||||
{
|
||||
public:
|
||||
static Skin *create();
|
||||
static Skin *createWithSpriteFrameName(const char *pszSpriteFrameName);
|
||||
static CCSkin *create();
|
||||
static CCSkin *createWithSpriteFrameName(const char *pszSpriteFrameName);
|
||||
static CCSkin *create(const char *pszFileName);
|
||||
public:
|
||||
Skin();
|
||||
CCSkin();
|
||||
|
||||
bool initWithSpriteFrameName(const char *pszSpriteFrameName);
|
||||
bool initWithFile(const char *pszFilename);
|
||||
|
||||
void updateArmatureTransform();
|
||||
void updateTransform();
|
||||
void draw();
|
||||
|
||||
CC_PROPERTY_PASS_BY_REF(BaseData, _skinData, SkinData);
|
||||
CC_SYNTHESIZE(Bone *, _bone, Bone);
|
||||
AffineTransform getNodeToWorldTransform() const;
|
||||
AffineTransform getNodeToWorldTransformAR() const;
|
||||
|
||||
CC_PROPERTY_PASS_BY_REF(CCBaseData, m_sSkinData, SkinData);
|
||||
CC_SYNTHESIZE(CCBone *, m_pBone, Bone);
|
||||
|
||||
protected:
|
||||
AffineTransform _skinTransform;
|
||||
AffineTransform m_tSkinTransform;
|
||||
CC_SYNTHESIZE_READONLY(std::string, m_strDisplayName, DisplayName)
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCSKIN_H__*/
|
||||
|
|
|
@ -1,312 +0,0 @@
|
|||
//
|
||||
// Texture2DMutable.cpp
|
||||
// Ported to C++ by Dmitry Matyukhin
|
||||
//
|
||||
// MutableTexture.m
|
||||
// Created by Lam Hoang Pham.
|
||||
// Improved by Manuel Martinez-Almeida.
|
||||
//
|
||||
|
||||
|
||||
#include "CCTexture2DMutable.h"
|
||||
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
|
||||
void* Texture2DMutable::getOriginalTexData() {
|
||||
return originalData_;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* Texture2DMutable::getTexData() {
|
||||
return data_;
|
||||
}
|
||||
|
||||
void Texture2DMutable::setTexData(void *var) {
|
||||
data_ = var;
|
||||
}
|
||||
|
||||
|
||||
void Texture2DMutable::releaseData(void* data)
|
||||
{
|
||||
//Don't free the data
|
||||
}
|
||||
|
||||
void* Texture2DMutable::keepData(void* data, unsigned int lenght)
|
||||
{
|
||||
void *newData = malloc(lenght);
|
||||
memmove(newData, data, lenght);
|
||||
return newData;
|
||||
}
|
||||
|
||||
bool Texture2DMutable::initWithImageFile(const char *imageFile, cocos2d::Texture2D::PixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const cocos2d::Size& contentSize)
|
||||
{
|
||||
image_ = new cocos2d::Image();
|
||||
image_->initWithImageFile(imageFile);
|
||||
|
||||
|
||||
return initWithData(image_->getData(), image_->getDataLen(), pixelFormat, pixelsWide, pixelsHigh, contentSize);
|
||||
}
|
||||
|
||||
bool Texture2DMutable::initWithImageFile(const char *imageFile)
|
||||
{
|
||||
image_ = new cocos2d::Image();
|
||||
image_->initWithImageFile(imageFile);
|
||||
|
||||
bool hasAlpha = image_->hasAlpha();
|
||||
Size imageSize = Size((float)(image_->getWidth()), (float)(image_->getHeight()));
|
||||
size_t bpp = image_->getBitPerPixel();
|
||||
cocos2d::Texture2D::PixelFormat pixelFormat;
|
||||
|
||||
// compute pixel format
|
||||
if(hasAlpha)
|
||||
{
|
||||
pixelFormat = Texture2D::PixelFormat::DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bpp >= 8)
|
||||
{
|
||||
pixelFormat = Texture2D::PixelFormat::RGB888;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelFormat = Texture2D::PixelFormat::RGB565;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return initWithData(image_->getData(), image_->getDataLen(), pixelFormat, imageSize.width, imageSize.height, imageSize);
|
||||
}
|
||||
|
||||
bool Texture2DMutable::initWithData(const void* data, int dataLen, Texture2D::PixelFormat pixelFormat, unsigned int width, unsigned int height, const Size& size)
|
||||
{
|
||||
if(!Texture2D::initWithData(data, dataLen, pixelFormat, width, height, size)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (pixelFormat) {
|
||||
case Texture2D::PixelFormat::RGBA8888: bytesPerPixel_ = 4; break;
|
||||
case Texture2D::PixelFormat::A8: bytesPerPixel_ = 1; break;
|
||||
case Texture2D::PixelFormat::RGBA4444:
|
||||
case Texture2D::PixelFormat::RGB565:
|
||||
case Texture2D::PixelFormat::RGB5A1:
|
||||
bytesPerPixel_ = 2;
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
|
||||
data_ = (void*) data;
|
||||
|
||||
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
|
||||
unsigned int max = width * height * bytesPerPixel_;
|
||||
originalData_ = malloc(max);
|
||||
memcpy(originalData_, data_, max);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Color4B Texture2DMutable::pixelAt(const Point& pt)
|
||||
{
|
||||
|
||||
Color4B c(0, 0, 0, 0);
|
||||
if(!data_) return c;
|
||||
if(pt.x < 0 || pt.y < 0) return c;
|
||||
if(pt.x >= _contentSize.width || pt.y >= _contentSize.height) return c;
|
||||
|
||||
//! modified, texture origin point is left top, cocos2d origin point is left bottom
|
||||
//! unsigned int x = pt.x, y = pt.y
|
||||
unsigned int x = pt.x, y = _pixelsHigh - pt.y;
|
||||
|
||||
if(_pixelFormat == Texture2D::PixelFormat::RGBA8888){
|
||||
unsigned int *pixel = (unsigned int *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
c.r = *pixel & 0xff;
|
||||
c.g = (*pixel >> 8) & 0xff;
|
||||
c.b = (*pixel >> 16) & 0xff;
|
||||
c.a = (*pixel >> 24) & 0xff;
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGBA4444){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
c.a = ((*pixel & 0xf) << 4) | (*pixel & 0xf);
|
||||
c.b = (((*pixel >> 4) & 0xf) << 4) | ((*pixel >> 4) & 0xf);
|
||||
c.g = (((*pixel >> 8) & 0xf) << 4) | ((*pixel >> 8) & 0xf);
|
||||
c.r = (((*pixel >> 12) & 0xf) << 4) | ((*pixel >> 12) & 0xf);
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGB5A1){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
c.r = ((*pixel >> 11) & 0x1f)<<3;
|
||||
c.g = ((*pixel >> 6) & 0x1f)<<3;
|
||||
c.b = ((*pixel >> 1) & 0x1f)<<3;
|
||||
c.a = (*pixel & 0x1)*255;
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGB565){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
c.b = (*pixel & 0x1f)<<3;
|
||||
c.g = ((*pixel >> 5) & 0x3f)<<2;
|
||||
c.r = ((*pixel >> 11) & 0x1f)<<3;
|
||||
c.a = 255;
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::A8){
|
||||
GLubyte *pixel = (GLubyte *)data_;
|
||||
c.a = pixel[(y * _pixelsWide) + x];
|
||||
// Default white
|
||||
c.r = 255;
|
||||
c.g = 255;
|
||||
c.b = 255;
|
||||
}
|
||||
|
||||
//log("color : %i, %i, %i, %i", c.r, c.g, c.b, c.a);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
bool Texture2DMutable::setPixelAt(const Point& pt, Color4B c)
|
||||
{
|
||||
if(!data_)return false;
|
||||
if(pt.x < 0 || pt.y < 0) return false;
|
||||
if(pt.x >= _contentSize.width || pt.y >= _contentSize.height) return false;
|
||||
unsigned int x = pt.x, y = pt.y;
|
||||
|
||||
dirty_ = true;
|
||||
|
||||
// Shifted bit placement based on little-endian, let's make this more
|
||||
// portable =/
|
||||
|
||||
if(_pixelFormat == Texture2D::PixelFormat::RGBA8888){
|
||||
unsigned int *pixel = (unsigned int *)data_;
|
||||
pixel[(y * _pixelsWide) + x] = (c.a << 24) | (c.b << 16) | (c.g << 8) | c.r;
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGBA4444){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
*pixel = ((c.r >> 4) << 12) | ((c.g >> 4) << 8) | ((c.b >> 4) << 4) | (c.a >> 4);
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGB5A1){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
*pixel = ((c.r >> 3) << 11) | ((c.g >> 3) << 6) | ((c.b >> 3) << 1) | (c.a > 0);
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::RGB565){
|
||||
GLushort *pixel = (GLushort *)data_;
|
||||
pixel = pixel + (y * _pixelsWide) + x;
|
||||
*pixel = ((c.r >> 3) << 11) | ((c.g >> 2) << 5) | (c.b >> 3);
|
||||
} else if(_pixelFormat == Texture2D::PixelFormat::A8){
|
||||
GLubyte *pixel = (GLubyte *)data_;
|
||||
pixel[(y * _pixelsWide) + x] = c.a;
|
||||
} else {
|
||||
dirty_ = false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Texture2DMutable::fill(Color4B p)
|
||||
{
|
||||
for(int r = 0; r < _contentSize.height; ++r)
|
||||
for(int c = 0; c < _contentSize.width; ++c)
|
||||
this->setPixelAt(Point(c, r), p);
|
||||
}
|
||||
|
||||
Texture2D* Texture2DMutable::copyMutable(bool isMutable )
|
||||
{
|
||||
Texture2D* co;
|
||||
if(isMutable)
|
||||
{
|
||||
int mem = _pixelsWide*_pixelsHigh*bytesPerPixel_;
|
||||
void *newData = malloc(mem);
|
||||
memcpy(newData, data_, mem);
|
||||
co = new Texture2DMutable();
|
||||
if (!co->initWithData(newData, mem, _pixelFormat, _pixelsWide, _pixelsHigh, _contentSize)) {
|
||||
delete co;
|
||||
co = NULL;
|
||||
}
|
||||
}else {
|
||||
|
||||
co = new Texture2D();
|
||||
if (!co->initWithData(data_, _pixelsWide*_pixelsHigh*bytesPerPixel_, _pixelFormat, _pixelsWide, _pixelsHigh, _contentSize)) {
|
||||
delete co;
|
||||
co = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return co;
|
||||
}
|
||||
|
||||
Texture2DMutable* Texture2DMutable::copy()
|
||||
{
|
||||
return (Texture2DMutable*)this->copyMutable( true );
|
||||
}
|
||||
|
||||
void Texture2DMutable::copy(Texture2DMutable* textureToCopy, const Point& offset)
|
||||
{
|
||||
for(int r = 0; r < _contentSize.height;++r){
|
||||
for(int c = 0; c < _contentSize.width; ++c){
|
||||
setPixelAt(Point(c + offset.x, r + offset.y), textureToCopy->pixelAt(Point(c, r)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Texture2DMutable::restore()
|
||||
{
|
||||
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
|
||||
memcpy(data_, originalData_, bytesPerPixel_*_pixelsWide*_pixelsHigh);
|
||||
this->apply();
|
||||
#else
|
||||
//You should set CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA 1 in Texture2DMutable.h
|
||||
CCASSERT(false, "Exception: MutableTexture.restore was disabled by the user.");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Texture2DMutable::apply()
|
||||
{
|
||||
if(!data_) return;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, _name);
|
||||
|
||||
switch(_pixelFormat)
|
||||
{
|
||||
case Texture2D::PixelFormat::RGBA8888:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _pixelsWide, _pixelsHigh, 0, GL_RGBA, GL_UNSIGNED_BYTE, data_);
|
||||
break;
|
||||
case Texture2D::PixelFormat::RGBA4444:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _pixelsWide, _pixelsHigh, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, data_);
|
||||
break;
|
||||
case Texture2D::PixelFormat::RGB5A1:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _pixelsWide, _pixelsHigh, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, data_);
|
||||
break;
|
||||
case Texture2D::PixelFormat::RGB565:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, _pixelsWide, _pixelsHigh, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, data_);
|
||||
break;
|
||||
case Texture2D::PixelFormat::A8:
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, _pixelsWide, _pixelsHigh, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data_);
|
||||
break;
|
||||
default:
|
||||
CCASSERT(false, "NSInternalInconsistencyException");
|
||||
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
dirty_ = false;
|
||||
}
|
||||
|
||||
void *Texture2DMutable::getData()
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Texture2DMutable::Texture2DMutable(void)
|
||||
{
|
||||
image_ = NULL;
|
||||
}
|
||||
|
||||
Texture2DMutable::~Texture2DMutable(void)
|
||||
{
|
||||
CCLOGINFO("deallocing Texture2DMutable: %p", this);
|
||||
|
||||
CC_SAFE_DELETE(image_);
|
||||
|
||||
free(data_);
|
||||
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
|
||||
free(originalData_);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
//
|
||||
// Texture2DMutable.h
|
||||
// Ported to C++ by Dmitry Matyukhin
|
||||
//
|
||||
// MutableTexture.m
|
||||
// Created by Lam Hoang Pham.
|
||||
// Improved by Manuel Martinez-Almeida.
|
||||
//
|
||||
|
||||
#ifndef Texture2DMutable_cpp
|
||||
#define Texture2DMutable_cpp
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
#define CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA 0
|
||||
|
||||
class Texture2DMutable : public cocos2d::Texture2D
|
||||
{
|
||||
#if CC_MUTABLE_TEXTURE_SAVE_ORIGINAL_DATA
|
||||
|
||||
CC_PROPERTY_READONLY(void*, originalData_, OriginalTexData);
|
||||
|
||||
#endif
|
||||
|
||||
CC_PROPERTY(void*, data_, TexData);
|
||||
|
||||
|
||||
unsigned int bytesPerPixel_;
|
||||
bool dirty_;
|
||||
|
||||
cocos2d::Image *image_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Texture2DMutable(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~Texture2DMutable(void);
|
||||
|
||||
void restore();
|
||||
|
||||
/** These functions are needed to create mutable textures */
|
||||
void releaseData(void *data);
|
||||
void* keepData(void *data, unsigned int length);
|
||||
|
||||
bool initWithImageFile(const char *imageFile, cocos2d::Texture2D::PixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const cocos2d::Size& contentSize);
|
||||
|
||||
bool initWithImageFile(const char *imageFilex);
|
||||
|
||||
/** Intializes with a texture2d with data */
|
||||
bool initWithData(const void* data, int dataLen, cocos2d::Texture2D::PixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const cocos2d::Size& contentSize);
|
||||
|
||||
|
||||
cocos2d::Color4B pixelAt(const cocos2d::Point& pt);
|
||||
|
||||
///
|
||||
// @param pt is a point to get a pixel (0,0) is top-left to (width,height) bottom-right
|
||||
// @param c is a Color4B which is a colour.
|
||||
// @returns if a pixel was set
|
||||
// Remember to call apply to actually update the texture canvas.
|
||||
///
|
||||
bool setPixelAt(const cocos2d::Point& pt, cocos2d::Color4B c);
|
||||
|
||||
///
|
||||
// Fill with specified colour
|
||||
///
|
||||
void fill(cocos2d::Color4B c);
|
||||
|
||||
///
|
||||
// @param textureToCopy is the texture image to copy over
|
||||
// @param offset also offset's the texture image
|
||||
///
|
||||
Texture2D* copyMutable(bool isMutable);
|
||||
|
||||
Texture2DMutable* copy();
|
||||
|
||||
void copy(Texture2DMutable* textureToCopy, const cocos2d::Point& offset);
|
||||
|
||||
///
|
||||
// apply actually updates the texture with any new data we added.
|
||||
///
|
||||
void apply();
|
||||
|
||||
|
||||
void *getData();
|
||||
|
||||
};
|
||||
|
||||
#endif // Texture2DMutable_cpp
|
|
@ -1,254 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* iPhone port by Simon Oliver - http://www.simonoliver.com - http://www.handcircus.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#include "GLES-Render.h"
|
||||
#include "cocos2d.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
GLESDebugDraw::GLESDebugDraw()
|
||||
: mRatio( 1.0f )
|
||||
{
|
||||
this->initShader();
|
||||
}
|
||||
|
||||
GLESDebugDraw::GLESDebugDraw( float32 ratio )
|
||||
: mRatio( ratio )
|
||||
{
|
||||
this->initShader();
|
||||
}
|
||||
|
||||
void GLESDebugDraw::initShader( void )
|
||||
{
|
||||
mShaderProgram = ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||
|
||||
mColorLocation = glGetUniformLocation( mShaderProgram->getProgram(), "u_color");
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
b2Vec2* vertices = new b2Vec2[vertexCount];
|
||||
for( int i=0;i<vertexCount;i++)
|
||||
{
|
||||
vertices[i] = old_vertices[i];
|
||||
vertices[i] *= mRatio;
|
||||
}
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
delete[] vertices;
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawSolidPolygon(const b2Vec2* old_vertices, int vertexCount, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
b2Vec2* vertices = new b2Vec2[vertexCount];
|
||||
for( int i=0;i<vertexCount;i++) {
|
||||
vertices[i] = old_vertices[i];
|
||||
vertices[i] *= mRatio;
|
||||
}
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r*0.5f, color.g*0.5f, color.b*0.5f, 0.5f);
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, vertices);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(2);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
delete[] vertices;
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
const float32 k_segments = 16.0f;
|
||||
int vertexCount=16;
|
||||
const float32 k_increment = 2.0f * b2_pi / k_segments;
|
||||
float32 theta = 0.0f;
|
||||
|
||||
GLfloat* glVertices = new GLfloat[vertexCount*2];
|
||||
for (int i = 0; i < k_segments; ++i)
|
||||
{
|
||||
b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
|
||||
glVertices[i*2]=v.x * mRatio;
|
||||
glVertices[i*2+1]=v.y * mRatio;
|
||||
theta += k_increment;
|
||||
}
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, glVertices);
|
||||
|
||||
glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
delete[] glVertices;
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
const float32 k_segments = 16.0f;
|
||||
int vertexCount=16;
|
||||
const float32 k_increment = 2.0f * b2_pi / k_segments;
|
||||
float32 theta = 0.0f;
|
||||
|
||||
GLfloat* glVertices = new GLfloat[vertexCount*2];
|
||||
for (int i = 0; i < k_segments; ++i)
|
||||
{
|
||||
b2Vec2 v = center + radius * b2Vec2(cosf(theta), sinf(theta));
|
||||
glVertices[i*2]=v.x * mRatio;
|
||||
glVertices[i*2+1]=v.y * mRatio;
|
||||
theta += k_increment;
|
||||
}
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r*0.5f, color.g*0.5f, color.b*0.5f, 0.5f);
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, glVertices);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, vertexCount);
|
||||
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
glDrawArrays(GL_LINE_LOOP, 0, vertexCount);
|
||||
|
||||
// Draw the axis line
|
||||
DrawSegment(center,center+radius*axis,color);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(2);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
delete[] glVertices;
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
|
||||
GLfloat glVertices[] =
|
||||
{
|
||||
p1.x * mRatio, p1.y * mRatio,
|
||||
p2.x * mRatio, p2.y * mRatio
|
||||
};
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, glVertices);
|
||||
|
||||
glDrawArrays(GL_LINES, 0, 2);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawTransform(const b2Transform& xf)
|
||||
{
|
||||
b2Vec2 p1 = xf.p, p2;
|
||||
const float32 k_axisScale = 0.4f;
|
||||
p2 = p1 + k_axisScale * xf.q.GetXAxis();
|
||||
DrawSegment(p1, p2, b2Color(1,0,0));
|
||||
|
||||
p2 = p1 + k_axisScale * xf.q.GetYAxis();
|
||||
DrawSegment(p1,p2,b2Color(0,1,0));
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawPoint(const b2Vec2& p, float32 size, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
|
||||
// glPointSize(size);
|
||||
|
||||
GLfloat glVertices[] = {
|
||||
p.x * mRatio, p.y * mRatio
|
||||
};
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, glVertices);
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, 1);
|
||||
// glPointSize(1.0f);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawString(int x, int y, const char *string, ...)
|
||||
{
|
||||
// NSLog(@"DrawString: unsupported: %s", string);
|
||||
//printf(string);
|
||||
/* Unsupported as yet. Could replace with bitmap font renderer at a later date */
|
||||
}
|
||||
|
||||
void GLESDebugDraw::DrawAABB(b2AABB* aabb, const b2Color& color)
|
||||
{
|
||||
mShaderProgram->use();
|
||||
mShaderProgram->setUniformsForBuiltins();
|
||||
|
||||
mShaderProgram->setUniformLocationWith4f(mColorLocation, color.r, color.g, color.b, 1);
|
||||
|
||||
GLfloat glVertices[] = {
|
||||
aabb->lowerBound.x * mRatio, aabb->lowerBound.y * mRatio,
|
||||
aabb->upperBound.x * mRatio, aabb->lowerBound.y * mRatio,
|
||||
aabb->upperBound.x * mRatio, aabb->upperBound.y * mRatio,
|
||||
aabb->lowerBound.x * mRatio, aabb->upperBound.y * mRatio
|
||||
};
|
||||
|
||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, glVertices);
|
||||
glDrawArrays(GL_LINE_LOOP, 0, 8);
|
||||
|
||||
CC_INCREMENT_GL_DRAWS(1);
|
||||
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
|
||||
*
|
||||
* iPhone port by Simon Oliver - http://www.simonoliver.com - http://www.handcircus.com
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef CC_ARMATURE_GLES_RENDER_H
|
||||
#define CC_ARMATURE_GLES_RENDER_H
|
||||
|
||||
#include "Box2D/Box2D.h"
|
||||
#include "cocos2d.h"
|
||||
#include "ExtensionMacros.h"
|
||||
|
||||
struct b2AABB;
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
// This class implements debug drawing callbacks that are invoked
|
||||
// inside b2World::Step.
|
||||
class GLESDebugDraw : public b2Draw
|
||||
{
|
||||
float32 mRatio;
|
||||
cocos2d::GLProgram* mShaderProgram;
|
||||
GLint mColorLocation;
|
||||
|
||||
void initShader( void );
|
||||
public:
|
||||
GLESDebugDraw();
|
||||
|
||||
GLESDebugDraw( float32 ratio );
|
||||
|
||||
virtual void DrawPolygon(const b2Vec2* vertices, int vertexCount, const b2Color& color);
|
||||
|
||||
virtual void DrawSolidPolygon(const b2Vec2* vertices, int vertexCount, const b2Color& color);
|
||||
|
||||
virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color);
|
||||
|
||||
virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color);
|
||||
|
||||
virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color);
|
||||
|
||||
virtual void DrawTransform(const b2Transform& xf);
|
||||
|
||||
virtual void DrawPoint(const b2Vec2& p, float32 size, const b2Color& color);
|
||||
|
||||
virtual void DrawString(int x, int y, const char* string, ...);
|
||||
|
||||
virtual void DrawAABB(b2AABB* aabb, const b2Color& color);
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -23,15 +23,51 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCColliderDetector.h"
|
||||
#include "CCPhysicsWorld.h"
|
||||
#include "../CCBone.h"
|
||||
#include "../utils/CCTransformHelp.h"
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
#include "Box2D/Box2D.h"
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
#include "chipmunk.h"
|
||||
#endif
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
ColliderDetector *ColliderDetector::create()
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
ColliderBody::ColliderBody(CCContourData *contourData)
|
||||
: m_pFixture(NULL)
|
||||
, m_pFilter(NULL)
|
||||
, m_pContourData(contourData)
|
||||
{
|
||||
ColliderDetector *pColliderDetector = new ColliderDetector();
|
||||
CC_SAFE_RETAIN(m_pContourData);
|
||||
}
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
|
||||
ColliderBody::ColliderBody(CCContourData *contourData)
|
||||
: m_pShape(NULL)
|
||||
, m_pContourData(contourData)
|
||||
{
|
||||
CC_SAFE_RETAIN(m_pContourData);
|
||||
}
|
||||
#endif
|
||||
|
||||
ColliderBody::~ColliderBody()
|
||||
{
|
||||
CC_SAFE_RELEASE(m_pContourData);
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
CC_SAFE_DELETE(m_pFilter);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
CCColliderDetector *CCColliderDetector::create()
|
||||
{
|
||||
CCColliderDetector *pColliderDetector = new CCColliderDetector();
|
||||
if (pColliderDetector && pColliderDetector->init())
|
||||
{
|
||||
pColliderDetector->autorelease();
|
||||
|
@ -41,9 +77,9 @@ ColliderDetector *ColliderDetector::create()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ColliderDetector *ColliderDetector::create(Bone *bone)
|
||||
CCColliderDetector *CCColliderDetector::create(CCBone *bone)
|
||||
{
|
||||
ColliderDetector *pColliderDetector = new ColliderDetector();
|
||||
CCColliderDetector *pColliderDetector = new CCColliderDetector();
|
||||
if (pColliderDetector && pColliderDetector->init(bone))
|
||||
{
|
||||
pColliderDetector->autorelease();
|
||||
|
@ -53,37 +89,33 @@ ColliderDetector *ColliderDetector::create(Bone *bone)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ColliderDetector::ColliderDetector()
|
||||
: _colliderBodyList(NULL)
|
||||
CCColliderDetector::CCColliderDetector()
|
||||
: m_pColliderBodyList(NULL)
|
||||
, m_bActive(false)
|
||||
{
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
m_pBody = NULL;
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
m_pBody = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
ColliderDetector::~ColliderDetector()
|
||||
CCColliderDetector::~CCColliderDetector()
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_colliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
|
||||
|
||||
b2Body *body = colliderBody->getB2Body();
|
||||
PhysicsWorld::sharedPhysicsWorld()->getNoGravityWorld()->DestroyBody(body);
|
||||
}
|
||||
|
||||
|
||||
_colliderBodyList->removeAllObjects();
|
||||
CC_SAFE_DELETE(_colliderBodyList);
|
||||
m_pColliderBodyList->removeAllObjects();
|
||||
CC_SAFE_DELETE(m_pColliderBodyList);
|
||||
}
|
||||
|
||||
bool ColliderDetector::init()
|
||||
bool CCColliderDetector::init()
|
||||
{
|
||||
_colliderBodyList = Array::create();
|
||||
CCASSERT(_colliderBodyList, "create _colliderBodyList failed!");
|
||||
_colliderBodyList->retain();
|
||||
m_pColliderBodyList = Array::create();
|
||||
CCAssert(m_pColliderBodyList, "create m_pColliderBodyList failed!");
|
||||
m_pColliderBodyList->retain();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColliderDetector::init(Bone *bone)
|
||||
bool CCColliderDetector::init(CCBone *bone)
|
||||
{
|
||||
init();
|
||||
setBone(bone);
|
||||
|
@ -91,116 +123,278 @@ bool ColliderDetector::init(Bone *bone)
|
|||
return true;
|
||||
}
|
||||
|
||||
void ColliderDetector::addContourData(ContourData *contourData)
|
||||
void CCColliderDetector::addContourData(CCContourData *contourData)
|
||||
{
|
||||
const Array *array = contourData->vertexList;
|
||||
Object *object = NULL;
|
||||
|
||||
b2Vec2 *b2bv = new b2Vec2[contourData->vertexList->count()];
|
||||
|
||||
int i = 0;
|
||||
CCARRAY_FOREACH(array, object)
|
||||
{
|
||||
ContourVertex2F *v = static_cast<ContourVertex2F *>(object);
|
||||
b2bv[i].Set(v->x / PT_RATIO, v->y / PT_RATIO);
|
||||
i++;
|
||||
}
|
||||
|
||||
b2PolygonShape polygon;
|
||||
polygon.Set(b2bv, contourData->vertexList->count());
|
||||
|
||||
CC_SAFE_DELETE(b2bv);
|
||||
|
||||
b2FixtureDef fixtureDef;
|
||||
fixtureDef.shape = &polygon;
|
||||
fixtureDef.density = 10.0f;
|
||||
fixtureDef.isSensor = true;
|
||||
|
||||
b2BodyDef bodyDef;
|
||||
bodyDef.type = b2_dynamicBody;
|
||||
bodyDef.position = b2Vec2(0.0f, 0.0f);
|
||||
bodyDef.userData = _bone;
|
||||
|
||||
b2Body *body = PhysicsWorld::sharedPhysicsWorld()->getNoGravityWorld()->CreateBody(&bodyDef);
|
||||
body->CreateFixture(&fixtureDef);
|
||||
|
||||
ColliderBody *colliderBody = new ColliderBody(body, contourData);
|
||||
_colliderBodyList->addObject(colliderBody);
|
||||
ColliderBody *colliderBody = new ColliderBody(contourData);
|
||||
m_pColliderBodyList->addObject(colliderBody);
|
||||
colliderBody->release();
|
||||
}
|
||||
|
||||
void ColliderDetector::addContourDataList(Array *contourDataList)
|
||||
void CCColliderDetector::addContourDataList(Array *contourDataList)
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(contourDataList, object)
|
||||
{
|
||||
addContourData(static_cast<ContourData *>(object));
|
||||
addContourData((CCContourData *)object);
|
||||
}
|
||||
}
|
||||
|
||||
void ColliderDetector::removeContourData(ContourData *_contourData)
|
||||
void CCColliderDetector::removeContourData(CCContourData *contourData)
|
||||
{
|
||||
_colliderBodyList->removeObject(_contourData);
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *body = (ColliderBody*)object;
|
||||
if (body && body->getContourData() == contourData)
|
||||
{
|
||||
m_pColliderBodyList->removeObject(body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ColliderDetector::removeAll()
|
||||
void CCColliderDetector::removeAll()
|
||||
{
|
||||
_colliderBodyList->removeAllObjects();
|
||||
m_pColliderBodyList->removeAllObjects();
|
||||
}
|
||||
|
||||
void ColliderDetector::setColliderFilter(b2Filter &filter)
|
||||
|
||||
void CCColliderDetector::setActive(bool active)
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_colliderBodyList, object)
|
||||
if (m_bActive == active)
|
||||
{
|
||||
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
|
||||
colliderBody->getB2Body()->GetFixtureList()->SetFilterData(filter);
|
||||
return;
|
||||
}
|
||||
|
||||
m_bActive = active;
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
if (m_pBody)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
setBody(m_pBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
b2Fixture *fixture = colliderBody->getB2Fixture();
|
||||
|
||||
b2Filter *filter = colliderBody->getB2Filter();
|
||||
*filter = fixture->GetFilterData();
|
||||
|
||||
m_pBody->DestroyFixture(fixture);
|
||||
colliderBody->setB2Fixture(NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (m_pBody)
|
||||
{
|
||||
Object *object = NULL;
|
||||
if (m_bActive)
|
||||
{
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
cpShape *shape = colliderBody->getShape();
|
||||
cpSpaceAddShape(m_pBody->space_private, shape);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
cpShape *shape = colliderBody->getShape();
|
||||
cpSpaceRemoveShape(m_pBody->space_private, shape);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ColliderDetector::setActive(bool active)
|
||||
bool CCColliderDetector::getActive()
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_colliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
|
||||
colliderBody->getB2Body()->SetActive(active);
|
||||
}
|
||||
return m_bActive;
|
||||
}
|
||||
|
||||
Array *CCColliderDetector::getColliderBodyList()
|
||||
{
|
||||
return m_pColliderBodyList;
|
||||
}
|
||||
|
||||
|
||||
Point helpPoint;
|
||||
|
||||
void ColliderDetector::updateTransform(AffineTransform &t)
|
||||
void CCColliderDetector::updateTransform(AffineTransform &t)
|
||||
{
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(_colliderBodyList, object)
|
||||
if (!m_bActive)
|
||||
{
|
||||
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
|
||||
return;
|
||||
}
|
||||
|
||||
ContourData *contourData = colliderBody->getContourData();
|
||||
b2Body *body = colliderBody->getB2Body();
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
CCContourData *contourData = colliderBody->getContourData();
|
||||
|
||||
b2PolygonShape *shape = (b2PolygonShape *)body->GetFixtureList()->GetShape();
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
b2PolygonShape *shape = NULL;
|
||||
if (m_pBody != NULL)
|
||||
{
|
||||
shape = (b2PolygonShape *)colliderBody->getB2Fixture()->GetShape();
|
||||
}
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
cpPolyShape *shape = NULL;
|
||||
if (m_pBody != NULL)
|
||||
{
|
||||
shape = (cpPolyShape *)colliderBody->getShape();
|
||||
}
|
||||
#endif
|
||||
|
||||
//! update every vertex
|
||||
const Array *array = contourData->vertexList;
|
||||
int num = contourData->vertexList.count();
|
||||
CCContourVertex2 **vs = (CCContourVertex2 **)contourData->vertexList.data->arr;
|
||||
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
helpPoint.setPoint( vs[i]->x, vs[i]->y);
|
||||
helpPoint = PointApplyAffineTransform(helpPoint, t);
|
||||
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
if (shape != NULL)
|
||||
{
|
||||
b2Vec2 &bv = shape->m_vertices[i];
|
||||
bv.Set(helpPoint.x / PT_RATIO, helpPoint.y / PT_RATIO);
|
||||
}
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
if (shape != NULL)
|
||||
{
|
||||
cpVect v ;
|
||||
v.x = helpPoint.x;
|
||||
v.y = helpPoint.y;
|
||||
shape->verts[i] = v;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
cpConvexHull(num, shape->verts, NULL, NULL, 0);
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
cpVect b = shape->verts[(i + 1) % shape->numVerts];
|
||||
cpVect n = cpvnormalize(cpvperp(cpvsub(b, shape->verts[i])));
|
||||
|
||||
shape->planes[i].n = n;
|
||||
shape->planes[i].d = cpvdot(n, shape->verts[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
|
||||
void CCColliderDetector::setBody(b2Body *pBody)
|
||||
{
|
||||
m_pBody = pBody;
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
|
||||
CCContourData *contourData = colliderBody->getContourData();
|
||||
const Array *array = &contourData->vertexList;
|
||||
Object *object = NULL;
|
||||
|
||||
b2Vec2 *b2bv = new b2Vec2[contourData->vertexList.count()];
|
||||
|
||||
int i = 0;
|
||||
CCARRAY_FOREACH(array, object)
|
||||
{
|
||||
ContourVertex2F *cv = static_cast<ContourVertex2F *>(object);
|
||||
b2Vec2 &bv = shape->m_vertices[i];
|
||||
|
||||
helpPoint.setPoint(cv->x, cv->y);
|
||||
helpPoint = PointApplyAffineTransform(helpPoint, t);
|
||||
|
||||
bv.Set(helpPoint.x / PT_RATIO, helpPoint.y / PT_RATIO);
|
||||
|
||||
CCContourVertex2 *v = (CCContourVertex2 *)object;
|
||||
b2bv[i].Set(v->x / PT_RATIO, v->y / PT_RATIO);
|
||||
i++;
|
||||
}
|
||||
|
||||
b2PolygonShape polygon;
|
||||
polygon.Set(b2bv, contourData->vertexList.count());
|
||||
|
||||
CC_SAFE_DELETE(b2bv);
|
||||
|
||||
b2FixtureDef fixtureDef;
|
||||
fixtureDef.shape = &polygon;
|
||||
fixtureDef.isSensor = true;
|
||||
|
||||
b2Fixture *fixture = m_pBody->CreateFixture(&fixtureDef);
|
||||
fixture->SetUserData(m_pBone);
|
||||
|
||||
if (colliderBody->getB2Fixture() != NULL)
|
||||
{
|
||||
m_pBody->DestroyFixture(colliderBody->getB2Fixture());
|
||||
}
|
||||
colliderBody->setB2Fixture(fixture);
|
||||
|
||||
if (colliderBody->getB2Filter() == NULL)
|
||||
{
|
||||
b2Filter *filter = new b2Filter;
|
||||
colliderBody->setB2Filter(filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
fixture->SetFilterData(*colliderBody->getB2Filter());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
b2Body *CCColliderDetector::getBody()
|
||||
{
|
||||
return m_pBody;
|
||||
}
|
||||
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
void CCColliderDetector::setBody(cpBody *pBody)
|
||||
{
|
||||
m_pBody = pBody;
|
||||
|
||||
Object *object = NULL;
|
||||
CCARRAY_FOREACH(m_pColliderBodyList, object)
|
||||
{
|
||||
ColliderBody *colliderBody = (ColliderBody *)object;
|
||||
|
||||
CCContourData *contourData = colliderBody->getContourData();
|
||||
|
||||
int num = contourData->vertexList.count();
|
||||
CCContourVertex2 **vs = (CCContourVertex2 **)contourData->vertexList.data->arr;
|
||||
cpVect *verts = new cpVect[num];
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
verts[num - 1 - i].x = vs[i]->x;
|
||||
verts[num - 1 - i].y = vs[i]->y;
|
||||
}
|
||||
|
||||
cpShape *shape = cpPolyShapeNew(m_pBody, num, verts, cpvzero);
|
||||
|
||||
shape->sensor = true;
|
||||
shape->data = m_pBone;
|
||||
cpSpaceAddShape(m_pBody->space_private, shape);
|
||||
|
||||
colliderBody->setShape(shape);
|
||||
|
||||
delete []verts;
|
||||
}
|
||||
}
|
||||
|
||||
cpBody *CCColliderDetector::getBody()
|
||||
{
|
||||
return m_pBody;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,88 +28,87 @@ THE SOFTWARE.
|
|||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
#ifndef PT_RATIO
|
||||
#define PT_RATIO 32
|
||||
#endif
|
||||
|
||||
|
||||
class b2Body;
|
||||
class b2Fixture;
|
||||
struct b2Filter;
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
struct cpBody;
|
||||
struct cpShape;
|
||||
|
||||
class Bone;
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class CCBone;
|
||||
|
||||
class ColliderBody : public Object
|
||||
{
|
||||
public:
|
||||
ColliderBody(b2Body *b2b, ContourData *contourData)
|
||||
:_pB2b(NULL)
|
||||
,_contourData(NULL)
|
||||
{
|
||||
this->_pB2b = b2b;
|
||||
this->_contourData = contourData;
|
||||
CC_SAFE_RETAIN(_contourData);
|
||||
}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ColliderBody()
|
||||
{
|
||||
CC_SAFE_RELEASE(_contourData);
|
||||
}
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
CC_SYNTHESIZE(b2Fixture *, m_pFixture, B2Fixture)
|
||||
CC_SYNTHESIZE(b2Filter *, m_pFilter, B2Filter)
|
||||
|
||||
inline b2Body *getB2Body()
|
||||
{
|
||||
return _pB2b;
|
||||
}
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_SYNTHESIZE(cpShape *, m_pShape, Shape)
|
||||
#endif
|
||||
|
||||
inline ContourData *getContourData()
|
||||
{
|
||||
return _contourData;
|
||||
}
|
||||
public:
|
||||
ColliderBody(CCContourData *contourData);
|
||||
~ColliderBody();
|
||||
|
||||
inline CCContourData *getContourData()
|
||||
{
|
||||
return m_pContourData;
|
||||
}
|
||||
private:
|
||||
b2Body *_pB2b;
|
||||
ContourData *_contourData;
|
||||
CCContourData *m_pContourData;
|
||||
};
|
||||
|
||||
/*
|
||||
* @brief ContourSprite used to draw the contour of the display
|
||||
*/
|
||||
class ColliderDetector : public Object
|
||||
class CCColliderDetector : public Object
|
||||
{
|
||||
public:
|
||||
static ColliderDetector *create();
|
||||
static ColliderDetector *create(Bone *bone);
|
||||
static CCColliderDetector *create();
|
||||
static CCColliderDetector *create(CCBone *bone);
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ColliderDetector();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ColliderDetector(void);
|
||||
|
||||
CCColliderDetector();
|
||||
~CCColliderDetector(void);
|
||||
|
||||
virtual bool init();
|
||||
virtual bool init(Bone *bone);
|
||||
|
||||
void addContourData(ContourData *contourData);
|
||||
virtual bool init(CCBone *bone);
|
||||
|
||||
void addContourData(CCContourData *contourData);
|
||||
void addContourDataList(Array *contourDataList);
|
||||
|
||||
void removeContourData(ContourData *contourData);
|
||||
void removeAll();
|
||||
|
||||
|
||||
void removeContourData(CCContourData *contourData);
|
||||
void removeAll();
|
||||
|
||||
void updateTransform(AffineTransform &t);
|
||||
|
||||
void setColliderFilter(b2Filter &filter);
|
||||
|
||||
void setActive(bool active);
|
||||
private:
|
||||
Array *_colliderBodyList;
|
||||
|
||||
CC_SYNTHESIZE(Bone*, _bone, Bone);
|
||||
bool getActive();
|
||||
|
||||
Array *getColliderBodyList();
|
||||
|
||||
protected:
|
||||
Array *m_pColliderBodyList;
|
||||
CC_SYNTHESIZE(CCBone *, m_pBone, Bone);
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
CC_PROPERTY(b2Body *, m_pBody, Body);
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
CC_PROPERTY(cpBody *, m_pBody, Body);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
bool m_bActive;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCCOLLIDERDETECTOR_H__*/
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "CCPhysicsWorld.h"
|
||||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "Box2D/Box2D.h"
|
||||
#include "../external_tool/GLES-Render.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
|
||||
class Contact
|
||||
{
|
||||
public:
|
||||
b2Fixture *fixtureA;
|
||||
b2Fixture *fixtureB;
|
||||
};
|
||||
|
||||
class ContactListener : public b2ContactListener
|
||||
{
|
||||
//! Callbacks for derived classes.
|
||||
virtual void BeginContact(b2Contact *contact) override
|
||||
{
|
||||
if (contact)
|
||||
{
|
||||
Contact c;
|
||||
c.fixtureA = contact->GetFixtureA();
|
||||
c.fixtureB = contact->GetFixtureB();
|
||||
|
||||
contact_list.push_back(c);
|
||||
}
|
||||
B2_NOT_USED(contact);
|
||||
}
|
||||
virtual void EndContact(b2Contact *contact) override
|
||||
{
|
||||
contact_list.clear();
|
||||
B2_NOT_USED(contact);
|
||||
}
|
||||
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold) override
|
||||
{
|
||||
B2_NOT_USED(contact);
|
||||
B2_NOT_USED(oldManifold);
|
||||
}
|
||||
virtual void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse) override
|
||||
{
|
||||
B2_NOT_USED(contact);
|
||||
B2_NOT_USED(impulse);
|
||||
}
|
||||
|
||||
public:
|
||||
std::list<Contact> contact_list;
|
||||
};
|
||||
|
||||
|
||||
|
||||
PhysicsWorld *PhysicsWorld::s_PhysicsWorld = NULL;
|
||||
|
||||
|
||||
PhysicsWorld *PhysicsWorld::sharedPhysicsWorld()
|
||||
{
|
||||
if (s_PhysicsWorld == NULL)
|
||||
{
|
||||
s_PhysicsWorld = new PhysicsWorld();
|
||||
s_PhysicsWorld->initNoGravityWorld();
|
||||
}
|
||||
|
||||
return s_PhysicsWorld;
|
||||
}
|
||||
|
||||
void PhysicsWorld::purgePhysicsWorld()
|
||||
{
|
||||
delete s_PhysicsWorld;
|
||||
s_PhysicsWorld = NULL;
|
||||
}
|
||||
|
||||
PhysicsWorld::PhysicsWorld()
|
||||
: _noGravityWorld(NULL)
|
||||
, _debugDraw(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
PhysicsWorld::~PhysicsWorld()
|
||||
{
|
||||
CC_SAFE_DELETE(_debugDraw);
|
||||
CC_SAFE_DELETE(_noGravityWorld);
|
||||
CC_SAFE_DELETE(_contactListener);
|
||||
}
|
||||
|
||||
void PhysicsWorld::initNoGravityWorld()
|
||||
{
|
||||
b2Vec2 noGravity(0, 0);
|
||||
|
||||
_noGravityWorld = new b2World(noGravity);
|
||||
_noGravityWorld->SetAllowSleeping(true);
|
||||
|
||||
_contactListener = new ContactListener();
|
||||
_noGravityWorld->SetContactListener(_contactListener);
|
||||
|
||||
|
||||
#if ENABLE_PHYSICS_DEBUG
|
||||
_debugDraw = new GLESDebugDraw( PT_RATIO );
|
||||
_noGravityWorld->SetDebugDraw(_debugDraw);
|
||||
|
||||
uint32 flags = 0;
|
||||
flags += b2Draw::e_shapeBit;
|
||||
// flags += b2Draw::e_jointBit;
|
||||
// flags += b2Draw::e_aabbBit;
|
||||
// flags += b2Draw::e_pairBit;
|
||||
// flags += b2Draw::e_centerOfMassBit;
|
||||
_debugDraw->SetFlags(flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
b2World *PhysicsWorld::getNoGravityWorld()
|
||||
{
|
||||
return _noGravityWorld;
|
||||
}
|
||||
|
||||
void PhysicsWorld::update(float dt)
|
||||
{
|
||||
_noGravityWorld->Step(dt, 0, 0);
|
||||
|
||||
for (std::list<Contact>::iterator it = _contactListener->contact_list.begin(); it != _contactListener->contact_list.end(); ++it)
|
||||
{
|
||||
Contact &contact = *it;
|
||||
|
||||
b2Body *b2a = contact.fixtureA->GetBody();
|
||||
b2Body *b2b = contact.fixtureB->GetBody();
|
||||
|
||||
Bone *ba = (Bone *)b2a->GetUserData();
|
||||
Bone *bb = (Bone *)b2b->GetUserData();
|
||||
|
||||
BoneColliderSignal.emit(ba, bb);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PhysicsWorld::drawDebug()
|
||||
{
|
||||
_noGravityWorld->DrawDebugData();
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
|
@ -1,87 +0,0 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2013 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCPHYSICSWORLD_H__
|
||||
#define __CCPHYSICSWORLD_H__
|
||||
|
||||
#include "../utils/CCArmatureDefine.h"
|
||||
#include "../CCBone.h"
|
||||
#include "../external_tool/sigslot.h"
|
||||
|
||||
#include <list>
|
||||
using std::list;
|
||||
|
||||
#ifndef PT_RATIO
|
||||
#define PT_RATIO 32
|
||||
#endif
|
||||
|
||||
struct b2Manifold;
|
||||
struct b2ContactImpulse;
|
||||
class b2Fixture;
|
||||
class b2Contact;
|
||||
class b2World;
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
class ContactListener;
|
||||
class GLESDebugDraw;
|
||||
|
||||
class PhysicsWorld
|
||||
{
|
||||
public:
|
||||
static PhysicsWorld *sharedPhysicsWorld();
|
||||
static void purgePhysicsWorld();
|
||||
|
||||
void initNoGravityWorld();
|
||||
private:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
PhysicsWorld();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~PhysicsWorld();
|
||||
|
||||
private:
|
||||
static PhysicsWorld *s_PhysicsWorld;
|
||||
|
||||
b2World *_noGravityWorld;
|
||||
|
||||
ContactListener *_contactListener;
|
||||
|
||||
GLESDebugDraw *_debugDraw;
|
||||
public:
|
||||
void update(float dt);
|
||||
void drawDebug();
|
||||
|
||||
b2World *getNoGravityWorld();
|
||||
|
||||
sigslot::signal2<Bone *, Bone *> BoneColliderSignal;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
#endif/*__CCPHYSICSWORLD_H__*/
|
|
@ -27,18 +27,17 @@ THE SOFTWARE.
|
|||
#include "CCTransformHelp.h"
|
||||
#include "CCDataReaderHelper.h"
|
||||
#include "CCSpriteFrameCacheHelper.h"
|
||||
#include "../physics/CCPhysicsWorld.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
static ArmatureDataManager *s_sharedArmatureDataManager = NULL;
|
||||
static CCArmatureDataManager *s_sharedArmatureDataManager = NULL;
|
||||
|
||||
ArmatureDataManager *ArmatureDataManager::sharedArmatureDataManager()
|
||||
CCArmatureDataManager *CCArmatureDataManager::sharedArmatureDataManager()
|
||||
{
|
||||
if (s_sharedArmatureDataManager == NULL)
|
||||
{
|
||||
s_sharedArmatureDataManager = new ArmatureDataManager();
|
||||
s_sharedArmatureDataManager = new CCArmatureDataManager();
|
||||
if (!s_sharedArmatureDataManager || !s_sharedArmatureDataManager->init())
|
||||
{
|
||||
CC_SAFE_DELETE(s_sharedArmatureDataManager);
|
||||
|
@ -47,49 +46,48 @@ ArmatureDataManager *ArmatureDataManager::sharedArmatureDataManager()
|
|||
return s_sharedArmatureDataManager;
|
||||
}
|
||||
|
||||
ArmatureDataManager::ArmatureDataManager(void)
|
||||
void CCArmatureDataManager::purge()
|
||||
{
|
||||
_armarureDatas = NULL;
|
||||
_animationDatas = NULL;
|
||||
_textureDatas = NULL;
|
||||
}
|
||||
|
||||
|
||||
ArmatureDataManager::~ArmatureDataManager(void)
|
||||
{
|
||||
CCLOGINFO("deallocing ArmatureDataManager: %p", this);
|
||||
|
||||
removeAll();
|
||||
|
||||
CC_SAFE_RELEASE(_animationDatas);
|
||||
CC_SAFE_RELEASE(_armarureDatas);
|
||||
CC_SAFE_RELEASE(_textureDatas);
|
||||
}
|
||||
|
||||
void ArmatureDataManager::purgeArmatureSystem()
|
||||
{
|
||||
SpriteFrameCacheHelper::purgeSpriteFrameCacheHelper();
|
||||
PhysicsWorld::purgePhysicsWorld();
|
||||
|
||||
CCSpriteFrameCacheHelper::purge();
|
||||
CCDataReaderHelper::purge();
|
||||
CC_SAFE_RELEASE_NULL(s_sharedArmatureDataManager);
|
||||
}
|
||||
|
||||
bool ArmatureDataManager::init()
|
||||
CCArmatureDataManager::CCArmatureDataManager(void)
|
||||
{
|
||||
m_pArmarureDatas = NULL;
|
||||
m_pAnimationDatas = NULL;
|
||||
m_pTextureDatas = NULL;
|
||||
m_bAutoLoadSpriteFile = false;
|
||||
}
|
||||
|
||||
|
||||
CCArmatureDataManager::~CCArmatureDataManager(void)
|
||||
{
|
||||
removeAll();
|
||||
|
||||
CC_SAFE_DELETE(m_pAnimationDatas);
|
||||
CC_SAFE_DELETE(m_pArmarureDatas);
|
||||
CC_SAFE_DELETE(m_pTextureDatas);
|
||||
}
|
||||
|
||||
|
||||
bool CCArmatureDataManager::init()
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
_armarureDatas = new Dictionary;
|
||||
CCASSERT(_armarureDatas, "create ArmatureDataManager::_armarureDatas fail!");
|
||||
_armarureDatas->init();
|
||||
m_pArmarureDatas = Dictionary::create();
|
||||
CCAssert(m_pArmarureDatas, "create CCArmatureDataManager::m_pArmarureDatas fail!");
|
||||
m_pArmarureDatas->retain();
|
||||
|
||||
_animationDatas = new Dictionary;
|
||||
CCASSERT(_animationDatas, "create ArmatureDataManager::_animationDatas fail!");
|
||||
_animationDatas->init();
|
||||
m_pAnimationDatas = Dictionary::create();
|
||||
CCAssert(m_pAnimationDatas, "create CCArmatureDataManager::m_pAnimationDatas fail!");
|
||||
m_pAnimationDatas->retain();
|
||||
|
||||
_textureDatas = new Dictionary;
|
||||
CCASSERT(_textureDatas, "create ArmatureDataManager::_textureDatas fail!");
|
||||
_textureDatas->init();
|
||||
m_pTextureDatas = Dictionary::create();
|
||||
CCAssert(m_pTextureDatas, "create CCArmatureDataManager::m_pTextureDatas fail!");
|
||||
m_pTextureDatas->retain();
|
||||
|
||||
bRet = true;
|
||||
}
|
||||
|
@ -98,105 +96,153 @@ bool ArmatureDataManager::init()
|
|||
return bRet;
|
||||
}
|
||||
|
||||
void ArmatureDataManager::addArmatureData(const char *id, ArmatureData *armatureData)
|
||||
void CCArmatureDataManager::addArmatureData(const char *id, CCArmatureData *armatureData)
|
||||
{
|
||||
if(_armarureDatas)
|
||||
if(m_pArmarureDatas)
|
||||
{
|
||||
_armarureDatas->setObject(armatureData, id);
|
||||
m_pArmarureDatas->setObject(armatureData, id);
|
||||
}
|
||||
}
|
||||
|
||||
ArmatureData *ArmatureDataManager::getArmatureData(const char *id)
|
||||
CCArmatureData *CCArmatureDataManager::getArmatureData(const char *id)
|
||||
{
|
||||
ArmatureData *armatureData = NULL;
|
||||
if (_armarureDatas)
|
||||
CCArmatureData *armatureData = NULL;
|
||||
if (m_pArmarureDatas)
|
||||
{
|
||||
armatureData = (ArmatureData *)_armarureDatas->objectForKey(id);
|
||||
armatureData = (CCArmatureData *)m_pArmarureDatas->objectForKey(id);
|
||||
}
|
||||
return armatureData;
|
||||
}
|
||||
|
||||
void ArmatureDataManager::addAnimationData(const char *id, AnimationData *animationData)
|
||||
void CCArmatureDataManager::removeArmatureData(const char *id)
|
||||
{
|
||||
if(_animationDatas)
|
||||
if (m_pArmarureDatas)
|
||||
{
|
||||
_animationDatas->setObject(animationData, id);
|
||||
m_pArmarureDatas->removeObjectForKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
void ArmatureDataManager::addTextureData(const char *id, TextureData *textureData)
|
||||
void CCArmatureDataManager::addAnimationData(const char *id, CCAnimationData *animationData)
|
||||
{
|
||||
if(_textureDatas)
|
||||
if(m_pAnimationDatas)
|
||||
{
|
||||
_textureDatas->setObject(textureData, id);
|
||||
m_pAnimationDatas->setObject(animationData, id);
|
||||
}
|
||||
}
|
||||
|
||||
AnimationData *ArmatureDataManager::getAnimationData(const char *id)
|
||||
CCAnimationData *CCArmatureDataManager::getAnimationData(const char *id)
|
||||
{
|
||||
AnimationData *animationData = NULL;
|
||||
if (_animationDatas)
|
||||
CCAnimationData *animationData = NULL;
|
||||
if (m_pAnimationDatas)
|
||||
{
|
||||
animationData = (AnimationData *)_animationDatas->objectForKey(id);
|
||||
animationData = (CCAnimationData *)m_pAnimationDatas->objectForKey(id);
|
||||
}
|
||||
return animationData;
|
||||
}
|
||||
|
||||
TextureData *ArmatureDataManager::getTextureData(const char *id)
|
||||
void CCArmatureDataManager::removeAnimationData(const char *id)
|
||||
{
|
||||
TextureData *textureData = NULL;
|
||||
if (_textureDatas)
|
||||
if (m_pAnimationDatas)
|
||||
{
|
||||
textureData = (TextureData *)_textureDatas->objectForKey(id);
|
||||
m_pAnimationDatas->removeObjectForKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
void CCArmatureDataManager::addTextureData(const char *id, CCTextureData *textureData)
|
||||
{
|
||||
if(m_pTextureDatas)
|
||||
{
|
||||
m_pTextureDatas->setObject(textureData, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CCTextureData *CCArmatureDataManager::getTextureData(const char *id)
|
||||
{
|
||||
CCTextureData *textureData = NULL;
|
||||
if (m_pTextureDatas)
|
||||
{
|
||||
textureData = (CCTextureData *)m_pTextureDatas->objectForKey(id);
|
||||
}
|
||||
return textureData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ArmatureDataManager::addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath)
|
||||
void CCArmatureDataManager::removeTextureData(const char *id)
|
||||
{
|
||||
addArmatureFileInfo(imagePath, plistPath, configFilePath);
|
||||
if(m_pTextureDatas)
|
||||
{
|
||||
m_pTextureDatas->removeObjectForKey(id);
|
||||
}
|
||||
}
|
||||
|
||||
void ArmatureDataManager::addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath)
|
||||
void CCArmatureDataManager::addArmatureFileInfo(const char *configFilePath)
|
||||
{
|
||||
m_bAutoLoadSpriteFile = true;
|
||||
CCDataReaderHelper::sharedDataReaderHelper()->addDataFromFile(configFilePath);
|
||||
}
|
||||
|
||||
DataReaderHelper::addDataFromFile(configFilePath);
|
||||
void CCArmatureDataManager::addArmatureFileInfoAsync(const char *configFilePath, Object *target, SEL_SCHEDULE selector)
|
||||
{
|
||||
m_bAutoLoadSpriteFile = true;
|
||||
CCDataReaderHelper::sharedDataReaderHelper()->addDataFromFileAsync(configFilePath, target, selector);
|
||||
}
|
||||
|
||||
void CCArmatureDataManager::addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath)
|
||||
{
|
||||
m_bAutoLoadSpriteFile = false;
|
||||
CCDataReaderHelper::sharedDataReaderHelper()->addDataFromFile(configFilePath);
|
||||
addSpriteFrameFromFile(plistPath, imagePath);
|
||||
}
|
||||
|
||||
void ArmatureDataManager::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
|
||||
void CCArmatureDataManager::addArmatureFileInfoAsync(const char *imagePath, const char *plistPath, const char *configFilePath, Object *target, SEL_SCHEDULE selector)
|
||||
{
|
||||
// if(Game::sharedGame()->isUsePackage())
|
||||
// {
|
||||
// SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromPak(plistPath, imagePath);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromFile(plistPath, imagePath);
|
||||
// }
|
||||
SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromFile(plistPath, imagePath);
|
||||
m_bAutoLoadSpriteFile = false;
|
||||
CCDataReaderHelper::sharedDataReaderHelper()->addDataFromFileAsync(configFilePath, target, selector);
|
||||
addSpriteFrameFromFile(plistPath, imagePath);
|
||||
}
|
||||
|
||||
void CCArmatureDataManager::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
|
||||
{
|
||||
CCSpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromFile(plistPath, imagePath);
|
||||
}
|
||||
|
||||
|
||||
void ArmatureDataManager::removeAll()
|
||||
void CCArmatureDataManager::removeAll()
|
||||
{
|
||||
if( _animationDatas )
|
||||
if( m_pAnimationDatas )
|
||||
{
|
||||
_animationDatas->removeAllObjects();
|
||||
m_pAnimationDatas->removeAllObjects();
|
||||
}
|
||||
if( _armarureDatas )
|
||||
if( m_pArmarureDatas )
|
||||
{
|
||||
_armarureDatas->removeAllObjects();
|
||||
m_pArmarureDatas->removeAllObjects();
|
||||
}
|
||||
|
||||
if( _textureDatas )
|
||||
if( m_pTextureDatas )
|
||||
{
|
||||
_textureDatas->removeAllObjects();
|
||||
m_pTextureDatas->removeAllObjects();
|
||||
}
|
||||
|
||||
DataReaderHelper::clear();
|
||||
CCDataReaderHelper::clear();
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
bool CCArmatureDataManager::isAutoLoadSpriteFile()
|
||||
{
|
||||
return m_bAutoLoadSpriteFile;
|
||||
}
|
||||
|
||||
Dictionary *CCArmatureDataManager::getArmatureDatas() const
|
||||
{
|
||||
return m_pArmarureDatas;
|
||||
}
|
||||
Dictionary *CCArmatureDataManager::getAnimationDatas() const
|
||||
{
|
||||
return m_pAnimationDatas;
|
||||
}
|
||||
Dictionary *CCArmatureDataManager::getTextureDatas() const
|
||||
{
|
||||
return m_pTextureDatas;
|
||||
}
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -26,131 +26,159 @@ THE SOFTWARE.
|
|||
#define __CCARMATUREDATAMANAGER_H__
|
||||
|
||||
#include "CCArmatureDefine.h"
|
||||
#include "CCConstValue.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
/**
|
||||
* @brief format and manage armature configuration and armature animation
|
||||
* @brief format and manage armature configuration and armature animation
|
||||
*/
|
||||
class ArmatureDataManager : public Object
|
||||
class CCArmatureDataManager : public Object
|
||||
{
|
||||
public:
|
||||
static ArmatureDataManager *sharedArmatureDataManager();
|
||||
static void purgeArmatureSystem();
|
||||
static CCArmatureDataManager *sharedArmatureDataManager();
|
||||
|
||||
static void purge();
|
||||
private:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ArmatureDataManager(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~ArmatureDataManager(void);
|
||||
CCArmatureDataManager(void);
|
||||
~CCArmatureDataManager(void);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Init ArmatureDataManager
|
||||
* Init CCArmatureDataManager
|
||||
*/
|
||||
virtual bool init();
|
||||
|
||||
/**
|
||||
* @brief Add armature data.
|
||||
*
|
||||
* @param id The id of the armature data.
|
||||
* @param armatureData The armature data to be added.
|
||||
*/
|
||||
void addArmatureData(const char *id, ArmatureData *armatureData);
|
||||
|
||||
/**
|
||||
* @brief Get armature data.
|
||||
*
|
||||
* @param id The id of the armature data you want to get.
|
||||
*
|
||||
* @return The ArmatureData whose id is @p id.
|
||||
*/
|
||||
ArmatureData *getArmatureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Add animation data.
|
||||
*
|
||||
* @param id The id of the animation data.
|
||||
* @param animationData The animation data to be added.
|
||||
* Add armature data
|
||||
* @param id The id of the armature data
|
||||
* @param armatureData CCArmatureData *
|
||||
*/
|
||||
void addAnimationData(const char *id, AnimationData *animationData);
|
||||
|
||||
/**
|
||||
* @brief Get animation data.
|
||||
*
|
||||
* @param id The id of the animation data you want to get.
|
||||
*
|
||||
* @return The AnimationData whose id is @p id.
|
||||
*/
|
||||
AnimationData *getAnimationData(const char *id);
|
||||
void addArmatureData(const char *id, CCArmatureData *armatureData);
|
||||
|
||||
/**
|
||||
* @brief Add texture data.
|
||||
*
|
||||
* @param id The id of the texture data.
|
||||
* @param textureData The texture data to be added.
|
||||
* @brief get armature data
|
||||
* @param id the id of the armature data you want to get
|
||||
* @return CCArmatureData *
|
||||
*/
|
||||
void addTextureData(const char *id, TextureData *textureData);
|
||||
|
||||
/**
|
||||
* @brief Get texture data.
|
||||
*
|
||||
* @param id The id of the texture data you want to get.
|
||||
*
|
||||
* @return The TextureData whose id is @p id.
|
||||
*/
|
||||
TextureData *getTextureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
CCArmatureData *getArmatureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
|
||||
* @brief remove armature data
|
||||
* @param id the id of the armature data you want to get
|
||||
*/
|
||||
void removeArmatureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief add animation data
|
||||
* @param id the id of the animation data
|
||||
* @return CCAnimationData *
|
||||
*/
|
||||
void addAnimationData(const char *id, CCAnimationData *animationData);
|
||||
|
||||
/**
|
||||
* @brief get animation data from m_pAnimationDatas(Dictionary)
|
||||
* @param id the id of the animation data you want to get
|
||||
* @return CCAnimationData *
|
||||
*/
|
||||
CCAnimationData *getAnimationData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief remove animation data
|
||||
* @param id the id of the animation data
|
||||
*/
|
||||
void removeAnimationData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief add texture data
|
||||
* @param id the id of the texture data
|
||||
* @return CCTextureData *
|
||||
*/
|
||||
void addTextureData(const char *id, CCTextureData *textureData);
|
||||
|
||||
/**
|
||||
* @brief get texture data
|
||||
* @param id the id of the texture data you want to get
|
||||
* @return CCTextureData *
|
||||
*/
|
||||
CCTextureData *getTextureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief remove texture data
|
||||
* @param id the id of the texture data you want to get
|
||||
*/
|
||||
void removeTextureData(const char *id);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by CCArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *configFilePath);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by CCArmatureDataManager.
|
||||
* It will load data in a new thread
|
||||
*/
|
||||
void addArmatureFileInfoAsync(const char *configFilePath, Object *target, SEL_SCHEDULE selector);
|
||||
|
||||
/**
|
||||
* @brief Add ArmatureFileInfo, it is managed by CCArmatureDataManager.
|
||||
*/
|
||||
void addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath);
|
||||
|
||||
/**
|
||||
* @brief Add sprite frame to SpriteFrameCache, it will save display name and it's relative image name
|
||||
* @brief Add ArmatureFileInfo, it is managed by CCArmatureDataManager.
|
||||
* It will load data in a new thread
|
||||
*/
|
||||
void addArmatureFileInfoAsync(const char *imagePath, const char *plistPath, const char *configFilePath, Object *target, SEL_SCHEDULE selector);
|
||||
|
||||
/**
|
||||
* @brief Add sprite frame to CCSpriteFrameCache, it will save display name and it's relative image name
|
||||
*/
|
||||
void addSpriteFrameFromFile(const char *plistPath, const char *imagePath);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clear the data in the _armarureDatas and _animationDatas, and set _armarureDatas and _animationDatas to NULL
|
||||
* @brief Clear the data in the m_pArmarureDatas and m_pAnimationDatas, and set m_pArmarureDatas and m_pAnimationDatas to NULL
|
||||
*/
|
||||
void removeAll();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Juge whether or not need auto load sprite file
|
||||
*/
|
||||
bool isAutoLoadSpriteFile();
|
||||
|
||||
|
||||
Dictionary *getArmatureDatas() const;
|
||||
Dictionary *getAnimationDatas() const;
|
||||
Dictionary *getTextureDatas() const;
|
||||
private:
|
||||
/**
|
||||
* Dictionary to save amature data.
|
||||
* Key type is std::string, value type is ArmatureData *.
|
||||
* @brief save amature datas
|
||||
* @key std::string
|
||||
* @value CCArmatureData *
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _armarureDatas, ArmarureDatas);
|
||||
Dictionary *m_pArmarureDatas;
|
||||
|
||||
/**
|
||||
* Dictionary to save animation data.
|
||||
* Key type is std::string, value type is AnimationData *.
|
||||
* @brief save animation datas
|
||||
* @key std::string
|
||||
* @value CCAnimationData *
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _animationDatas, AnimationDatas);
|
||||
Dictionary *m_pAnimationDatas;
|
||||
|
||||
/**
|
||||
* Dictionary to save texture data.
|
||||
* Key type is std::string, value type is TextureData *.
|
||||
* @brief save texture datas
|
||||
* @key std::string
|
||||
* @value CCTextureData *
|
||||
*/
|
||||
CC_SYNTHESIZE_READONLY(Dictionary *, _textureDatas, TextureDatas);
|
||||
Dictionary *m_pTextureDatas;
|
||||
|
||||
bool m_bAutoLoadSpriteFile;
|
||||
};
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif/*__CCARMATUREDATAMANAGER_H__*/
|
||||
|
|
|
@ -22,8 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __CCCONSTVALUE_H__
|
||||
#define __CCCONSTVALUE_H__
|
||||
#include "CCArmatureDefine.h"
|
||||
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
#endif /*__CCCONSTVALUE_H__*/
|
||||
const char *armatureVersion()
|
||||
{
|
||||
return "0.4.0.0";
|
||||
}
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
|
@ -25,27 +25,37 @@ THE SOFTWARE.
|
|||
#ifndef __CCARMATUREDEFINE_H__
|
||||
#define __CCARMATUREDEFINE_H__
|
||||
|
||||
//#define _USRDLL 1
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "ExtensionMacros.h"
|
||||
|
||||
#define VERSION_COMBINED 0.30f
|
||||
|
||||
#ifndef ENABLE_PHYSICS_DEBUG
|
||||
#define ENABLE_PHYSICS_DEBUG 1
|
||||
|
||||
#ifndef AUTO_ADD_SPRITE_FRAME_NAME_PREFIX
|
||||
#define AUTO_ADD_SPRITE_FRAME_NAME_PREFIX 0
|
||||
#endif // !AUTO_ADD_SPRITE_FRAME_NAME_PREFIX
|
||||
|
||||
|
||||
#ifndef ENABLE_PHYSICS_BOX2D_DETECT
|
||||
#define ENABLE_PHYSICS_BOX2D_DETECT 0
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_PHYSICS_DETECT
|
||||
#define ENABLE_PHYSICS_DETECT 1
|
||||
#ifndef ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
#define ENABLE_PHYSICS_CHIPMUNK_DETECT 1
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_VERTEXZ_VALUE 5000000.0f
|
||||
#define ARMATURE_MAX_CHILD 50.0f
|
||||
#define ARMATURE_MAX_ZORDER 100
|
||||
#define ARMATURE_MAX_COUNT ((MAX_VERTEXZ_VALUE) / (ARMATURE_MAX_CHILD) / ARMATURE_MAX_ZORDER)
|
||||
|
||||
#define CS_RETURN_IF(cond) if (cond) return
|
||||
#define CS_RETURN_NULL_IF(cond) if (cond) return NULL;
|
||||
|
||||
#define NS_CC_EXT_ARMATURE_BEGIN namespace cocos2d { namespace extension { namespace armature {
|
||||
#define NS_CC_EXT_ARMATURE_END }}}
|
||||
#define USING_NS_CC_EXT_ARMATURE using namespace cocos2d::extension::armature
|
||||
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
const char *armatureVersion();
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCARMATUREDEFINE_H__*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -27,19 +27,54 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCArmatureDefine.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
#include "../utils/CCConstValue.h"
|
||||
#include "../CCArmature.h"
|
||||
#include "../../Json/CSContentJsonDictionary.h"
|
||||
|
||||
namespace tinyxml2 { class XMLElement; }
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
|
||||
class DataReaderHelper
|
||||
namespace tinyxml2
|
||||
{
|
||||
class XMLElement;
|
||||
}
|
||||
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
|
||||
class CCDataReaderHelper : Object
|
||||
{
|
||||
protected:
|
||||
|
||||
enum ConfigType
|
||||
{
|
||||
DragonBone_XML,
|
||||
CocoStudio_JSON
|
||||
};
|
||||
|
||||
typedef struct _AsyncStruct
|
||||
{
|
||||
std::string filename;
|
||||
std::string fileContent;
|
||||
ConfigType configType;
|
||||
std::string baseFilePath;
|
||||
Object *target;
|
||||
SEL_SCHEDULE selector;
|
||||
bool autoLoadSpriteFile;
|
||||
} AsyncStruct;
|
||||
|
||||
typedef struct _DataInfo
|
||||
{
|
||||
AsyncStruct *asyncStruct;
|
||||
std::queue<std::string> configFileQueue;
|
||||
} DataInfo;
|
||||
|
||||
public:
|
||||
|
||||
static CCDataReaderHelper *sharedDataReaderHelper();
|
||||
|
||||
/**
|
||||
* Scale the position data, used for multiresolution adapter
|
||||
* It won't effect the data already read.
|
||||
|
@ -47,85 +82,105 @@ public:
|
|||
static void setPositionReadScale(float scale);
|
||||
static float getPositionReadScale();
|
||||
|
||||
static void addDataFromFile(const char *filePath);
|
||||
|
||||
static void purge();
|
||||
static void clear();
|
||||
public:
|
||||
CCDataReaderHelper();
|
||||
~CCDataReaderHelper();
|
||||
|
||||
/**
|
||||
* Translate XML export from Dragon Bone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param xmlPath Path of xml file
|
||||
*/
|
||||
static void addDataFromXML(const char *xmlPath);
|
||||
void addDataFromFile(const char *filePath);
|
||||
void addDataFromFileAsync(const char *filePath, Object *target, SEL_SCHEDULE selector);
|
||||
|
||||
/**
|
||||
* Translate XML export from Dragon Bone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param xmlPakPath Path of pak file
|
||||
*/
|
||||
static void addDataFromXMLPak(const char *xmlPakPath);
|
||||
|
||||
/**
|
||||
* Translate XML export from Dragon Bone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param fileContent The cache of the xml
|
||||
*/
|
||||
static void addDataFromCache(const char *fileContent);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Decode Armature Datas from xml export from Dragon Bone flash tool
|
||||
*/
|
||||
static ArmatureData *decodeArmature(tinyxml2::XMLElement *armatureXML);
|
||||
static BoneData *decodeBone(tinyxml2::XMLElement *boneXML, tinyxml2::XMLElement *parentXML);
|
||||
static DisplayData *decodeBoneDisplay(tinyxml2::XMLElement *displayXML);
|
||||
|
||||
|
||||
/**
|
||||
* Decode ArmatureAnimation Datas from xml export from Dragon Bone flash tool
|
||||
*/
|
||||
static AnimationData *decodeAnimation(tinyxml2::XMLElement *animationXML);
|
||||
static MovementData *decodeMovement(tinyxml2::XMLElement *movementXML, ArmatureData *armatureData);
|
||||
static MovementBoneData *decodeMovementBone(tinyxml2::XMLElement *movBoneXml, tinyxml2::XMLElement *parentXml, BoneData *boneData);
|
||||
static FrameData *decodeFrame(tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, BoneData *boneData);
|
||||
|
||||
|
||||
/**
|
||||
* Decode Texture Datas from xml export from Dragon Bone flash tool
|
||||
*/
|
||||
static TextureData *decodeTexture(tinyxml2::XMLElement *textureXML);
|
||||
|
||||
/**
|
||||
* Decode Contour Datas from xml export from Dragon Bone flash tool
|
||||
*/
|
||||
static ContourData *decodeContour(tinyxml2::XMLElement *contourXML);
|
||||
void addDataAsyncCallBack(float dt);
|
||||
|
||||
public:
|
||||
|
||||
static void addDataFromJson(const char *filePath);
|
||||
static void addDataFromJsonCache(const char *fileContent);
|
||||
/**
|
||||
* Translate XML export from Dragon CCBone flash tool to datas, and save them.
|
||||
* When you add a new xml, the data already saved will be keeped.
|
||||
*
|
||||
* @param xmlPath The cache of the xml
|
||||
*/
|
||||
static void addDataFromCache(const char *pFileContent, DataInfo *dataInfo = NULL);
|
||||
|
||||
static ArmatureData *decodeArmature(cs::JsonDictionary &json);
|
||||
static BoneData *decodeBone(cs::JsonDictionary &json);
|
||||
static DisplayData *decodeBoneDisplay(cs::JsonDictionary &json);
|
||||
|
||||
static AnimationData *decodeAnimation(cs::JsonDictionary &json);
|
||||
static MovementData *decodeMovement(cs::JsonDictionary &json);
|
||||
static MovementBoneData *decodeMovementBone(cs::JsonDictionary &json);
|
||||
static FrameData *decodeFrame(cs::JsonDictionary &json);
|
||||
|
||||
static TextureData *decodeTexture(cs::JsonDictionary &json);
|
||||
/**
|
||||
* Decode CCArmature Datas from xml export from Dragon CCBone flash tool
|
||||
*/
|
||||
static CCArmatureData *decodeArmature(tinyxml2::XMLElement *armatureXML);
|
||||
static CCBoneData *decodeBone(tinyxml2::XMLElement *boneXML, tinyxml2::XMLElement *parentXML);
|
||||
static CCDisplayData *decodeBoneDisplay(tinyxml2::XMLElement *displayXML);
|
||||
|
||||
static ContourData *decodeContour(cs::JsonDictionary &json);
|
||||
|
||||
static void decodeNode(BaseData *node, cs::JsonDictionary &json);
|
||||
/**
|
||||
* Decode CCArmatureAnimation Datas from xml export from Dragon CCBone flash tool
|
||||
*/
|
||||
static CCAnimationData *decodeAnimation(tinyxml2::XMLElement *animationXML);
|
||||
static CCMovementData *decodeMovement(tinyxml2::XMLElement *movementXML, CCArmatureData *armatureData);
|
||||
static CCMovementBoneData *decodeMovementBone(tinyxml2::XMLElement *movBoneXml, tinyxml2::XMLElement *parentXml, CCBoneData *boneData);
|
||||
static CCFrameData *decodeFrame(tinyxml2::XMLElement *frameXML, tinyxml2::XMLElement *parentFrameXml, CCBoneData *boneData);
|
||||
|
||||
|
||||
/**
|
||||
* Decode Texture Datas from xml export from Dragon CCBone flash tool
|
||||
*/
|
||||
static CCTextureData *decodeTexture(tinyxml2::XMLElement *textureXML);
|
||||
|
||||
/**
|
||||
* Decode Contour Datas from xml export from Dragon CCBone flash tool
|
||||
*/
|
||||
static CCContourData *decodeContour(tinyxml2::XMLElement *contourXML);
|
||||
|
||||
public:
|
||||
static void addDataFromJsonCache(const char *fileContent, DataInfo *dataInfo = NULL);
|
||||
|
||||
static CCArmatureData *decodeArmature(cs::JsonDictionary &json);
|
||||
static CCBoneData *decodeBone(cs::JsonDictionary &json);
|
||||
static CCDisplayData *decodeBoneDisplay(cs::JsonDictionary &json);
|
||||
|
||||
static CCAnimationData *decodeAnimation(cs::JsonDictionary &json);
|
||||
static CCMovementData *decodeMovement(cs::JsonDictionary &json);
|
||||
static CCMovementBoneData *decodeMovementBone(cs::JsonDictionary &json);
|
||||
static CCFrameData *decodeFrame(cs::JsonDictionary &json);
|
||||
|
||||
static CCTextureData *decodeTexture(cs::JsonDictionary &json);
|
||||
|
||||
static CCContourData *decodeContour(cs::JsonDictionary &json);
|
||||
|
||||
static void decodeNode(CCBaseData *node, cs::JsonDictionary &json);
|
||||
|
||||
protected:
|
||||
void loadData();
|
||||
|
||||
|
||||
|
||||
|
||||
std::condition_variable s_SleepCondition;
|
||||
|
||||
std::thread *s_LoadingThread;
|
||||
|
||||
std::mutex s_SleepMutex;
|
||||
|
||||
std::mutex s_AsyncStructQueueMutex;
|
||||
std::mutex s_DataInfoMutex;
|
||||
|
||||
std::mutex s_AddDataMutex;
|
||||
std::mutex s_ReadFileMutex;
|
||||
|
||||
|
||||
unsigned long s_nAsyncRefCount;
|
||||
unsigned long s_nAsyncRefTotalCount;
|
||||
|
||||
bool need_quit;
|
||||
|
||||
std::queue<AsyncStruct *> *s_pAsyncStructQueue;
|
||||
std::queue<DataInfo *> *s_pDataQueue;
|
||||
|
||||
|
||||
static CCDataReaderHelper *s_DataReaderHelper;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCDATAREADERHELPER_H__*/
|
||||
|
|
|
@ -25,160 +25,51 @@ THE SOFTWARE.
|
|||
#include "CCSpriteFrameCacheHelper.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
SpriteFrameCacheHelper *SpriteFrameCacheHelper::s_SpriteFrameCacheHelper = NULL;
|
||||
CCSpriteFrameCacheHelper *CCSpriteFrameCacheHelper::s_SpriteFrameCacheHelper = NULL;
|
||||
|
||||
SpriteFrameCacheHelper *SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()
|
||||
CCSpriteFrameCacheHelper *CCSpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()
|
||||
{
|
||||
if(!s_SpriteFrameCacheHelper)
|
||||
{
|
||||
s_SpriteFrameCacheHelper = new SpriteFrameCacheHelper();
|
||||
s_SpriteFrameCacheHelper = new CCSpriteFrameCacheHelper();
|
||||
}
|
||||
|
||||
return s_SpriteFrameCacheHelper;
|
||||
}
|
||||
|
||||
void SpriteFrameCacheHelper::purgeSpriteFrameCacheHelper()
|
||||
void CCSpriteFrameCacheHelper::purge()
|
||||
{
|
||||
delete s_SpriteFrameCacheHelper;
|
||||
s_SpriteFrameCacheHelper = NULL;
|
||||
}
|
||||
|
||||
void SpriteFrameCacheHelper::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
|
||||
void CCSpriteFrameCacheHelper::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
|
||||
{
|
||||
|
||||
std::string path = FileUtils::getInstance()->fullPathForFilename(plistPath);
|
||||
Dictionary *dict = Dictionary::createWithContentsOfFileThreadSafe(path.c_str());
|
||||
|
||||
|
||||
Texture2D *pobTexture = TextureCache::getInstance()->addImage(imagePath);
|
||||
|
||||
addSpriteFrameFromDict(dict, pobTexture, imagePath);
|
||||
|
||||
dict->release();
|
||||
|
||||
CCSpriteFrameCache::getInstance()->addSpriteFramesWithFile(plistPath, imagePath);
|
||||
}
|
||||
|
||||
void SpriteFrameCacheHelper::addSpriteFrameFromDict(Dictionary *dictionary, Texture2D *pobTexture, const char *imagePath)
|
||||
TextureAtlas *CCSpriteFrameCacheHelper::getTexureAtlasWithTexture(Texture2D *texture)
|
||||
{
|
||||
/*
|
||||
Supported Zwoptex Formats:
|
||||
|
||||
ZWTCoordinatesFormatOptionXMLLegacy = 0, // Flash Version
|
||||
ZWTCoordinatesFormatOptionXML1_0 = 1, // Desktop Version 0.0 - 0.4b
|
||||
ZWTCoordinatesFormatOptionXML1_1 = 2, // Desktop Version 1.0.0 - 1.0.1
|
||||
ZWTCoordinatesFormatOptionXML1_2 = 3, // Desktop Version 1.0.2+
|
||||
*/
|
||||
|
||||
Dictionary *metadataDict = (Dictionary *)dictionary->objectForKey("metadata");
|
||||
Dictionary *framesDict = (Dictionary *)dictionary->objectForKey("frames");
|
||||
int format = 0;
|
||||
|
||||
// get the format
|
||||
if(metadataDict != NULL)
|
||||
{
|
||||
format = metadataDict->valueForKey("format")->intValue();
|
||||
}
|
||||
|
||||
// check the format
|
||||
CCASSERT(format >= 0 && format <= 3, "format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
|
||||
|
||||
DictElement *pElement = NULL;
|
||||
CCDICT_FOREACH(framesDict, pElement)
|
||||
{
|
||||
Dictionary *frameDict = static_cast<Dictionary*>(pElement->getObject());
|
||||
std::string spriteFrameName = pElement->getStrKey();
|
||||
|
||||
_display2ImageMap[spriteFrameName] = imagePath;
|
||||
|
||||
//log("spriteFrameName : %s, imagePath : %s", spriteFrameName.c_str(), _imagePath);
|
||||
|
||||
SpriteFrame *spriteFrame = (SpriteFrame *)SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName.c_str());
|
||||
if (spriteFrame)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(format == 0)
|
||||
{
|
||||
float x = frameDict->valueForKey("x")->floatValue();
|
||||
float y = frameDict->valueForKey("y")->floatValue();
|
||||
float w = frameDict->valueForKey("width")->floatValue();
|
||||
float h = frameDict->valueForKey("height")->floatValue();
|
||||
float ox = frameDict->valueForKey("offsetX")->floatValue();
|
||||
float oy = frameDict->valueForKey("offsetY")->floatValue();
|
||||
int ow = frameDict->valueForKey("originalWidth")->intValue();
|
||||
int oh = frameDict->valueForKey("originalHeight")->intValue();
|
||||
// check ow/oh
|
||||
if(!ow || !oh)
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as expected. Regenrate the .plist");
|
||||
}
|
||||
// abs ow/oh
|
||||
ow = abs(ow);
|
||||
oh = abs(oh);
|
||||
// create frame
|
||||
spriteFrame = new SpriteFrame();
|
||||
spriteFrame->initWithTexture(pobTexture, Rect(x, y, w, h), false, Point(ox, oy), Size((float)ow, (float)oh));
|
||||
}
|
||||
else if(format == 1 || format == 2)
|
||||
{
|
||||
Rect frame = RectFromString(frameDict->valueForKey("frame")->getCString());
|
||||
bool rotated = false;
|
||||
|
||||
// rotation
|
||||
if (format == 2)
|
||||
{
|
||||
rotated = frameDict->valueForKey("rotated")->boolValue();
|
||||
}
|
||||
|
||||
Point offset = PointFromString(frameDict->valueForKey("offset")->getCString());
|
||||
Size sourceSize = SizeFromString(frameDict->valueForKey("sourceSize")->getCString());
|
||||
|
||||
// create frame
|
||||
spriteFrame = new SpriteFrame();
|
||||
spriteFrame->initWithTexture(pobTexture, frame, rotated, offset, sourceSize );
|
||||
}
|
||||
else if (format == 3)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// add sprite frame
|
||||
SpriteFrameCache::getInstance()->addSpriteFrame(spriteFrame, spriteFrameName.c_str());
|
||||
spriteFrame->release();
|
||||
}
|
||||
}
|
||||
|
||||
const char *SpriteFrameCacheHelper::getDisplayImagePath(const char *displayName)
|
||||
{
|
||||
return _display2ImageMap[displayName].c_str();
|
||||
}
|
||||
|
||||
|
||||
TextureAtlas *SpriteFrameCacheHelper::getTextureAtlas(const char *displayName)
|
||||
{
|
||||
const char *textureName = getDisplayImagePath(displayName);
|
||||
TextureAtlas *atlas = (TextureAtlas *)_display2TextureAtlas->objectForKey(textureName);
|
||||
int key = texture->getName();
|
||||
TextureAtlas *atlas = (TextureAtlas *)m_pTextureAtlasDic->objectForKey(key);
|
||||
if (atlas == NULL)
|
||||
{
|
||||
atlas = TextureAtlas::createWithTexture(TextureCache::getInstance()->addImage(textureName), 4);
|
||||
_display2TextureAtlas->setObject(atlas, textureName);
|
||||
atlas = TextureAtlas::createWithTexture(texture, 4);
|
||||
m_pTextureAtlasDic->setObject(atlas, key);
|
||||
}
|
||||
|
||||
return atlas;
|
||||
}
|
||||
|
||||
SpriteFrameCacheHelper::SpriteFrameCacheHelper()
|
||||
CCSpriteFrameCacheHelper::CCSpriteFrameCacheHelper()
|
||||
{
|
||||
_display2TextureAtlas = new Dictionary();
|
||||
_display2TextureAtlas->init();
|
||||
m_pTextureAtlasDic = new Dictionary();
|
||||
}
|
||||
|
||||
SpriteFrameCacheHelper::~SpriteFrameCacheHelper()
|
||||
CCSpriteFrameCacheHelper::~CCSpriteFrameCacheHelper()
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(_display2TextureAtlas);
|
||||
CC_SAFE_RELEASE_NULL(m_pTextureAtlasDic);
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,47 +29,32 @@ THE SOFTWARE.
|
|||
|
||||
using namespace std;
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
class SpriteFrameCacheHelper
|
||||
class CCSpriteFrameCacheHelper
|
||||
{
|
||||
public:
|
||||
static SpriteFrameCacheHelper *sharedSpriteFrameCacheHelper();
|
||||
static CCSpriteFrameCacheHelper *sharedSpriteFrameCacheHelper();
|
||||
|
||||
static void purgeSpriteFrameCacheHelper();
|
||||
static void purge();
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Add sprite frame to SpriteFrameCache, it will save display name and it's relative image name
|
||||
*
|
||||
* @brief Add sprite frame to CCSpriteFrameCache, it will save display name and it's relative image name
|
||||
*/
|
||||
void addSpriteFrameFromFile(const char *plistPath, const char *imagePath);
|
||||
|
||||
void addSpriteFrameFromDict(Dictionary *dictionary, Texture2D *pobTexture, const char *imagePath);
|
||||
|
||||
/**
|
||||
* Get this display in which image
|
||||
*/
|
||||
const char *getDisplayImagePath(const char *displayName);
|
||||
TextureAtlas *getTextureAtlas(const char *displayName);
|
||||
TextureAtlas *getTexureAtlasWithTexture(Texture2D *texture);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
SpriteFrameCacheHelper();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~SpriteFrameCacheHelper();
|
||||
CCSpriteFrameCacheHelper();
|
||||
~CCSpriteFrameCacheHelper();
|
||||
|
||||
std::map<std::string, std::string> _display2ImageMap;
|
||||
Dictionary *_display2TextureAtlas;
|
||||
Dictionary *m_pTextureAtlasDic;
|
||||
|
||||
static SpriteFrameCacheHelper *s_SpriteFrameCacheHelper;
|
||||
static CCSpriteFrameCacheHelper *s_SpriteFrameCacheHelper;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCSPRITEFRAMECACHEHELPER_H__*/
|
||||
|
|
|
@ -25,21 +25,21 @@ THE SOFTWARE.
|
|||
#include "CCTransformHelp.h"
|
||||
#include "CCUtilMath.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
AffineTransform TransformHelp::helpMatrix1;
|
||||
AffineTransform TransformHelp::helpMatrix2;
|
||||
AffineTransform CCTransformHelp::helpMatrix1;
|
||||
AffineTransform CCTransformHelp::helpMatrix2;
|
||||
|
||||
Point TransformHelp::helpPoint1;
|
||||
Point TransformHelp::helpPoint2;
|
||||
Point CCTransformHelp::helpPoint1;
|
||||
Point CCTransformHelp::helpPoint2;
|
||||
|
||||
BaseData helpParentNode;
|
||||
CCBaseData helpParentNode;
|
||||
|
||||
TransformHelp::TransformHelp()
|
||||
CCTransformHelp::CCTransformHelp()
|
||||
{
|
||||
}
|
||||
|
||||
void TransformHelp::transformFromParent(BaseData &node, const BaseData &parentNode)
|
||||
void CCTransformHelp::transformFromParent(CCBaseData &node, const CCBaseData &parentNode)
|
||||
{
|
||||
nodeToMatrix(node, helpMatrix1);
|
||||
nodeToMatrix(parentNode, helpMatrix2);
|
||||
|
@ -50,7 +50,7 @@ void TransformHelp::transformFromParent(BaseData &node, const BaseData &parentNo
|
|||
matrixToNode(helpMatrix1, node);
|
||||
}
|
||||
|
||||
void TransformHelp::transformToParent(BaseData &node, const BaseData &parentNode)
|
||||
void CCTransformHelp::transformToParent(CCBaseData &node, const CCBaseData &parentNode)
|
||||
{
|
||||
|
||||
nodeToMatrix(node, helpMatrix1);
|
||||
|
@ -61,7 +61,7 @@ void TransformHelp::transformToParent(BaseData &node, const BaseData &parentNode
|
|||
matrixToNode(helpMatrix1, node);
|
||||
}
|
||||
|
||||
void TransformHelp::transformFromParentWithoutScale(BaseData &node, const BaseData &parentNode)
|
||||
void CCTransformHelp::transformFromParentWithoutScale(CCBaseData &node, const CCBaseData &parentNode)
|
||||
{
|
||||
|
||||
helpParentNode.copy(&parentNode);
|
||||
|
@ -77,7 +77,7 @@ void TransformHelp::transformFromParentWithoutScale(BaseData &node, const BaseDa
|
|||
matrixToNode(helpMatrix1, node);
|
||||
}
|
||||
|
||||
void TransformHelp::transformToParentWithoutScale(BaseData &node, const BaseData &parentNode)
|
||||
void CCTransformHelp::transformToParentWithoutScale(CCBaseData &node, const CCBaseData &parentNode)
|
||||
{
|
||||
|
||||
helpParentNode.copy(&parentNode);
|
||||
|
@ -92,7 +92,7 @@ void TransformHelp::transformToParentWithoutScale(BaseData &node, const BaseData
|
|||
matrixToNode(helpMatrix1, node);
|
||||
}
|
||||
|
||||
void TransformHelp::nodeToMatrix(const BaseData &node, AffineTransform &matrix)
|
||||
void CCTransformHelp::nodeToMatrix(const CCBaseData &node, AffineTransform &matrix)
|
||||
{
|
||||
matrix.a = node.scaleX * cos(node.skewY);
|
||||
matrix.b = node.scaleX * sin(node.skewY);
|
||||
|
@ -103,7 +103,7 @@ void TransformHelp::nodeToMatrix(const BaseData &node, AffineTransform &matrix)
|
|||
matrix.ty = node.y;
|
||||
}
|
||||
|
||||
void TransformHelp::matrixToNode(const AffineTransform &matrix, BaseData &node)
|
||||
void CCTransformHelp::matrixToNode(const AffineTransform &matrix, CCBaseData &node)
|
||||
{
|
||||
/*
|
||||
* In as3 language, there is a function called "deltaTransformPoint", it calculate a point used give Transform
|
||||
|
@ -129,7 +129,7 @@ void TransformHelp::matrixToNode(const AffineTransform &matrix, BaseData &node)
|
|||
node.y = matrix.ty;
|
||||
}
|
||||
|
||||
void TransformHelp::nodeConcat(BaseData &target, BaseData &source)
|
||||
void CCTransformHelp::nodeConcat(CCBaseData &target, CCBaseData &source)
|
||||
{
|
||||
target.x += source.x;
|
||||
target.y += source.y;
|
||||
|
@ -139,4 +139,14 @@ void TransformHelp::nodeConcat(BaseData &target, BaseData &source)
|
|||
target.scaleY += source.scaleY;
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
void CCTransformHelp::nodeSub(CCBaseData &target, CCBaseData &source)
|
||||
{
|
||||
target.x -= source.x;
|
||||
target.y -= source.y;
|
||||
target.skewX -= source.skewX;
|
||||
target.skewY -= source.skewY;
|
||||
target.scaleX -= source.scaleX;
|
||||
target.scaleY -= source.scaleY;
|
||||
}
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,26 +28,27 @@ THE SOFTWARE.
|
|||
#include "CCArmatureDefine.h"
|
||||
#include "../datas/CCDatas.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
/*
|
||||
* use to calculate the matrix of node from parent node
|
||||
*/
|
||||
class TransformHelp
|
||||
class CCTransformHelp
|
||||
{
|
||||
public:
|
||||
TransformHelp();
|
||||
CCTransformHelp();
|
||||
|
||||
static void transformFromParent(BaseData &node, const BaseData &parentNode);
|
||||
static void transformToParent(BaseData &node, const BaseData &parentNode);
|
||||
static void transformFromParent(CCBaseData &node, const CCBaseData &parentNode);
|
||||
static void transformToParent(CCBaseData &node, const CCBaseData &parentNode);
|
||||
|
||||
static void transformFromParentWithoutScale(BaseData &node, const BaseData &parentNode);
|
||||
static void transformToParentWithoutScale(BaseData &node, const BaseData &parentNode);
|
||||
static void transformFromParentWithoutScale(CCBaseData &node, const CCBaseData &parentNode);
|
||||
static void transformToParentWithoutScale(CCBaseData &node, const CCBaseData &parentNode);
|
||||
|
||||
static void nodeToMatrix(const BaseData &_node, AffineTransform &_matrix);
|
||||
static void matrixToNode(const AffineTransform &_matrix, BaseData &_node);
|
||||
static void nodeToMatrix(const CCBaseData &_node, AffineTransform &_matrix);
|
||||
static void matrixToNode(const AffineTransform &_matrix, CCBaseData &_node);
|
||||
|
||||
static void nodeConcat(BaseData &target, BaseData &source);
|
||||
static void nodeConcat(CCBaseData &target, CCBaseData &source);
|
||||
static void nodeSub(CCBaseData &target, CCBaseData &source);
|
||||
public:
|
||||
static AffineTransform helpMatrix1;
|
||||
static AffineTransform helpMatrix2;
|
||||
|
@ -56,6 +57,6 @@ public:
|
|||
static Point helpPoint2;
|
||||
};
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCTRANSFORMHELP_H__*/
|
||||
|
|
|
@ -25,9 +25,9 @@ THE SOFTWARE.
|
|||
#include "CCTweenFunction.h"
|
||||
#include "CCUtilMath.h"
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
float TweenFunction::tweenTo(float from, float change, float time, float duration, TweenType tweenType)
|
||||
float CCTweenFunction::tweenTo(float from, float change, float time, float duration, CCTweenType tweenType)
|
||||
{
|
||||
float delta = 0;
|
||||
|
||||
|
@ -146,109 +146,109 @@ float TweenFunction::tweenTo(float from, float change, float time, float duratio
|
|||
return delta;
|
||||
}
|
||||
|
||||
float TweenFunction::linear(float t, float b, float c, float d)
|
||||
float CCTweenFunction::linear(float t, float b, float c, float d)
|
||||
{
|
||||
return c * t / d + b;
|
||||
}
|
||||
|
||||
float TweenFunction::quadEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quadEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return c * t * t + b;
|
||||
}
|
||||
float TweenFunction::quadEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quadEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return -c * t * (t - 2) + b;
|
||||
}
|
||||
float TweenFunction::quadEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quadEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if ((t / 2) < 1)
|
||||
return c / 2 * t * t + b;
|
||||
--t;
|
||||
--t;
|
||||
return -c / 2 * (t * (t - 2) - 1) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::cubicEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::cubicEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return c * t * t * t + b;
|
||||
}
|
||||
float TweenFunction::cubicEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::cubicEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t = t / d - 1;
|
||||
t = t / d - 1;
|
||||
return c * (t * t * t + 1) + b;
|
||||
}
|
||||
float TweenFunction::cubicEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::cubicEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if ((t / 2) < 1)
|
||||
return c / 2 * t * t * t + b;
|
||||
t -= 2;
|
||||
return c / 2 * (t * t * t + 2) + b;
|
||||
return c / 2 * (t * t * t + 2) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::quartEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quartEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return c * t * t * t * t + b;
|
||||
}
|
||||
float TweenFunction::quartEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quartEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t = t / d - 1;
|
||||
t = t / d - 1;
|
||||
return -c * (t * t * t * t - 1) + b;
|
||||
}
|
||||
float TweenFunction::quartEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quartEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if ((t / 2) < 1)
|
||||
return c / 2 * t * t * t * t + b;
|
||||
t -= 2;
|
||||
return -c / 2 * (t * t * t * t - 2) + b;
|
||||
return -c / 2 * (t * t * t * t - 2) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::quintEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quintEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return c * t * t * t * t * t + b;
|
||||
}
|
||||
float TweenFunction::quintEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quintEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t = t / d - 1;
|
||||
t = t / d - 1;
|
||||
return c * (t * t * t * t * t + 1) + b;
|
||||
}
|
||||
float TweenFunction::quintEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::quintEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if ((t / 2) < 1)
|
||||
return c / 2 * t * t * t * t * t + b;
|
||||
t -= 2;
|
||||
t -= 2;
|
||||
return c / 2 * (t * t * t * t * t + 2) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::sineEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::sineEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
return -c * cos(t / d * (M_PI / 2)) + c + b;
|
||||
}
|
||||
float TweenFunction::sineEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::sineEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
return c * sin(t / d * (M_PI / 2)) + b;
|
||||
}
|
||||
float TweenFunction::sineEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::sineEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
return -c / 2 * (cos(M_PI * t / d) - 1) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::expoEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::expoEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
return (t == 0) ? b : c * pow(2, 10 * (t / d - 1)) + b;
|
||||
}
|
||||
float TweenFunction::expoEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::expoEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
return (t == d) ? b + c : c * (-pow(2, -10 * t / d) + 1) + b;
|
||||
}
|
||||
float TweenFunction::expoEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::expoEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
if (t == 0)
|
||||
return b;
|
||||
|
@ -256,36 +256,36 @@ float TweenFunction::expoEaseInOut(float t, float b, float c, float d)
|
|||
return b + c;
|
||||
if ((t /= d / 2) < 1)
|
||||
return c / 2 * pow(2, 10 * (t - 1)) + b;
|
||||
--t;
|
||||
--t;
|
||||
return c / 2 * (-pow(2, -10 * t) + 2) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::circEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::circEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
return -c * (sqrt(1 - t * t) - 1) + b;
|
||||
}
|
||||
float TweenFunction::circEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::circEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t = t / d - 1;
|
||||
t = t / d - 1;
|
||||
return c * sqrt(1 - t * t) + b;
|
||||
}
|
||||
float TweenFunction::circEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::circEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if ((t / 2) < 1)
|
||||
return -c / 2 * (sqrt(1 - t * t) - 1) + b;
|
||||
t -= 2;
|
||||
t -= 2;
|
||||
return c / 2 * (sqrt(1 - t * t) + 1) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::elasticEaseIn(float t, float b, float c, float d, float a, float p)
|
||||
float CCTweenFunction::elasticEaseIn(float t, float b, float c, float d, float a, float p)
|
||||
{
|
||||
float s = 0;
|
||||
if (t == 0)
|
||||
return b;
|
||||
t /= d;
|
||||
if (t == 1)
|
||||
if (t == 1)
|
||||
return b + c;
|
||||
if (!p)
|
||||
p = d * .3;
|
||||
|
@ -296,15 +296,15 @@ float TweenFunction::elasticEaseIn(float t, float b, float c, float d, float a,
|
|||
}
|
||||
else
|
||||
s = p / (2 * M_PI) * asin(c / a);
|
||||
t -= 1;
|
||||
t -= 1;
|
||||
return -(a * pow(2, 10 * t) * sin((t * d - s) * (2 * M_PI) / p)) + b;
|
||||
}
|
||||
float TweenFunction::elasticEaseOut(float t, float b, float c, float d, float a, float p)
|
||||
float CCTweenFunction::elasticEaseOut(float t, float b, float c, float d, float a, float p)
|
||||
{
|
||||
float s = 0;
|
||||
if (t == 0)
|
||||
return b;
|
||||
t /= d;
|
||||
t /= d;
|
||||
if (t == 1)
|
||||
return b + c;
|
||||
if (!p)
|
||||
|
@ -318,13 +318,13 @@ float TweenFunction::elasticEaseOut(float t, float b, float c, float d, float a,
|
|||
s = p / (2 * M_PI) * asin(c / a);
|
||||
return (a * pow(2, -10 * t) * sin((t * d - s) * (2 * M_PI) / p) + c + b);
|
||||
}
|
||||
float TweenFunction::elasticEaseInOut(float t, float b, float c, float d, float a, float p)
|
||||
float CCTweenFunction::elasticEaseInOut(float t, float b, float c, float d, float a, float p)
|
||||
{
|
||||
float s = 0;
|
||||
if (t == 0)
|
||||
return b;
|
||||
t /= d;
|
||||
if ((t / 2) == 2)
|
||||
if ((t / 2) == 2)
|
||||
return b + c;
|
||||
if (!p)
|
||||
p = d * (.3 * 1.5);
|
||||
|
@ -336,73 +336,73 @@ float TweenFunction::elasticEaseInOut(float t, float b, float c, float d, float
|
|||
else
|
||||
s = p / (2 * M_PI) * asin(c / a);
|
||||
if (t < 1)
|
||||
{
|
||||
t -= 1;
|
||||
return -.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * M_PI) / p)) + b;
|
||||
}
|
||||
t -= 1;
|
||||
{
|
||||
t -= 1;
|
||||
return -.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * M_PI) / p)) + b;
|
||||
}
|
||||
t -= 1;
|
||||
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * M_PI) / p) * .5 + c + b;
|
||||
}
|
||||
|
||||
float TweenFunction::backEaseIn(float t, float b, float c, float d, float s)
|
||||
float CCTweenFunction::backEaseIn(float t, float b, float c, float d, float s)
|
||||
{
|
||||
if (s == 0)
|
||||
s = 1.70158f;
|
||||
t /= d;
|
||||
return c * t * t * ((s + 1) * t - s) + b;
|
||||
return c * t * t * ((s + 1) * t - s) + b;
|
||||
}
|
||||
float TweenFunction::backEaseOut(float t, float b, float c, float d, float s)
|
||||
float CCTweenFunction::backEaseOut(float t, float b, float c, float d, float s)
|
||||
{
|
||||
if (s == 0)
|
||||
s = 1.70158f;
|
||||
t = t / d - 1;
|
||||
t = t / d - 1;
|
||||
return c * (t * t * ((s + 1) * t + s) + 1) + b;
|
||||
}
|
||||
float TweenFunction::backEaseInOut(float t, float b, float c, float d, float s)
|
||||
float CCTweenFunction::backEaseInOut(float t, float b, float c, float d, float s)
|
||||
{
|
||||
if (s == 0)
|
||||
s = 1.70158f;
|
||||
if ((t /= d / 2) < 1)
|
||||
{
|
||||
s *= (1.525f);
|
||||
return c / 2 * (t * t * ((s + 1) * t - s)) + b;
|
||||
}
|
||||
|
||||
t -= 2;
|
||||
s *= (1.525f);
|
||||
{
|
||||
s *= (1.525f);
|
||||
return c / 2 * (t * t * ((s + 1) * t - s)) + b;
|
||||
}
|
||||
|
||||
t -= 2;
|
||||
s *= (1.525f);
|
||||
return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::bounceEaseIn(float t, float b, float c, float d)
|
||||
float CCTweenFunction::bounceEaseIn(float t, float b, float c, float d)
|
||||
{
|
||||
return c - bounceEaseOut(d - t, 0, c, d) + b;
|
||||
}
|
||||
|
||||
float TweenFunction::bounceEaseOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::bounceEaseOut(float t, float b, float c, float d)
|
||||
{
|
||||
t /= d;
|
||||
t /= d;
|
||||
if (t < (1 / 2.75f))
|
||||
{
|
||||
return c * (7.5625f * t * t) + b;
|
||||
}
|
||||
else if (t < (2 / 2.75f))
|
||||
{
|
||||
t -= (1.5f / 2.75f);
|
||||
t -= (1.5f / 2.75f);
|
||||
return c * (7.5625f * t * t + .75f) + b;
|
||||
}
|
||||
else if (t < (2.5f / 2.75f))
|
||||
{
|
||||
t -= (2.25f / 2.75f);
|
||||
t -= (2.25f / 2.75f);
|
||||
return c * (7.5625f * t * t + .9375f) + b;
|
||||
}
|
||||
else
|
||||
{
|
||||
t -= (2.625f / 2.75f);
|
||||
t -= (2.625f / 2.75f);
|
||||
return c * (7.5625f * t * t + .984375f) + b;
|
||||
}
|
||||
}
|
||||
|
||||
float TweenFunction::bounceEaseInOut(float t, float b, float c, float d)
|
||||
float CCTweenFunction::bounceEaseInOut(float t, float b, float c, float d)
|
||||
{
|
||||
if (t < d / 2)
|
||||
return bounceEaseIn(t * 2, 0, c, d) * .5 + b;
|
||||
|
@ -411,4 +411,4 @@ float TweenFunction::bounceEaseInOut(float t, float b, float c, float d)
|
|||
}
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -29,22 +29,23 @@ THE SOFTWARE.
|
|||
#include "CCArmatureDefine.h"
|
||||
#include <math.h>
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
enum TweenType{
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
enum CCTweenType
|
||||
{
|
||||
TWEEN_EASING_MIN = -1,
|
||||
|
||||
|
||||
Linear,
|
||||
|
||||
|
||||
Sine_EaseIn,
|
||||
Sine_EaseInOut,
|
||||
Sine_EaseOut,
|
||||
|
||||
|
||||
|
||||
|
||||
Quad_EaseIn,
|
||||
Quad_EaseOut,
|
||||
Quad_EaseInOut,
|
||||
|
||||
|
||||
Cubic_EaseIn,
|
||||
Cubic_EaseOut,
|
||||
Cubic_EaseInOut,
|
||||
|
@ -52,83 +53,84 @@ enum TweenType{
|
|||
Quart_EaseIn,
|
||||
Quart_EaseOut,
|
||||
Quart_EaseInOut,
|
||||
|
||||
|
||||
Quint_EaseIn,
|
||||
Quint_EaseOut,
|
||||
Quint_EaseInOut,
|
||||
|
||||
|
||||
Expo_EaseIn,
|
||||
Expo_EaseOut,
|
||||
Expo_EaseInOut,
|
||||
|
||||
|
||||
Circ_EaseIn,
|
||||
Circ_EaseOut,
|
||||
Circ_EaseInOut,
|
||||
|
||||
|
||||
Elastic_EaseIn,
|
||||
Elastic_EaseOut,
|
||||
Elastic_EaseInOut,
|
||||
|
||||
|
||||
Back_EaseIn,
|
||||
Back_EaseOut,
|
||||
Back_EaseInOut,
|
||||
|
||||
|
||||
Bounce_EaseIn,
|
||||
Bounce_EaseOut,
|
||||
Bounce_EaseInOut,
|
||||
|
||||
|
||||
TWEEN_EASING_MAX = 10000
|
||||
};
|
||||
|
||||
class TweenFunction{
|
||||
|
||||
class CCTweenFunction
|
||||
{
|
||||
public:
|
||||
|
||||
static float tweenTo(float from, float change, float time, float duration, TweenType tweenType);
|
||||
|
||||
|
||||
static float tweenTo(float from, float change, float time, float duration, CCTweenType tweenType);
|
||||
|
||||
static float linear(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float sineEaseIn(float t, float b, float c, float d);
|
||||
static float sineEaseOut(float t, float b, float c, float d);
|
||||
static float sineEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float quadEaseIn(float t, float b, float c, float d);
|
||||
static float quadEaseOut(float t, float b, float c, float d);
|
||||
static float quadEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float cubicEaseIn(float t, float b, float c, float d);
|
||||
static float cubicEaseOut(float t, float b, float c, float d);
|
||||
static float cubicEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float quartEaseIn(float t, float b, float c, float d);
|
||||
static float quartEaseOut(float t, float b, float c, float d);
|
||||
static float quartEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float quintEaseIn(float t, float b, float c, float d);
|
||||
static float quintEaseOut(float t, float b, float c, float d);
|
||||
static float quintEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float expoEaseIn(float t, float b, float c, float d);
|
||||
static float expoEaseOut(float t, float b, float c, float d);
|
||||
static float expoEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float circEaseIn(float t, float b, float c, float d);
|
||||
static float circEaseOut(float t, float b, float c, float d);
|
||||
static float circEaseInOut(float t, float b, float c, float d);
|
||||
|
||||
|
||||
static float elasticEaseIn(float t, float b, float c, float d, float a = 0, float p = 0);
|
||||
static float elasticEaseOut(float t, float b, float c, float d, float a = 0, float p = 0);
|
||||
static float elasticEaseInOut(float t, float b, float c, float d, float a = 0, float p = 0);
|
||||
|
||||
|
||||
static float backEaseIn(float t, float b, float c, float d, float s = 0);
|
||||
static float backEaseOut(float t, float b, float c, float d, float s = 0);
|
||||
static float backEaseInOut(float t, float b, float c, float d, float s = 0);
|
||||
|
||||
|
||||
static float bounceEaseIn(float t, float b, float c, float d);
|
||||
static float bounceEaseOut(float t, float b, float c, float d);
|
||||
static float bounceEaseInOut(float t, float b, float c, float d);
|
||||
};
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCTWEENFUNCTION_H__*/
|
||||
|
|
|
@ -25,22 +25,22 @@ THE SOFTWARE.
|
|||
#include "CCUtilMath.h"
|
||||
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
bool isSpriteContainPoint(Sprite *_sprite, Point _point, Point &_outPoint)
|
||||
bool isSpriteContainPoint(Sprite *sprite, Point point, Point &outPoint)
|
||||
{
|
||||
_outPoint = _sprite->convertToNodeSpace(_point);
|
||||
outPoint = sprite->convertToNodeSpace(point);
|
||||
|
||||
Size _s = _sprite->getContentSize();
|
||||
Rect _r(0, 0, _s.width, _s.height);
|
||||
Size s = sprite->getContentSize();
|
||||
Rect r(0, 0, s.width, s.height);
|
||||
|
||||
return _r.containsPoint(_outPoint);
|
||||
return r.containsPoint(outPoint);
|
||||
}
|
||||
|
||||
bool isSpriteContainPoint(Sprite *_sprite, Point _point)
|
||||
bool isSpriteContainPoint(Sprite *sprite, Point point)
|
||||
{
|
||||
Point _p = Point(0, 0);
|
||||
return isSpriteContainPoint(_sprite, _point, _p);
|
||||
Point p = Point(0, 0);
|
||||
return isSpriteContainPoint(sprite, point, p);
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,4 +75,4 @@ Point circleTo(float t, Point ¢er, float radius, float fromRadian, float rad
|
|||
return p;
|
||||
}
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
|
|
@ -28,7 +28,7 @@ THE SOFTWARE.
|
|||
#include "CCArmatureDefine.h"
|
||||
#include <math.h>
|
||||
|
||||
namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_BEGIN
|
||||
|
||||
#define CC_DOUBLE_PI (M_PI*2)
|
||||
|
||||
|
@ -50,6 +50,6 @@ Point bezierTo(float t, Point &point1, Point &point2, Point &point3, Point &poin
|
|||
Point circleTo(float t, Point ¢er, float radius, float fromRadian, float radianDif);
|
||||
|
||||
|
||||
}}} // namespace cocos2d { namespace extension { namespace armature {
|
||||
NS_CC_EXT_ARMATURE_END
|
||||
|
||||
#endif /*__CCUTILMATH_H__*/
|
||||
|
|
|
@ -249,7 +249,7 @@ NS_CC_EXT_BEGIN
|
|||
|
||||
}
|
||||
|
||||
cocos2d::extension::armature::Armature *pAr = cocos2d::extension::armature::Armature::create(name);
|
||||
cocos2d::extension::armature::CCArmature *pAr = cocos2d::extension::armature::CCArmature::create(name);
|
||||
ComRender *pRender = ComRender::create(pAr, "CCArmature");
|
||||
if (pComName != NULL)
|
||||
{
|
||||
|
|
|
@ -59,9 +59,7 @@
|
|||
#include "CocoStudio/Armature/display/CCDisplayManager.h"
|
||||
#include "CocoStudio/Armature/display/CCSkin.h"
|
||||
#include "CocoStudio/Armature/physics/CCColliderDetector.h"
|
||||
#include "CocoStudio/Armature/physics/CCPhysicsWorld.h"
|
||||
#include "CocoStudio/Armature/utils/CCArmatureDataManager.h"
|
||||
#include "CocoStudio/Armature/utils/CCConstValue.h"
|
||||
#include "CocoStudio/Armature/utils/CCDataReaderHelper.h"
|
||||
#include "CocoStudio/Armature/utils/CCTweenFunction.h"
|
||||
#include "CocoStudio/Armature/utils/CCArmatureDataManager.h"
|
||||
|
|
|
@ -127,12 +127,10 @@
|
|||
<ClCompile Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayFactory.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayManager.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCShaderNode.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCSkin.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\external_tool\GLES-Render.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\physics\CCColliderDetector.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDefine.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCSpriteFrameCacheHelper.cpp" />
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCTransformHelp.cpp" />
|
||||
|
@ -235,12 +233,9 @@
|
|||
<ClInclude Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayFactory.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayManager.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCShaderNode.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCSkin.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\external_tool\GLES-Render.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\external_tool\sigslot.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\physics\CCColliderDetector.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDefine.h" />
|
||||
<ClInclude Include="..\CocoStudio\Armature\utils\CCConstValue.h" />
|
||||
|
|
|
@ -316,18 +316,12 @@
|
|||
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayManager.cpp">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCShaderNode.cpp">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\display\CCSkin.cpp">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\physics\CCColliderDetector.cpp">
|
||||
<Filter>CocoStudio\Armature\physics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.cpp">
|
||||
<Filter>CocoStudio\Armature\physics</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.cpp">
|
||||
<Filter>CocoStudio\Armature\utils</Filter>
|
||||
</ClCompile>
|
||||
|
@ -373,8 +367,8 @@
|
|||
<ClCompile Include="..\CocoStudio\Components\CCComRender.cpp">
|
||||
<Filter>CocoStudio\Components</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\CocoStudio\Armature\external_tool\GLES-Render.cpp">
|
||||
<Filter>CocoStudio\Armature\external_tool</Filter>
|
||||
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDefine.cpp">
|
||||
<Filter>CocoStudio\Armature\utils</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -653,9 +647,6 @@
|
|||
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayManager.h">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCShaderNode.h">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocoStudio\Armature\display\CCSkin.h">
|
||||
<Filter>CocoStudio\Armature\display</Filter>
|
||||
</ClInclude>
|
||||
|
@ -665,9 +656,6 @@
|
|||
<ClInclude Include="..\CocoStudio\Armature\physics\CCColliderDetector.h">
|
||||
<Filter>CocoStudio\Armature\physics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.h">
|
||||
<Filter>CocoStudio\Armature\physics</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h">
|
||||
<Filter>CocoStudio\Armature\utils</Filter>
|
||||
</ClInclude>
|
||||
|
@ -740,9 +728,6 @@
|
|||
<ClInclude Include="..\CocoStudio\Components\CCComRender.h">
|
||||
<Filter>CocoStudio\Components</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\CocoStudio\Armature\external_tool\GLES-Render.h">
|
||||
<Filter>CocoStudio\Armature\external_tool</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\CocoStudio\Json\lib_json\json_internalarray.inl">
|
||||
|
|
|
@ -59,7 +59,7 @@ void CCSkeleton::initialize () {
|
|||
blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
setOpacityModifyRGB(true);
|
||||
|
||||
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ AppDelegate::AppDelegate()
|
|||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
// SimpleAudioEngine::end();
|
||||
cocos2d::extension::armature::ArmatureDataManager::purgeArmatureSystem();
|
||||
cocos2d::extension::armature::CCArmatureDataManager::purge();
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,6 +6,13 @@
|
|||
#include "../../VisibleRect.h"
|
||||
#include "../../testBasic.h"
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
#include "../../Box2DTestBed/GLES-Render.h"
|
||||
#include "Box2D/Box2D.h"
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
#include "chipmunk.h"
|
||||
#endif
|
||||
|
||||
class ArmatureTestScene : public TestScene
|
||||
{
|
||||
public:
|
||||
|
@ -14,19 +21,19 @@ public:
|
|||
virtual void runThisTest();
|
||||
|
||||
// The CallBack for back to the main menu scene
|
||||
virtual void MainMenuCallback(Object* sender);
|
||||
virtual void MainMenuCallback(Object* pSender);
|
||||
};
|
||||
|
||||
enum {
|
||||
TEST_COCOSTUDIO_WITH_SKELETON = 0,
|
||||
TEST_COCOSTUDIO_WITHOUT_SKELETON,
|
||||
TEST_ASYNCHRONOUS_LOADING = 0,
|
||||
TEST_COCOSTUDIO_WITH_SKELETON,
|
||||
TEST_DRAGON_BONES_2_0,
|
||||
TEST_PERFORMANCE,
|
||||
TEST_CHANGE_ZORDER,
|
||||
TEST_ANIMATION_EVENT,
|
||||
TEST_PARTICLE_DISPLAY,
|
||||
TEST_USE_DIFFERENT_PICTURE,
|
||||
TEST_BOX2D_DETECTOR,
|
||||
TEST_BCOLLIDER_DETECTOR,
|
||||
TEST_BOUDINGBOX,
|
||||
TEST_ANCHORPOINT,
|
||||
TEST_ARMATURE_NESTING,
|
||||
|
@ -43,32 +50,39 @@ public:
|
|||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
||||
void restartCallback(Object* sender);
|
||||
void nextCallback(Object* sender);
|
||||
void backCallback(Object* sender);
|
||||
virtual void restartCallback(Object* pSender);
|
||||
virtual void nextCallback(Object* pSender);
|
||||
virtual void backCallback(Object* pSender);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
protected:
|
||||
MenuItemImage *restartItem;
|
||||
MenuItemImage *nextItem;
|
||||
MenuItemImage *backItem;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TestDragonBones20 : public ArmatureTestLayer
|
||||
class TestAsynchronousLoading : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
|
||||
void dataLoaded(float percent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class TestCSWithSkeleton : public ArmatureTestLayer
|
||||
{
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
||||
class TestCSWithoutSkeleton : public ArmatureTestLayer
|
||||
|
||||
class TestDragonBones20 : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
};
|
||||
|
@ -82,7 +96,7 @@ public:
|
|||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual void addArmature(cocos2d::extension::armature::Armature *armature);
|
||||
virtual void addArmature(cocos2d::extension::armature::CCArmature *armature);
|
||||
void update(float delta);
|
||||
|
||||
int armatureCount;
|
||||
|
@ -104,57 +118,116 @@ class TestChangeZorder : public ArmatureTestLayer
|
|||
};
|
||||
|
||||
|
||||
class TestAnimationEvent : public ArmatureTestLayer, public sigslot::has_slots<>
|
||||
class TestAnimationEvent : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void onEnter();
|
||||
virtual std::string title();
|
||||
void animationEvent(cocos2d::extension::armature::Armature *armature, cocos2d::extension::armature::MovementEventType movementType, const char *movementID);
|
||||
void animationEvent(cocos2d::extension::armature::CCArmature *armature, cocos2d::extension::armature::MovementEventType movementType, const char *movementID);
|
||||
void callback1();
|
||||
void callback2();
|
||||
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
};
|
||||
|
||||
class TestUseMutiplePicture : public ArmatureTestLayer
|
||||
{
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual bool ccTouchBegan(Touch *touch, Event *event);
|
||||
virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent);
|
||||
virtual void registerWithTouchDispatcher();
|
||||
|
||||
int displayIndex;
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
};
|
||||
|
||||
class TestParticleDisplay : public ArmatureTestLayer
|
||||
{
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual std::string subtitle();
|
||||
virtual bool ccTouchBegan(Touch *touch, Event *event);
|
||||
virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent);
|
||||
virtual void registerWithTouchDispatcher();
|
||||
|
||||
int animationID;
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
};
|
||||
|
||||
class TestBox2DDetector : public ArmatureTestLayer, public sigslot::has_slots<>
|
||||
|
||||
|
||||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
|
||||
class ContactListener;
|
||||
|
||||
class TestColliderDetector : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
~TestColliderDetector();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual void draw();
|
||||
virtual void update(float delta);
|
||||
|
||||
void onHit(cocos2d::extension::armature::Bone *bone, cocos2d::extension::armature::Bone *bone2);
|
||||
void onFrameEvent(cocos2d::extension::armature::CCBone *bone, const char *evt, int originFrameIndex, int currentFrameIndex);
|
||||
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::Armature *armature2;
|
||||
void initWorld();
|
||||
|
||||
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature2;
|
||||
|
||||
cocos2d::extension::PhysicsSprite *bullet;
|
||||
|
||||
b2World *world;
|
||||
ContactListener *listener;
|
||||
GLESDebugDraw *debugDraw;
|
||||
};
|
||||
|
||||
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
|
||||
|
||||
class TestColliderDetector : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
~TestColliderDetector();
|
||||
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual void update(float delta);
|
||||
|
||||
void onFrameEvent(cocos2d::extension::armature::CCBone *bone, const char *evt, int originFrameIndex, int currentFrameIndex);
|
||||
|
||||
void initWorld();
|
||||
|
||||
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature2;
|
||||
|
||||
cocos2d::extension::PhysicsSprite *bullet;
|
||||
|
||||
|
||||
cpSpace *space;
|
||||
|
||||
static int beginHit(cpArbiter *arb, cpSpace *space, void *unused);
|
||||
static void endHit(cpArbiter *arb, cpSpace *space, void *unused);
|
||||
|
||||
void destroyCPBody(cpBody *body);
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class TestBoundingBox : public ArmatureTestLayer
|
||||
{
|
||||
public:
|
||||
|
@ -162,7 +235,7 @@ public:
|
|||
virtual std::string title();
|
||||
virtual void draw();
|
||||
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
Rect rect;
|
||||
};
|
||||
|
||||
|
@ -177,11 +250,12 @@ class TestArmatureNesting : public ArmatureTestLayer
|
|||
{
|
||||
public:
|
||||
virtual void onEnter();
|
||||
virtual void onExit();
|
||||
virtual std::string title();
|
||||
virtual bool ccTouchBegan(Touch *touch, Event *event);
|
||||
virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent);
|
||||
virtual void registerWithTouchDispatcher();
|
||||
|
||||
cocos2d::extension::armature::Armature *armature;
|
||||
cocos2d::extension::armature::CCArmature *armature;
|
||||
int weaponIndex;
|
||||
};
|
||||
#endif // __HELLOWORLD_SCENE_H__
|
|
@ -95,14 +95,14 @@ void SceneEditorTestLayer::toExtensionsMainLayer(cocos2d::Object *sender)
|
|||
}
|
||||
|
||||
|
||||
cocos2d::extension::armature::Armature* SceneEditorTestLayer::getFish(int nTag, const char *pszName)
|
||||
cocos2d::extension::armature::CCArmature* SceneEditorTestLayer::getFish(int nTag, const char *pszName)
|
||||
{
|
||||
if (_curNode == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
ComRender *pFishRender = (ComRender*)(_curNode->getChildByTag(nTag)->getComponent(pszName));
|
||||
return (cocos2d::extension::armature::Armature *)(pFishRender->getNode());
|
||||
return (cocos2d::extension::armature::CCArmature *)(pFishRender->getNode());
|
||||
}
|
||||
|
||||
void runSceneEditorTestLayer()
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void toExtensionsMainLayer(cocos2d::Object *sender);
|
||||
|
||||
//get Fish based on Tag and name of Compoent
|
||||
cocos2d::extension::armature::Armature* getFish(int nTag, const char *pszName);
|
||||
cocos2d::extension::armature::CCArmature* getFish(int nTag, const char *pszName);
|
||||
|
||||
private:
|
||||
cocos2d::Node *_curNode;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
434a36b3e7fa9c849986cf6128b7d4402a382eb7
|
|
@ -1 +1 @@
|
|||
db891b84393bfe4b806f46bbf9c2879fa9438608
|
||||
2b61d3b005b4076c5ff22a78a00822c0f0dc0875
|
|
@ -1,347 +1,236 @@
|
|||
<skeleton name="Dragon" frameRate="24" version="2.1">
|
||||
<armatures>
|
||||
<armature name="Dragon">
|
||||
<b name="tailTip" parent="tail" x="169.9" y="-106.15" kX="30" kY="30" cX="1" cY="1" pX="23.25" pY="93.05" z="0">
|
||||
<d name="parts-tailTip" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="armUpperL" parent="body" x="-43.95" y="-159.15" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="1">
|
||||
<d name="parts-armUpperL" pX="41" pY="16"/>
|
||||
</b>
|
||||
<b name="armL" parent="armUpperL" x="-44.05" y="-125.75" kX="-142.73" kY="-142.73" cX="1" cY="1" pX="15.35" pY="33" z="2">
|
||||
<d name="parts-armL" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="handL" parent="armL" x="-60" y="-96.5" kX="-90" kY="-90" cX="1" cY="1" pX="38.9" pY="28.45" z="3">
|
||||
<d name="parts-handL" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="legL" parent="body" x="-21.05" y="-88.1" kX="-36.21" kY="-36.21" cX="1" cY="1" pX="91.6" pY="14.7" z="4">
|
||||
<d name="parts-legL" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="body" x="5.9" y="-126.1" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5">
|
||||
<d name="parts-body" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="hair" parent="head" x="44.4" y="-252.1" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6">
|
||||
<d name="parts-hair" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="head" parent="body" x="111.35" y="-50.2" kX="0" kY="0" cX="1" cY="1" pX="115.4" pY="156.9" z="7">
|
||||
<d name="parts-head" pX="79.5" pY="160"/>
|
||||
</b>
|
||||
<b name="eyeL" parent="head" x="-42.85" y="-281.45" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8">
|
||||
<d name="parts-eyeL" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="eyeR" parent="head" x="4.1" y="-263.6" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9">
|
||||
<d name="parts-eyeR" pX="8" pY="15"/>
|
||||
</b>
|
||||
<b name="tail" parent="body" x="45.9" y="-70.8" kX="30" kY="30" cX="1" cY="1" pX="11.5" pY="176.35" z="10">
|
||||
<d name="parts-tail" pX="0" pY="-63.8"/>
|
||||
</b>
|
||||
<b name="legR" parent="body" x="33.4" y="-80.5" kX="15" kY="15" cX="1" cY="1" pX="44.9" pY="16.6" z="11">
|
||||
<d name="parts-legR" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="armUpperR" parent="body" x="18.05" y="-167.6" kX="78.95" kY="78.95" cX="1" cY="1" pX="0" pY="0" z="12">
|
||||
<d name="parts-armUpperR" pX="12" pY="28"/>
|
||||
</b>
|
||||
<b name="armR" parent="armUpperR" x="47.1" y="-104.6" kX="15" kY="15" cX="1" cY="1" pX="12.3" pY="12.3" z="13">
|
||||
<d name="parts-armR" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="handR" parent="armR" x="42.7" y="-83.35" kX="30" kY="30" cX="1" cY="1" pX="26.65" pY="2.9" z="14">
|
||||
<d name="parts-handR" pX="0" pY="0"/>
|
||||
</b>
|
||||
<b name="beardL" parent="head" x="-14" y="-217.35" kX="0" kY="0" cX="1" cY="1" pX="55.95" pY="4.75" z="15">
|
||||
<d name="parts-beardL" pX="54" pY="4"/>
|
||||
</b>
|
||||
<b name="beardR" parent="head" x="-19.8" y="-221.55" kX="0" kY="0" cX="1" cY="1" pX="3.2" pY="8.9" z="16">
|
||||
<d name="parts-beardR" pX="0" pY="0"/>
|
||||
</b>
|
||||
</armature>
|
||||
</armatures>
|
||||
<animations>
|
||||
<animation name="Dragon">
|
||||
<mov name="stand" dr="7" to="6" drTW="30" lp="1" twE="0">
|
||||
<b name="tailTip" sc="1" dl="0">
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23.25" pY="93.05" z="0" dI="0" dr="2"/>
|
||||
<f x="174.9" y="-97.15" cocos2d_x="188.8" cocos2d_y="-192.1" kX="22.31" kY="22.31" cX="1" cY="1" pX="23.2" pY="93.1" z="0" dI="0" dr="3"/>
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23.25" pY="93.05" z="0" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-44.05" y="-125.75" cocos2d_x="-51.85" cocos2d_y="-90.2" kX="-142.73" kY="-142.73" cX="1" cY="1" pX="15.35" pY="33" z="2" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-60" y="-96.5" cocos2d_x="-88.45" cocos2d_y="-57.6" kX="-90" kY="-90" cX="1" cY="1" pX="38.9" pY="28.45" z="3" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-21.05" y="-88.1" cocos2d_x="-103.7" cocos2d_y="-45.85" kX="-36.21" kY="-36.21" cX="1" cY="1" pX="91.6" pY="14.7" z="4" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="2"/>
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="3"/>
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="3"/>
|
||||
<f x="45.4" y="-254.1" cocos2d_x="14.4" cocos2d_y="-324.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="2"/>
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="111.35" y="-50.2" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="0" kY="0" cX="1" cY="1" pX="115.4" pY="156.9" z="7" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="2"/>
|
||||
<f x="-42.85" y="-283.45" cocos2d_x="-49.7" cocos2d_y="-294.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="3"/>
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="4.1" y="-263.6" cocos2d_x="-5" cocos2d_y="-278" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="2"/>
|
||||
<f x="4.1" y="-264.6" cocos2d_x="-5" cocos2d_y="-279" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="3"/>
|
||||
<f x="4.1" y="-263.6" cocos2d_x="-5" cocos2d_y="-278" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="tail" sc="1" dl="0">
|
||||
<f x="45.9" y="-70.8" cocos2d_x="124.1" cocos2d_y="-229.25" kX="30" kY="30" cX="1" cY="1" pX="11.5" pY="176.35" z="10" dI="0" dr="2"/>
|
||||
<f x="43.9" y="-70.8" cocos2d_x="135.5" cocos2d_y="-221.95" kX="34.95" kY="34.95" cX="1" cY="1" pX="11.55" pY="176.35" z="10" dI="0" dr="3"/>
|
||||
<f x="45.9" y="-70.8" cocos2d_x="124.1" cocos2d_y="-229.25" kX="30" kY="30" cX="1" cY="1" pX="11.5" pY="176.35" z="10" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="33.4" y="-80.5" cocos2d_x="-5.7" cocos2d_y="-108.2" kX="15" kY="15" cX="1" cY="1" pX="44.9" pY="16.6" z="11" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="18.05" y="-167.6" cocos2d_x="18.05" cocos2d_y="-167.6" kX="78.95" kY="78.95" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="47.1" y="-104.6" cocos2d_x="38.45" cocos2d_y="-119.7" kX="15" kY="15" cX="1" cY="1" pX="12.3" pY="12.3" z="13" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="42.7" y="-83.35" cocos2d_x="21.15" cocos2d_y="-99.2" kX="30" kY="30" cX="1" cY="1" pX="26.65" pY="2.9" z="14" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="beardL" sc="2" dl="0.3">
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="55.95" pY="4.75" z="15" dI="0" dr="2"/>
|
||||
<f x="-70.1" y="-221.8" cocos2d_x="-70.1" cocos2d_y="-221.8" kX="-6.47" kY="-6.47" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="3"/>
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="55.95" pY="4.75" z="15" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="beardR" sc="2" dl="0.3">
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3.2" pY="8.9" z="16" dI="0" dr="2"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-22.15" cocos2d_y="-230.75" kX="5.44" kY="5.44" cX="1" cY="1" pX="3.2" pY="8.95" z="16" dI="0" dr="3"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3.2" pY="8.9" z="16" dI="0" dr="2"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="walk" dr="8" to="5" drTW="20" lp="1" twE="0">
|
||||
<b name="tailTip" sc="1.5" dl="0">
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23.25" pY="93.05" z="0" dI="0" dr="4"/>
|
||||
<f x="153.9" y="-124.35" cocos2d_x="194.85" cocos2d_y="-211.2" kX="39.23" kY="39.23" cX="1" cY="1" pX="23.15" pY="93.15" z="0" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-81.2" kY="-81.2" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="4"/>
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-30" kY="-30" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-34.05" y="-121.7" cocos2d_x="-7.2" cocos2d_y="-97.2" kX="157.27" kY="157.27" cX="1" cY="1" pX="15.25" pY="32.95" z="2" dI="0" dr="4"/>
|
||||
<f x="-64.05" y="-126.75" cocos2d_x="-99.85" cocos2d_y="-121" kX="-74.18" kY="-74.18" cX="1" cY="1" pX="15.35" pY="32.9" z="2" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-16.1" y="-94" cocos2d_x="-8.75" cocos2d_y="-46.35" kX="-135" kY="-135" cX="1" cY="1" pX="38.85" pY="28.45" z="3" dI="0" dr="4"/>
|
||||
<f x="-95.85" y="-129.1" cocos2d_x="-140.8" cocos2d_y="-146.55" kX="-15" kY="-15" cX="1" cY="1" pX="38.85" pY="28.5" z="3" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-9" y="-73.1" cocos2d_x="-94.7" cocos2d_y="-108.7" kX="13.46" kY="13.46" cX="1" cY="1" pX="91.65" pY="14.65" z="4" dI="0" dr="4"/>
|
||||
<f x="-3.95" y="-91.1" cocos2d_x="-68.1" cocos2d_y="-24" kX="-55.44" kY="-55.44" cX="1" cY="1" pX="91.7" pY="14.75" z="4" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-128.1" cocos2d_x="-52.75" cocos2d_y="-214.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="4"/>
|
||||
<f x="5.9" y="-127.1" cocos2d_x="-52.75" cocos2d_y="-213.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="4"/>
|
||||
<f x="47.4" y="-253.1" cocos2d_x="16.4" cocos2d_y="-323.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="111.35" y="-50.2" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="0" kY="0" cX="1" cY="1" pX="115.4" pY="156.9" z="7" dI="0" dr="4"/>
|
||||
<f x="-4.05" y="-207.1" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="2.95" kY="2.95" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="4"/>
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="4.95" y="-263.35" cocos2d_x="-4.15" cocos2d_y="-277.75" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="4"/>
|
||||
<f x="4.95" y="-263.35" cocos2d_x="-4.15" cocos2d_y="-277.75" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="tail" sc="1.1" dl="0">
|
||||
<f x="41.9" y="-72.8" cocos2d_x="120.1" cocos2d_y="-231.25" kX="30" kY="30" cX="1" cY="1" pX="11.5" pY="176.3" z="10" dI="0" dr="4"/>
|
||||
<f x="39.9" y="-74.8" cocos2d_x="93.2" cocos2d_y="-243.3" kX="21.29" kY="21.29" cX="1" cY="1" pX="11.55" pY="176.35" z="10" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="30.4" y="-89.5" cocos2d_x="-17.3" cocos2d_y="-93.95" kX="-15" kY="-15" cX="1" cY="1" pX="44.9" pY="16.65" z="11" dI="0" dr="4"/>
|
||||
<f x="31.45" y="-82.5" cocos2d_x="11.45" cocos2d_y="-126" kX="45" kY="45" cX="1" cY="1" pX="44.9" pY="16.6" z="11" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="15.05" y="-162.6" cocos2d_x="15.05" cocos2d_y="-162.6" kX="124.45" kY="124.45" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="4"/>
|
||||
<f x="18.05" y="-167.6" cocos2d_x="18.05" cocos2d_y="-167.6" kX="56.8" kY="56.8" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="-12.9" y="-101.6" cocos2d_x="-2.3" cocos2d_y="-115.35" kX="82.22" kY="82.22" cX="1" cY="1" pX="12.2" pY="12.35" z="13" dI="0" dr="4"/>
|
||||
<f x="67.9" y="-121.4" cocos2d_x="51.85" cocos2d_y="-128.1" kX="-22.78" kY="-22.78" cX="1" cY="1" pX="12.2" pY="12.35" z="13" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="-36.3" y="-105.35" cocos2d_x="-50.4" cocos2d_y="-128.1" kX="51.74" kY="51.74" cX="1" cY="1" pX="26.6" pY="3" z="14" dI="0" dr="4"/>
|
||||
<f x="78.55" y="-101.2" cocos2d_x="51.8" cocos2d_y="-100.4" kX="-8.26" kY="-8.26" cX="1" cY="1" pX="26.6" pY="3.05" z="14" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="beardL" sc="1" dl="0">
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="55.95" pY="4.75" z="15" dI="0" dr="4"/>
|
||||
<f x="-68.95" y="-225.1" cocos2d_x="-68.95" cocos2d_y="-225.1" kX="8.99" kY="8.99" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="beardR" sc="1" dl="0">
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3.2" pY="8.9" z="16" dI="0" dr="4"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-24.1" cocos2d_y="-230" kX="-7.5" kY="-7.5" cX="1" cY="1" pX="3.1" pY="8.95" z="16" dI="0" evt="walk_middle" dr="4"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="jump" dr="5" to="3" drTW="5" lp="1" twE="NaN">
|
||||
<b name="tailTip" sc="1" dl="0">
|
||||
<f x="156.9" y="-75.35" cocos2d_x="229" cocos2d_y="-138.75" kX="62.68" kY="62.68" cX="1" cY="1" pX="23.2" pY="93.15" z="0" dI="0" dr="2"/>
|
||||
<f x="157.85" y="-71.35" cocos2d_x="239.05" cocos2d_y="-122.7" kX="71.67" kY="71.67" cX="1" cY="1" pX="23.15" pY="93.2" z="0" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-190.15" cocos2d_x="-43.95" cocos2d_y="-190.15" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="2"/>
|
||||
<f x="-43.95" y="-189.15" cocos2d_x="-43.95" cocos2d_y="-189.15" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-52" y="-156.8" cocos2d_x="-73.25" cocos2d_y="-127.35" kX="-119.18" kY="-119.18" cX="1" cY="1" pX="15.35" pY="32.9" z="2" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-73.9" y="-137.75" cocos2d_x="-111.45" cocos2d_y="-107.55" kX="-75" kY="-75" cX="1" cY="1" pX="38.85" pY="28.45" z="3" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="12.25" y="-118.05" cocos2d_x="-62.45" cocos2d_y="-63.05" kX="-45.47" kY="-45.47" cX="1" cY="1" pX="91.6" pY="14.7" z="4" dI="0" dr="2"/>
|
||||
<f x="12.25" y="-117.05" cocos2d_x="-62.45" cocos2d_y="-62.05" kX="-45.47" kY="-45.47" cX="1" cY="1" pX="91.6" pY="14.7" z="4" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-159.1" cocos2d_x="-52.75" cocos2d_y="-245.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="53.4" y="-278.1" cocos2d_x="22.4" cocos2d_y="-348.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="2"/>
|
||||
<f x="55.4" y="-276.1" cocos2d_x="24.4" cocos2d_y="-346.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="-2.25" y="-239.15" cocos2d_x="-2.25" cocos2d_y="-239.15" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-32.85" y="-325.45" cocos2d_x="-39.7" cocos2d_y="-336.75" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="2"/>
|
||||
<f x="-32.35" y="-325.95" cocos2d_x="-39.2" cocos2d_y="-337.25" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="14.95" y="-300.35" cocos2d_x="5.85" cocos2d_y="-314.75" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="2"/>
|
||||
<f x="15.95" y="-301.35" cocos2d_x="6.85" cocos2d_y="-315.75" kX="0" kY="0" cX="1" cY="1" pX="9.1" pY="14.4" z="9" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="tail" sc="1" dl="0">
|
||||
<f x="33.9" y="-108.8" cocos2d_x="180.6" cocos2d_y="-207.5" kX="59.79" kY="59.79" cX="1" cY="1" pX="11.5" pY="176.45" z="10" dI="0" dr="2"/>
|
||||
<f x="33.9" y="-108.8" cocos2d_x="185.5" cocos2d_y="-199.8" kX="62.76" kY="62.76" cX="1" cY="1" pX="11.5" pY="176.45" z="10" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="41.45" y="-107.5" cocos2d_x="-6" cocos2d_y="-113.8" kX="-12.69" kY="-12.69" cX="1" cY="1" pX="44.9" pY="16.55" z="11" dI="0" dr="2"/>
|
||||
<f x="41.45" y="-106.5" cocos2d_x="-6" cocos2d_y="-112.8" kX="-12.69" kY="-12.69" cX="1" cY="1" pX="44.9" pY="16.55" z="11" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="18.05" y="-195.6" cocos2d_x="18.05" cocos2d_y="-195.6" kX="54.3" kY="54.3" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="2"/>
|
||||
<f x="18.05" y="-194.6" cocos2d_x="18.05" cocos2d_y="-194.6" kX="54.3" kY="54.3" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="67.9" y="-153.4" cocos2d_x="51.85" cocos2d_y="-160.1" kX="-22.78" kY="-22.78" cX="1" cY="1" pX="12.2" pY="12.35" z="13" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="78.55" y="-133.2" cocos2d_x="51.8" cocos2d_y="-132.4" kX="-8.26" kY="-8.26" cX="1" cY="1" pX="26.65" pY="3.1" z="14" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="beardL" sc="1" dl="0">
|
||||
<f x="-63.8" y="-263.7" cocos2d_x="-63.8" cocos2d_y="-263.7" kX="-40.29" kY="-40.29" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="2"/>
|
||||
<f x="-63.8" y="-263.7" cocos2d_x="-63.8" cocos2d_y="-263.7" kX="-46.79" kY="-46.79" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="beardR" sc="1" dl="0">
|
||||
<f x="-19.85" y="-253.5" cocos2d_x="-14.65" cocos2d_y="-261.45" kX="52.5" kY="52.5" cX="1" cY="1" pX="3.1" pY="8.95" z="16" dI="0" dr="2"/>
|
||||
<f x="-19.8" y="-253.45" cocos2d_x="-13.6" cocos2d_y="-260.65" kX="60.23" kY="60.23" cX="1" cY="1" pX="3.15" pY="8.95" z="16" dI="0" dr="3"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="fall" dr="5" to="6" drTW="5" lp="1" twE="NaN">
|
||||
<b name="tailTip" sc="1" dl="0">
|
||||
<f x="151.85" y="-179.95" cocos2d_x="148" cocos2d_y="-275.95" kX="11.67" kY="11.67" cX="1" cY="1" pX="23.15" pY="93.25" z="0" dI="0" dr="2"/>
|
||||
<f x="145.85" y="-185.85" cocos2d_x="133.75" cocos2d_y="-281.25" kX="6.73" kY="6.73" cX="1" cY="1" pX="23.2" pY="93.3" z="0" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-190.15" cocos2d_x="-43.95" cocos2d_y="-190.15" kX="32.45" kY="32.45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="2"/>
|
||||
<f x="-43.95" y="-191.15" cocos2d_x="-43.95" cocos2d_y="-191.15" kX="32.45" kY="32.45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-74.55" y="-193" cocos2d_x="-102.7" cocos2d_y="-170.05" kX="-104.18" kY="-104.18" cX="1" cY="1" pX="15.35" pY="32.9" z="2" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-104.1" y="-178.5" cocos2d_x="-152" cocos2d_y="-183.65" kX="-30" kY="-30" cX="1" cY="1" pX="38.9" pY="28.4" z="3" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-9.75" y="-117.15" cocos2d_x="-94.65" cocos2d_y="-154.3" kX="14.52" kY="14.52" cX="1" cY="1" pX="91.5" pY="14.7" z="4" dI="0" dr="2"/>
|
||||
<f x="-9.75" y="-118.15" cocos2d_x="-94.65" cocos2d_y="-155.3" kX="14.52" kY="14.52" cX="1" cY="1" pX="91.5" pY="14.65" z="4" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-159.1" cocos2d_x="-52.75" cocos2d_y="-245.65" kX="0" kY="0" cX="1" cY="1" pX="58.65" pY="86.55" z="5" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="43.35" y="-290.1" cocos2d_x="-4.75" cocos2d_y="-349.95" kX="-15" kY="-15" cX="1" cY="1" pX="30.95" pY="70.3" z="6" dI="0" dr="2"/>
|
||||
<f x="39.4" y="-293.05" cocos2d_x="-9.6" cocos2d_y="-352.25" kX="-15.82" kY="-15.82" cX="1" cY="1" pX="31" pY="70.3" z="6" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="1.45" y="-241.8" cocos2d_x="1.45" cocos2d_y="-241.8" kX="-8.73" kY="-8.73" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-49.35" y="-301.95" cocos2d_x="-56.2" cocos2d_y="-313.25" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="2"/>
|
||||
<f x="-49.35" y="-300.95" cocos2d_x="-56.2" cocos2d_y="-312.25" kX="0" kY="0" cX="1" cY="1" pX="6.85" pY="11.3" z="8" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="-13.15" y="-304.75" cocos2d_x="-13.15" cocos2d_y="-304.75" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="2"/>
|
||||
<f x="-13.15" y="-303.75" cocos2d_x="-13.15" cocos2d_y="-303.75" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="tail" sc="1" dl="0">
|
||||
<f x="43.95" y="-106.85" cocos2d_x="67.9" cocos2d_y="-281.95" kX="11.53" kY="11.53" cX="1" cY="1" pX="11.5" pY="176.3" z="10" dI="0" dr="2"/>
|
||||
<f x="43.95" y="-106.85" cocos2d_x="55.75" cocos2d_y="-283.15" kX="7.56" kY="7.56" cX="1" cY="1" pX="11.5" pY="176.35" z="10" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="42.45" y="-108.5" cocos2d_x="20.8" cocos2d_y="-151.15" kX="42.76" kY="42.76" cX="1" cY="1" pX="44.9" pY="16.6" z="11" dI="0" dr="2"/>
|
||||
<f x="42.45" y="-109.5" cocos2d_x="20.8" cocos2d_y="-152.15" kX="42.76" kY="42.76" cX="1" cY="1" pX="44.85" pY="16.6" z="11" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="18.05" y="-195.6" cocos2d_x="18.05" cocos2d_y="-195.6" kX="9.3" kY="9.3" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="2"/>
|
||||
<f x="18.05" y="-196.6" cocos2d_x="18.05" cocos2d_y="-196.6" kX="9.3" kY="9.3" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="81.95" y="-203.4" cocos2d_x="65.85" cocos2d_y="-196.8" kX="-67.78" kY="-67.78" cX="1" cY="1" pX="12.2" pY="12.4" z="13" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="101.1" y="-194.8" cocos2d_x="75.45" cocos2d_y="-187.15" kX="-23.26" kY="-23.26" cX="1" cY="1" pX="26.65" pY="3.1" z="14" dI="0" dr="5"/>
|
||||
</b>
|
||||
<b name="beardL" sc="1" dl="0">
|
||||
<f x="-64.85" y="-246.25" cocos2d_x="-64.85" cocos2d_y="-246.25" kX="-11.27" kY="-11.27" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="2"/>
|
||||
<f x="-64.85" y="-246.25" cocos2d_x="-64.85" cocos2d_y="-246.25" kX="-2.57" kY="-2.57" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="3"/>
|
||||
</b>
|
||||
<b name="beardR" sc="1" dl="0">
|
||||
<f x="-19.8" y="-250.5" cocos2d_x="-22.9" cocos2d_y="-259.4" kX="0.23" kY="0.23" cX="1" cY="1" pX="3.15" pY="8.9" z="16" dI="0" dr="2"/>
|
||||
<f x="-19.8" y="-250.5" cocos2d_x="-25.05" cocos2d_y="-258.25" kX="-14.77" kY="-14.77" cX="1" cY="1" pX="3.05" pY="8.85" z="16" dI="0" dr="3"/>
|
||||
</b>
|
||||
</mov>
|
||||
</animation>
|
||||
</animations>
|
||||
<TextureAtlas name="Dragon" width="512" height="512">
|
||||
<SubTexture name="parts-beardR" width="68" height="18" cocos2d_pX="0" cocos2d_pY="0" x="291" y="233"/>
|
||||
<SubTexture name="parts-beardL" width="60" height="18" cocos2d_pX="54" cocos2d_pY="4" x="229" y="221"/>
|
||||
<SubTexture name="parts-handR" width="49" height="29" cocos2d_pX="0" cocos2d_pY="0" x="82" y="240"/>
|
||||
<SubTexture name="parts-armR" width="23" height="39" cocos2d_pX="0" cocos2d_pY="0" x="465" y="160"/>
|
||||
<SubTexture name="parts-armUpperR" width="80" height="47" cocos2d_pX="12" cocos2d_pY="28" x="0" y="199"/>
|
||||
<SubTexture name="parts-legR" width="90" height="116" cocos2d_pX="0" cocos2d_pY="0" x="401" y="0"/>
|
||||
<SubTexture name="parts-tail" width="108" height="139" cocos2d_pX="0" cocos2d_pY="-63.8" x="291" y="0"/>
|
||||
<SubTexture name="parts-eyeR" width="19" height="29" cocos2d_pX="8" cocos2d_pY="15" x="491" y="118"/>
|
||||
<SubTexture name="parts-eyeL" width="14" height="23" cocos2d_pX="0" cocos2d_pY="0" x="493" y="0"/>
|
||||
<SubTexture name="parts-head" width="169" height="197" cocos2d_pX="79.5" cocos2d_pY="160" x="0" y="0"/>
|
||||
<SubTexture name="parts-hair" width="62" height="141" cocos2d_pX="0" cocos2d_pY="0" x="401" y="118"/>
|
||||
<SubTexture name="parts-body" width="118" height="174" cocos2d_pX="0" cocos2d_pY="0" x="171" y="0"/>
|
||||
<SubTexture name="parts-legL" width="102" height="90" cocos2d_pX="0" cocos2d_pY="0" x="291" y="141"/>
|
||||
<SubTexture name="parts-handL" width="48" height="39" cocos2d_pX="0" cocos2d_pY="0" x="82" y="199"/>
|
||||
<SubTexture name="parts-armL" width="24" height="40" cocos2d_pX="0" cocos2d_pY="0" x="465" y="118"/>
|
||||
<SubTexture name="parts-armUpperL" width="56" height="43" cocos2d_pX="41" cocos2d_pY="16" x="229" y="176"/>
|
||||
<SubTexture name="parts-tailTip" width="56" height="105" cocos2d_pX="0" cocos2d_pY="0" x="171" y="176"/>
|
||||
</TextureAtlas>
|
||||
<skeleton name="Dragon" frameRate="24" version="2.0">
|
||||
<armatures>
|
||||
<armature name="Dragon">
|
||||
<b name="tailTip" x="169.9" y="-106.15" kX="30" kY="30" cX="1" cY="1" pX="23" pY="93" z="0">
|
||||
<d name="parts-tailTip"/>
|
||||
</b>
|
||||
<b name="armUpperL" x="-43.95" y="-159.15" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="1">
|
||||
<d name="parts-armUpperL"/>
|
||||
</b>
|
||||
<b name="armL" x="-44.05" y="-125.75" kX="-142.73" kY="-142.73" cX="1" cY="1" pX="15" pY="33" z="2">
|
||||
<d name="parts-armL"/>
|
||||
</b>
|
||||
<b name="handL" x="-60" y="-96.5" kX="-90" kY="-90" cX="1" cY="1" pX="39" pY="28" z="3">
|
||||
<d name="parts-handL"/>
|
||||
</b>
|
||||
<b name="legL" x="-21.05" y="-88.1" kX="-36.21" kY="-36.21" cX="1" cY="1" pX="92" pY="15" z="4">
|
||||
<d name="parts-legL"/>
|
||||
</b>
|
||||
<b name="body" x="5.9" y="-126.1" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5">
|
||||
<d name="parts-body"/>
|
||||
</b>
|
||||
<b name="hair" x="44.4" y="-252.1" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6">
|
||||
<d name="parts-hair"/>
|
||||
</b>
|
||||
<b name="head" x="111.35" y="-50.2" kX="0" kY="0" cX="1" cY="1" pX="115" pY="157" z="7">
|
||||
<d name="parts-head"/>
|
||||
</b>
|
||||
<b name="eyeL" x="-42.85" y="-281.45" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8">
|
||||
<d name="parts-eyeL"/>
|
||||
</b>
|
||||
<b name="eyeR" x="4.1" y="-263.6" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9">
|
||||
<d name="parts-eyeR"/>
|
||||
</b>
|
||||
<b name="tail" x="45.9" y="-70.8" kX="30" kY="30" cX="1" cY="1" pX="12" pY="176" z="10">
|
||||
<d name="parts-tail"/>
|
||||
</b>
|
||||
<b name="legR" x="33.4" y="-80.5" kX="15" kY="15" cX="1" cY="1" pX="45" pY="17" z="11">
|
||||
<d name="parts-legR"/>
|
||||
</b>
|
||||
<b name="armUpperR" x="18.05" y="-167.6" kX="78.95" kY="78.95" cX="1" cY="1" pX="0" pY="0" z="12">
|
||||
<d name="parts-armUpperR"/>
|
||||
</b>
|
||||
<b name="armR" x="47.1" y="-104.6" kX="15" kY="15" cX="1" cY="1" pX="12" pY="12" z="13">
|
||||
<d name="parts-armR"/>
|
||||
</b>
|
||||
<b name="handR" x="42.7" y="-83.35" kX="30" kY="30" cX="1" cY="1" pX="27" pY="3" z="14">
|
||||
<d name="parts-handR"/>
|
||||
</b>
|
||||
<b name="beardL" x="-14" y="-217.35" kX="0" kY="0" cX="1" cY="1" pX="56" pY="5" z="15">
|
||||
<d name="parts-beardL"/>
|
||||
</b>
|
||||
<b name="beardR" x="-19.8" y="-221.55" kX="0" kY="0" cX="1" cY="1" pX="3" pY="9" z="16">
|
||||
<d name="parts-beardR"/>
|
||||
</b>
|
||||
</armature>
|
||||
</armatures>
|
||||
<animations>
|
||||
<animation name="Dragon">
|
||||
<mov name="stand" dr="7" to="6" drTW="30" lp="1" twE="0">
|
||||
<b name="tailTip" sc="1" dl="0">
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="2"/>
|
||||
<f x="174.9" y="-97.15" cocos2d_x="188.8" cocos2d_y="-192.1" kX="22.31" kY="22.31" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="3"/>
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-44.05" y="-125.75" cocos2d_x="-51.85" cocos2d_y="-90.2" kX="-142.73" kY="-142.73" cX="1" cY="1" pX="15" pY="33" z="2" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-60" y="-96.5" cocos2d_x="-88.45" cocos2d_y="-57.6" kX="-90" kY="-90" cX="1" cY="1" pX="39" pY="28" z="3" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-21.05" y="-88.1" cocos2d_x="-103.7" cocos2d_y="-45.85" kX="-36.21" kY="-36.21" cX="1" cY="1" pX="92" pY="15" z="4" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="2"/>
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="3"/>
|
||||
<f x="5.9" y="-126.1" cocos2d_x="-52.75" cocos2d_y="-212.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="3"/>
|
||||
<f x="45.4" y="-254.1" cocos2d_x="14.4" cocos2d_y="-324.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="2"/>
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="111.35" y="-50.2" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="0" kY="0" cX="1" cY="1" pX="115" pY="157" z="7" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="2"/>
|
||||
<f x="-42.85" y="-283.45" cocos2d_x="-49.7" cocos2d_y="-294.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="3"/>
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="4.1" y="-263.6" cocos2d_x="-5" cocos2d_y="-278" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="2"/>
|
||||
<f x="4.1" y="-264.6" cocos2d_x="-5" cocos2d_y="-279" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="3"/>
|
||||
<f x="4.1" y="-263.6" cocos2d_x="-5" cocos2d_y="-278" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="tail" sc="1" dl="0">
|
||||
<f x="45.9" y="-70.8" cocos2d_x="124.1" cocos2d_y="-229.25" kX="30" kY="30" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="2"/>
|
||||
<f x="43.9" y="-70.8" cocos2d_x="135.5" cocos2d_y="-221.95" kX="34.95" kY="34.95" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="3"/>
|
||||
<f x="45.9" y="-70.8" cocos2d_x="124.1" cocos2d_y="-229.25" kX="30" kY="30" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="33.4" y="-80.5" cocos2d_x="-5.7" cocos2d_y="-108.2" kX="15" kY="15" cX="1" cY="1" pX="45" pY="17" z="11" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="18.05" y="-167.6" cocos2d_x="18.05" cocos2d_y="-167.6" kX="78.95" kY="78.95" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="47.1" y="-104.6" cocos2d_x="38.45" cocos2d_y="-119.7" kX="15" kY="15" cX="1" cY="1" pX="12" pY="12" z="13" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="42.7" y="-83.35" cocos2d_x="21.15" cocos2d_y="-99.2" kX="30" kY="30" cX="1" cY="1" pX="27" pY="3" z="14" dI="0" dr="7"/>
|
||||
</b>
|
||||
<b name="beardL" sc="2" dl="0.3">
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="56" pY="5" z="15" dI="0" dr="2"/>
|
||||
<f x="-70.1" y="-221.8" cocos2d_x="-70.1" cocos2d_y="-221.8" kX="-6.47" kY="-6.47" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="3"/>
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="56" pY="5" z="15" dI="0" dr="2"/>
|
||||
</b>
|
||||
<b name="beardR" sc="2" dl="0.3">
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="2"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-22.15" cocos2d_y="-230.75" kX="5.44" kY="5.44" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="3"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="2"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="walk" dr="8" to="5" drTW="20" lp="1" twE="0">
|
||||
<b name="tailTip" sc="1.5" dl="0">
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="4"/>
|
||||
<f x="153.9" y="-124.35" cocos2d_x="194.85" cocos2d_y="-211.2" kX="39.23" kY="39.23" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="3"/>
|
||||
<f x="169.9" y="-106.15" cocos2d_x="196.35" cocos2d_y="-198.4" kX="30" kY="30" cX="1" cY="1" pX="23" pY="93" z="0" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armUpperL" sc="1" dl="0">
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-81.2" kY="-81.2" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="4"/>
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-30" kY="-30" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="3"/>
|
||||
<f x="-43.95" y="-159.15" cocos2d_x="-43.95" cocos2d_y="-159.15" kX="-81.2" kY="-81.2" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-34.05" y="-121.7" cocos2d_x="-7.2" cocos2d_y="-97.2" kX="157.27" kY="157.27" cX="1" cY="1" pX="15" pY="33" z="2" dI="0" dr="4"/>
|
||||
<f x="-64.05" y="-126.75" cocos2d_x="-99.85" cocos2d_y="-121" kX="-74.18" kY="-74.18" cX="1" cY="1" pX="15" pY="33" z="2" dI="0" dr="3"/>
|
||||
<f x="-34.05" y="-121.7" cocos2d_x="-7.2" cocos2d_y="-97.2" kX="157.27" kY="157.27" cX="1" cY="1" pX="15" pY="33" z="2" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="handL" sc="1" dl="0">
|
||||
<f x="-16.1" y="-94" cocos2d_x="-8.75" cocos2d_y="-46.35" kX="-135" kY="-135" cX="1" cY="1" pX="39" pY="28" z="3" dI="0" dr="4"/>
|
||||
<f x="-95.85" y="-129.1" cocos2d_x="-140.8" cocos2d_y="-146.55" kX="-15" kY="-15" cX="1" cY="1" pX="39" pY="29" z="3" dI="0" dr="3"/>
|
||||
<f x="-16.1" y="-94" cocos2d_x="-8.75" cocos2d_y="-46.35" kX="-135" kY="-135" cX="1" cY="1" pX="39" pY="28" z="3" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-9" y="-73.1" cocos2d_x="-94.7" cocos2d_y="-108.7" kX="13.46" kY="13.46" cX="1" cY="1" pX="92" pY="15" z="4" dI="0" dr="4"/>
|
||||
<f x="-3.95" y="-91.1" cocos2d_x="-68.1" cocos2d_y="-24" kX="-55.44" kY="-55.44" cX="1" cY="1" pX="92" pY="15" z="4" dI="0" dr="3"/>
|
||||
<f x="-9" y="-73.1" cocos2d_x="-94.7" cocos2d_y="-108.7" kX="13.46" kY="13.46" cX="1" cY="1" pX="92" pY="15" z="4" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="5.9" y="-128.1" cocos2d_x="-52.75" cocos2d_y="-214.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="4"/>
|
||||
<f x="5.9" y="-127.1" cocos2d_x="-52.75" cocos2d_y="-213.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="3"/>
|
||||
<f x="5.9" y="-128.1" cocos2d_x="-52.75" cocos2d_y="-214.65" kX="0" kY="0" cX="1" cY="1" pX="59" pY="87" z="5" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="hair" sc="1" dl="0">
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="4"/>
|
||||
<f x="47.4" y="-253.1" cocos2d_x="16.4" cocos2d_y="-323.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="3"/>
|
||||
<f x="44.4" y="-252.1" cocos2d_x="13.4" cocos2d_y="-322.4" kX="0" kY="0" cX="1" cY="1" pX="31" pY="70" z="6" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="111.35" y="-50.2" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="0" kY="0" cX="1" cY="1" pX="115" pY="157" z="7" dI="0" dr="4"/>
|
||||
<f x="-4.05" y="-207.1" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="2.95" kY="2.95" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="3"/>
|
||||
<f x="111.35" y="-50.2" cocos2d_x="-4.05" cocos2d_y="-207.1" kX="0" kY="0" cX="1" cY="1" pX="115" pY="157" z="7" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="eyeL" sc="1" dl="0">
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="4"/>
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="3"/>
|
||||
<f x="-42.85" y="-281.45" cocos2d_x="-49.7" cocos2d_y="-292.75" kX="0" kY="0" cX="1" cY="1" pX="7" pY="11" z="8" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="eyeR" sc="1" dl="0">
|
||||
<f x="4.95" y="-263.35" cocos2d_x="-4.15" cocos2d_y="-277.75" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="4"/>
|
||||
<f x="4.95" y="-263.35" cocos2d_x="-4.15" cocos2d_y="-277.75" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="3"/>
|
||||
<f x="4.95" y="-263.35" cocos2d_x="-4.15" cocos2d_y="-277.75" kX="0" kY="0" cX="1" cY="1" pX="9" pY="14" z="9" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="tail" sc="1.1" dl="0">
|
||||
<f x="41.9" y="-72.8" cocos2d_x="120.1" cocos2d_y="-231.25" kX="30" kY="30" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="4"/>
|
||||
<f x="39.9" y="-74.8" cocos2d_x="93.2" cocos2d_y="-243.3" kX="21.29" kY="21.29" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="3"/>
|
||||
<f x="41.9" y="-72.8" cocos2d_x="120.1" cocos2d_y="-231.25" kX="30" kY="30" cX="1" cY="1" pX="12" pY="176" z="10" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="30.4" y="-89.5" cocos2d_x="-17.3" cocos2d_y="-93.95" kX="-15" kY="-15" cX="1" cY="1" pX="45" pY="17" z="11" dI="0" dr="4"/>
|
||||
<f x="31.45" y="-82.5" cocos2d_x="11.45" cocos2d_y="-126" kX="45" kY="45" cX="1" cY="1" pX="45" pY="17" z="11" dI="0" dr="3"/>
|
||||
<f x="30.4" y="-89.5" cocos2d_x="-17.3" cocos2d_y="-93.95" kX="-15" kY="-15" cX="1" cY="1" pX="45" pY="17" z="11" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armUpperR" sc="1" dl="0">
|
||||
<f x="15.05" y="-162.6" cocos2d_x="15.05" cocos2d_y="-162.6" kX="124.45" kY="124.45" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="4"/>
|
||||
<f x="18.05" y="-167.6" cocos2d_x="18.05" cocos2d_y="-167.6" kX="56.8" kY="56.8" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="3"/>
|
||||
<f x="15.05" y="-162.6" cocos2d_x="15.05" cocos2d_y="-162.6" kX="124.45" kY="124.45" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="-12.9" y="-101.6" cocos2d_x="-2.3" cocos2d_y="-115.35" kX="82.22" kY="82.22" cX="1" cY="1" pX="12" pY="12" z="13" dI="0" dr="4"/>
|
||||
<f x="67.9" y="-121.4" cocos2d_x="51.85" cocos2d_y="-128.1" kX="-22.78" kY="-22.78" cX="1" cY="1" pX="12" pY="12" z="13" dI="0" dr="3"/>
|
||||
<f x="-12.9" y="-101.6" cocos2d_x="-2.3" cocos2d_y="-115.35" kX="82.22" kY="82.22" cX="1" cY="1" pX="12" pY="12" z="13" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="handR" sc="1" dl="0">
|
||||
<f x="-36.3" y="-105.35" cocos2d_x="-50.4" cocos2d_y="-128.1" kX="51.74" kY="51.74" cX="1" cY="1" pX="27" pY="3" z="14" dI="0" dr="4"/>
|
||||
<f x="78.55" y="-101.2" cocos2d_x="51.8" cocos2d_y="-100.4" kX="-8.26" kY="-8.26" cX="1" cY="1" pX="27" pY="3" z="14" dI="0" dr="3"/>
|
||||
<f x="-36.3" y="-105.35" cocos2d_x="-50.4" cocos2d_y="-128.1" kX="51.74" kY="51.74" cX="1" cY="1" pX="27" pY="3" z="14" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="beardL" sc="1" dl="0">
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="56" pY="5" z="15" dI="0" dr="4"/>
|
||||
<f x="-68.95" y="-225.1" cocos2d_x="-68.95" cocos2d_y="-225.1" kX="8.99" kY="8.99" cX="1" cY="1" pX="0" pY="0" z="15" dI="0" dr="3"/>
|
||||
<f x="-14" y="-217.35" cocos2d_x="-69.95" cocos2d_y="-222.1" kX="0" kY="0" cX="1" cY="1" pX="56" pY="5" z="15" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="beardR" sc="1" dl="0">
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="4"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-24.1" cocos2d_y="-230" kX="-7.5" kY="-7.5" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="3"/>
|
||||
<f x="-19.8" y="-221.55" cocos2d_x="-23" cocos2d_y="-230.45" kX="0" kY="0" cX="1" cY="1" pX="3" pY="9" z="16" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
</animation>
|
||||
</animations>
|
||||
<TextureAtlas name="Dragon" width="512" height="512">
|
||||
<SubTexture name="parts-beardR" width="68" height="18" cocos2d_pX="0" cocos2d_pY="0" x="291" y="233"/>
|
||||
<SubTexture name="parts-beardL" width="60" height="18" cocos2d_pX="54" cocos2d_pY="4" x="229" y="221"/>
|
||||
<SubTexture name="parts-handR" width="49" height="29" cocos2d_pX="0" cocos2d_pY="0" x="82" y="240"/>
|
||||
<SubTexture name="parts-armR" width="23" height="39" cocos2d_pX="0" cocos2d_pY="0" x="465" y="160"/>
|
||||
<SubTexture name="parts-armUpperR" width="80" height="47" cocos2d_pX="12" cocos2d_pY="28" x="0" y="199"/>
|
||||
<SubTexture name="parts-legR" width="90" height="116" cocos2d_pX="0" cocos2d_pY="0" x="401" y="0"/>
|
||||
<SubTexture name="parts-tail" width="108" height="139" cocos2d_pX="0" cocos2d_pY="-63.8" x="291" y="0"/>
|
||||
<SubTexture name="parts-eyeR" width="19" height="29" cocos2d_pX="8" cocos2d_pY="15" x="491" y="118"/>
|
||||
<SubTexture name="parts-eyeL" width="14" height="23" cocos2d_pX="0" cocos2d_pY="0" x="493" y="0"/>
|
||||
<SubTexture name="parts-head" width="169" height="197" cocos2d_pX="79.5" cocos2d_pY="160" x="0" y="0"/>
|
||||
<SubTexture name="parts-hair" width="62" height="141" cocos2d_pX="0" cocos2d_pY="0" x="401" y="118"/>
|
||||
<SubTexture name="parts-body" width="118" height="174" cocos2d_pX="0" cocos2d_pY="0" x="171" y="0"/>
|
||||
<SubTexture name="parts-legL" width="102" height="90" cocos2d_pX="0" cocos2d_pY="0" x="291" y="141"/>
|
||||
<SubTexture name="parts-handL" width="48" height="39" cocos2d_pX="0" cocos2d_pY="0" x="82" y="199"/>
|
||||
<SubTexture name="parts-armL" width="24" height="40" cocos2d_pX="0" cocos2d_pY="0" x="465" y="118"/>
|
||||
<SubTexture name="parts-armUpperL" width="56" height="43" cocos2d_pX="41" cocos2d_pY="16" x="229" y="176"/>
|
||||
<SubTexture name="parts-tailTip" width="56" height="105" cocos2d_pX="0" cocos2d_pY="0" x="171" y="176"/>
|
||||
</TextureAtlas>
|
||||
</skeleton>
|
|
@ -167,281 +167,181 @@
|
|||
</mov>
|
||||
</animation>
|
||||
<animation name="cyborg">
|
||||
<mov name="stand" dr="2" to="6" drTW="25" lp="1" twE="2">
|
||||
<mov name="stand" dr="20" to="6" drTW="20" lp="1" twE="2">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="5.6" y="-13.8" cocos2d_x="5.6" cocos2d_y="-13.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
<f x="6.6" y="-10.8" cocos2d_x="6.6" cocos2d_y="-10.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
<f x="5.6" y="-13.8" cocos2d_x="5.6" cocos2d_y="-13.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="6.6" y="-10.8" cocos2d_x="6.6" cocos2d_y="-10.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="9"/>
|
||||
<f x="5.6" y="-13.8" cocos2d_x="5.6" cocos2d_y="-13.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="3" y="0" cocos2d_x="3" cocos2d_y="0" kX="-35.09" kY="-35.12" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
<f x="3" y="2" cocos2d_x="3" cocos2d_y="2" kX="-45.25" kY="-45.25" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
<f x="3" y="0" cocos2d_x="3" cocos2d_y="0" kX="-35.09" kY="-35.12" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="3" y="2" cocos2d_x="3" cocos2d_y="2" kX="-45.25" kY="-45.25" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="9"/>
|
||||
<f x="3" y="0" cocos2d_x="3" cocos2d_y="0" kX="-35.09" kY="-35.12" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="0">
|
||||
<f x="14.5" y="18" cocos2d_x="14.5" cocos2d_y="18" kX="0.25" kY="0.25" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
<f x="17.5" y="17.6" cocos2d_x="17.5" cocos2d_y="17.6" kX="4.29" kY="4.29" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
<f x="14.5" y="18" cocos2d_x="14.5" cocos2d_y="18" kX="0.25" kY="0.25" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="17.5" y="17.6" cocos2d_x="17.5" cocos2d_y="17.6" kX="4.29" kY="4.29" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="9"/>
|
||||
<f x="14.5" y="18" cocos2d_x="14.5" cocos2d_y="18" kX="0.25" kY="0.25" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0.05">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="9.77" kY="9.82" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="16" kY="16" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="9.77" kY="9.82" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="16" kY="16" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="9.77" kY="9.82" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="1" dl="0">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="1" dl="0.1">
|
||||
<f x="2.6" y="-13" cocos2d_x="2.6" cocos2d_y="-13" kX="4.77" kY="4.81" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
<f x="3.6" y="-11" cocos2d_x="3.6" cocos2d_y="-11" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
<f x="2.6" y="-13" cocos2d_x="2.6" cocos2d_y="-13" kX="4.77" kY="4.81" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="3.6" y="-11" cocos2d_x="3.6" cocos2d_y="-11" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="9"/>
|
||||
<f x="2.6" y="-13" cocos2d_x="2.6" cocos2d_y="-13" kX="4.77" kY="4.81" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0.2">
|
||||
<f x="4" y="-19" cocos2d_x="4" cocos2d_y="-19" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
<f x="5" y="-17" cocos2d_x="5" cocos2d_y="-17" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
<f x="4" y="-19" cocos2d_x="4" cocos2d_y="-19" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="5" y="-17" cocos2d_x="5" cocos2d_y="-17" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="9"/>
|
||||
<f x="4" y="-19" cocos2d_x="4" cocos2d_y="-19" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="-3" y="0" cocos2d_x="-3" cocos2d_y="0" kX="-7" kY="-7" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
<f x="-3" y="2" cocos2d_x="-3" cocos2d_y="2" kX="-12" kY="-12" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
<f x="-3" y="0" cocos2d_x="-3" cocos2d_y="0" kX="-7" kY="-7" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="-3" y="2" cocos2d_x="-3" cocos2d_y="2" kX="-12" kY="-12" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="9"/>
|
||||
<f x="-3" y="0" cocos2d_x="-3" cocos2d_y="0" kX="-7" kY="-7" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="0">
|
||||
<f x="-0.95" y="21.85" cocos2d_x="-0.95" cocos2d_y="21.85" kX="33" kY="33" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
<f x="1.05" y="22.85" cocos2d_x="1.05" cocos2d_y="22.85" kX="36" kY="36" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
<f x="-0.95" y="21.85" cocos2d_x="-0.95" cocos2d_y="21.85" kX="33" kY="33" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="1.05" y="22.85" cocos2d_x="1.05" cocos2d_y="22.85" kX="36" kY="36" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="9"/>
|
||||
<f x="-0.95" y="21.85" cocos2d_x="-0.95" cocos2d_y="21.85" kX="33" kY="33" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-2.4" y="-14.8" cocos2d_x="-2.4" cocos2d_y="-14.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
<f x="-1.4" y="-11.8" cocos2d_x="-1.4" cocos2d_y="-11.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
<f x="-2.4" y="-14.8" cocos2d_x="-2.4" cocos2d_y="-14.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-1.4" y="-11.8" cocos2d_x="-1.4" cocos2d_y="-11.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="9"/>
|
||||
<f x="-2.4" y="-14.8" cocos2d_x="-2.4" cocos2d_y="-14.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="run" dr="2" to="6" drTW="24" lp="1" twE="2">
|
||||
<mov name="run" dr="20" to="6" drTW="20" lp="1" twE="2">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="5.6" y="-21.8" cocos2d_x="5.6" cocos2d_y="-21.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
<f x="3.6" y="-11.8" cocos2d_x="3.6" cocos2d_y="-11.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
<f x="5.6" y="-21.8" cocos2d_x="5.6" cocos2d_y="-21.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="3.6" y="-11.8" cocos2d_x="3.6" cocos2d_y="-11.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="9"/>
|
||||
<f x="5.6" y="-21.8" cocos2d_x="5.6" cocos2d_y="-21.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-2" y="-4" cocos2d_x="-2" cocos2d_y="-4" kX="35" kY="35" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
<f x="2" y="4" cocos2d_x="2" cocos2d_y="4" kX="-70" kY="-70" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
<f x="-2" y="-4" cocos2d_x="-2" cocos2d_y="-4" kX="35" kY="35" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="2" y="4" cocos2d_x="2" cocos2d_y="4" kX="-70" kY="-70" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="9"/>
|
||||
<f x="-2" y="-4" cocos2d_x="-2" cocos2d_y="-4" kX="35" kY="35" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="-0.15">
|
||||
<f x="-16.35" y="16.55" cocos2d_x="-16.35" cocos2d_y="16.55" kX="50" kY="50" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
<f x="25.55" y="12.55" cocos2d_x="25.55" cocos2d_y="12.55" kX="25" kY="25" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
<f x="-16.35" y="16.55" cocos2d_x="-16.35" cocos2d_y="16.55" kX="50" kY="50" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="25.55" y="12.55" cocos2d_x="25.55" cocos2d_y="12.55" kX="25" kY="25" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="9"/>
|
||||
<f x="-16.35" y="16.55" cocos2d_x="-16.35" cocos2d_y="16.55" kX="50" kY="50" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="0.5" dl="0">
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
<f x="0" y="5" cocos2d_x="0" cocos2d_y="5" kX="12" kY="12" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="5" cocos2d_x="0" cocos2d_y="5" kX="12" kY="12" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="0.5" dl="0">
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
<f x="0" y="5" cocos2d_x="0" cocos2d_y="5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="5" cocos2d_x="0" cocos2d_y="5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="0.5" dl="0">
|
||||
<f x="2.65" y="-19.75" cocos2d_x="2.65" cocos2d_y="-19.75" kX="5" kY="5" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
<f x="3.85" y="-9.5" cocos2d_x="3.85" cocos2d_y="-9.5" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
<f x="2.65" y="-19.75" cocos2d_x="2.65" cocos2d_y="-19.75" kX="5" kY="5" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="3.85" y="-9.5" cocos2d_x="3.85" cocos2d_y="-9.5" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="9"/>
|
||||
<f x="2.65" y="-19.75" cocos2d_x="2.65" cocos2d_y="-19.75" kX="5" kY="5" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="0.5" dl="0">
|
||||
<f x="4" y="-25" cocos2d_x="4" cocos2d_y="-25" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
<f x="5" y="-15" cocos2d_x="5" cocos2d_y="-15" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
<f x="4" y="-25" cocos2d_x="4" cocos2d_y="-25" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="5" y="-15" cocos2d_x="5" cocos2d_y="-15" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="9"/>
|
||||
<f x="4" y="-25" cocos2d_x="4" cocos2d_y="-25" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="2" y="-6" cocos2d_x="2" cocos2d_y="-6" kX="-70" kY="-70" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
<f x="-2" y="6" cocos2d_x="-2" cocos2d_y="6" kX="35" kY="35" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
<f x="2" y="-6" cocos2d_x="2" cocos2d_y="-6" kX="-70" kY="-70" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2" y="6" cocos2d_x="-2" cocos2d_y="6" kX="35" kY="35" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="9"/>
|
||||
<f x="2" y="-6" cocos2d_x="2" cocos2d_y="-6" kX="-70" kY="-70" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="-0.15">
|
||||
<f x="25.55" y="2.55" cocos2d_x="25.55" cocos2d_y="2.55" kX="25" kY="25" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
<f x="-16.35" y="26.55" cocos2d_x="-16.35" cocos2d_y="26.55" kX="50" kY="50" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
<f x="25.55" y="2.55" cocos2d_x="25.55" cocos2d_y="2.55" kX="25" kY="25" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="-16.35" y="26.55" cocos2d_x="-16.35" cocos2d_y="26.55" kX="50" kY="50" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="9"/>
|
||||
<f x="25.55" y="2.55" cocos2d_x="25.55" cocos2d_y="2.55" kX="25" kY="25" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-2.4" y="-22.8" cocos2d_x="-2.4" cocos2d_y="-22.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
<f x="5.6" y="-12.8" cocos2d_x="5.6" cocos2d_y="-12.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
<f x="-2.4" y="-22.8" cocos2d_x="-2.4" cocos2d_y="-22.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="5.6" y="-12.8" cocos2d_x="5.6" cocos2d_y="-12.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="9"/>
|
||||
<f x="-2.4" y="-22.8" cocos2d_x="-2.4" cocos2d_y="-22.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="runBack" dr="2" to="4" drTW="30" lp="1" twE="2">
|
||||
<mov name="runBack" dr="20" to="4" drTW="20" lp="1" twE="2">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="-2.4" y="-21.8" cocos2d_x="-2.4" cocos2d_y="-21.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2.4" y="-17.8" cocos2d_x="-2.4" cocos2d_y="-17.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="9"/>
|
||||
<f x="-2.4" y="-21.8" cocos2d_x="-2.4" cocos2d_y="-21.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
<f x="-2.4" y="-17.8" cocos2d_x="-2.4" cocos2d_y="-17.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="3" y="-6" cocos2d_x="3" cocos2d_y="-6" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2.95" y="0" cocos2d_x="-2.95" cocos2d_y="0" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="9"/>
|
||||
<f x="3" y="-6" cocos2d_x="3" cocos2d_y="-6" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
<f x="-2.95" y="0" cocos2d_x="-2.95" cocos2d_y="0" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="-0.85">
|
||||
<f x="17.9" y="9.3" cocos2d_x="17.9" cocos2d_y="9.3" kX="45" kY="45" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="-8.3" y="21.55" cocos2d_x="-8.3" cocos2d_y="21.55" kX="9" kY="9" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="9"/>
|
||||
<f x="17.9" y="9.3" cocos2d_x="17.9" cocos2d_y="9.3" kX="45" kY="45" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
<f x="-8.3" y="21.55" cocos2d_x="-8.3" cocos2d_y="21.55" kX="9" kY="9" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="0.5" dl="0">
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="-6" kY="-6" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-1" cocos2d_x="0" cocos2d_y="-1" kX="-6" kY="-6" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="-6" kY="-6" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
<f x="0" y="-1" cocos2d_x="0" cocos2d_y="-1" kX="-6" kY="-6" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="0.5" dl="0.5">
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-1" cocos2d_x="0" cocos2d_y="-1" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="9"/>
|
||||
<f x="0" y="-5" cocos2d_x="0" cocos2d_y="-5" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
<f x="0" y="-1" cocos2d_x="0" cocos2d_y="-1" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="0.5" dl="0">
|
||||
<f x="-2.15" y="-18.5" cocos2d_x="-2.15" cocos2d_y="-18.5" kX="-3" kY="-3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2.15" y="-14.5" cocos2d_x="-2.15" cocos2d_y="-14.5" kX="-3" kY="-3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="9"/>
|
||||
<f x="-2.15" y="-18.5" cocos2d_x="-2.15" cocos2d_y="-18.5" kX="-3" kY="-3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
<f x="-2.15" y="-14.5" cocos2d_x="-2.15" cocos2d_y="-14.5" kX="-3" kY="-3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="0.5" dl="0">
|
||||
<f x="-3" y="-25" cocos2d_x="-3" cocos2d_y="-25" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="-3" y="-21" cocos2d_x="-3" cocos2d_y="-21" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="9"/>
|
||||
<f x="-3" y="-25" cocos2d_x="-3" cocos2d_y="-25" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
<f x="-3" y="-21" cocos2d_x="-3" cocos2d_y="-21" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="-3" y="-4" cocos2d_x="-3" cocos2d_y="-4" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="3" y="-1.95" cocos2d_x="3" cocos2d_y="-1.95" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="9"/>
|
||||
<f x="-3" y="-4" cocos2d_x="-3" cocos2d_y="-4" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
<f x="3" y="-1.95" cocos2d_x="3" cocos2d_y="-1.95" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="-0.85">
|
||||
<f x="-8.35" y="17.55" cocos2d_x="-8.35" cocos2d_y="17.55" kX="9" kY="9" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="17.9" y="13.3" cocos2d_x="17.9" cocos2d_y="13.3" kX="45" kY="45" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="9"/>
|
||||
<f x="-8.35" y="17.55" cocos2d_x="-8.35" cocos2d_y="17.55" kX="9" kY="9" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
<f x="17.9" y="13.3" cocos2d_x="17.9" cocos2d_y="13.3" kX="45" kY="45" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-3.4" y="-20.8" cocos2d_x="-3.4" cocos2d_y="-20.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-4.4" y="-17.8" cocos2d_x="-4.4" cocos2d_y="-17.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="9"/>
|
||||
<f x="-3.4" y="-20.8" cocos2d_x="-3.4" cocos2d_y="-20.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
<f x="-4.4" y="-17.8" cocos2d_x="-4.4" cocos2d_y="-17.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="squat" dr="1" to="6">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="5.6" y="16.2" cocos2d_x="5.6" cocos2d_y="16.2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="2" y="31" cocos2d_x="2" cocos2d_y="31" kX="-120" kY="-120" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="0">
|
||||
<f x="21.1" y="21.2" cocos2d_x="21.1" cocos2d_y="21.2" kX="-13.5" kY="-13.5" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="32" cocos2d_x="0" cocos2d_y="32" kX="9" kY="9" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="1" dl="0">
|
||||
<f x="0" y="32" cocos2d_x="0" cocos2d_y="32" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="1" dl="0">
|
||||
<f x="1.6" y="18" cocos2d_x="1.6" cocos2d_y="18" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="4" y="13" cocos2d_x="4" cocos2d_y="13" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="-2" y="31" cocos2d_x="-2" cocos2d_y="31" kX="-30" kY="-30" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="0">
|
||||
<f x="7.85" y="49.45" cocos2d_x="7.85" cocos2d_y="49.45" kX="89.99" kY="89.99" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-2.4" y="15.2" cocos2d_x="-2.4" cocos2d_y="15.2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="jump" dr="1" to="6">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="7.6" y="-15.8" cocos2d_x="7.6" cocos2d_y="-15.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="-2" y="1" cocos2d_x="-2" cocos2d_y="1" kX="30" kY="30" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="0">
|
||||
<f x="-12.9" y="20.2" cocos2d_x="-12.9" cocos2d_y="20.2" kX="30" kY="30" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="1" dl="0">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="1" dl="0">
|
||||
<f x="3.6" y="-14" cocos2d_x="3.6" cocos2d_y="-14" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="5" y="-20" cocos2d_x="5" cocos2d_y="-20" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="2" y="-1" cocos2d_x="2" cocos2d_y="-1" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="0">
|
||||
<f x="20.85" y="10.45" cocos2d_x="20.85" cocos2d_y="10.45" kX="60" kY="60" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-0.4" y="-16.8" cocos2d_x="-0.4" cocos2d_y="-16.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="fall" dr="1" to="6">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="-1.4" y="-14.8" cocos2d_x="-1.4" cocos2d_y="-14.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="2" y="0" cocos2d_x="2" cocos2d_y="0" kX="-55" kY="-55" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="0">
|
||||
<f x="20.1" y="13.2" cocos2d_x="20.1" cocos2d_y="13.2" kX="36" kY="36" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="-9" kY="-9" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crotch" sc="1" dl="0">
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="chest" sc="1" dl="0">
|
||||
<f x="-3.4" y="-14" cocos2d_x="-3.4" cocos2d_y="-14" kX="-6" kY="-6" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="-5" y="-20" cocos2d_x="-5" cocos2d_y="-20" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="-2" y="0" cocos2d_x="-2" cocos2d_y="0" kX="-15" kY="-15" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="0">
|
||||
<f x="3.85" y="21.45" cocos2d_x="3.85" cocos2d_y="21.45" kX="-15" kY="-15" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="-9.4" y="-15.8" cocos2d_x="-9.4" cocos2d_y="-15.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="fallEnd" dr="4" to="4" drTW="4" lp="0" twE="NaN">
|
||||
<b name="armInside" sc="1" dl="0">
|
||||
<f x="9.6" y="-4.8" cocos2d_x="9.6" cocos2d_y="-4.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="legL" sc="1" dl="0">
|
||||
<f x="4" y="7" cocos2d_x="4" cocos2d_y="7" kX="-60" kY="-60" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="crusL" sc="1" dl="0">
|
||||
<f x="22.5" y="18" cocos2d_x="22.5" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="7" cocos2d_x="0" cocos2d_y="7" kX="23.52" kY="23.57" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="crotch" sc="1" dl="0">
|
||||
<f x="0" y="7" cocos2d_x="0" cocos2d_y="7" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="chest" sc="1" dl="0">
|
||||
<f x="6.6" y="-4" cocos2d_x="6.6" cocos2d_y="-4" kX="4.77" kY="4.81" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="8" y="-10" cocos2d_x="8" cocos2d_y="-10" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="legR" sc="1" dl="0">
|
||||
<f x="-4" y="7" cocos2d_x="-4" cocos2d_y="7" kX="-30" kY="-30" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="crusR" sc="1" dl="0">
|
||||
<f x="6" y="26" cocos2d_x="6" cocos2d_y="26" kX="45" kY="45" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" dr="4"/>
|
||||
</b>
|
||||
<b name="armOutside" sc="1" dl="0">
|
||||
<f x="1.6" y="-5.8" cocos2d_x="1.6" cocos2d_y="-5.8" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" dr="4"/>
|
||||
</b>
|
||||
<f st="0" dr="3"/>
|
||||
<f st="3" dr="1" mov="stand"/>
|
||||
</mov>
|
||||
</animation>
|
||||
</animations>
|
||||
<TextureAtlas name="Cyborg" width="128" height="128">
|
||||
<SubTexture name="CyborgFolder-RightArm" width="10" height="19" cocos2d_pX="5" cocos2d_pY="4" x="28" y="89"/>
|
||||
<SubTexture name="CyborgFolder-LeftShoulder" width="14" height="19" cocos2d_pX="7" cocos2d_pY="5" x="0" y="89"/>
|
||||
<SubTexture name="CyborgFolder-LeftArm" width="10" height="19" cocos2d_pX="5" cocos2d_pY="4" x="28" y="89"/>
|
||||
<SubTexture name="CyborgFolder-LeftHand" width="7" height="9" cocos2d_pX="3" cocos2d_pY="0" x="119" y="11"/>
|
||||
<SubTexture name="CyborgFolder-RightArm" width="10" height="19" cocos2d_pX="5" cocos2d_pY="4" x="16" y="89"/>
|
||||
<SubTexture name="CyborgFolder-RightHand" width="7" height="9" cocos2d_pX="3" cocos2d_pY="0" x="119" y="0"/>
|
||||
<SubTexture name="CyborgFolder-RightShoulder" width="14" height="19" cocos2d_pX="7" cocos2d_pY="5" x="0" y="89"/>
|
||||
<SubTexture name="CyborgFolder-RightShoulder" width="14" height="19" cocos2d_pX="7" cocos2d_pY="5" x="72" y="71"/>
|
||||
<SubTexture name="CyborgFolder-weapon4" width="101" height="23" cocos2d_pX="28" cocos2d_pY="13" x="0" y="0"/>
|
||||
<SubTexture name="CyborgFolder-weapon3" width="92" height="22" cocos2d_pX="23" cocos2d_pY="0" x="0" y="25"/>
|
||||
<SubTexture name="CyborgFolder-weapon2" width="91" height="20" cocos2d_pX="20" cocos2d_pY="14" x="0" y="49"/>
|
||||
<SubTexture name="CyborgFolder-weapon1" width="70" height="16" cocos2d_pX="27" cocos2d_pY="14" x="0" y="71"/>
|
||||
<SubTexture name="CyborgFolder-LeftShoulder" width="14" height="19" cocos2d_pX="7" cocos2d_pY="5" x="72" y="71"/>
|
||||
<SubTexture name="CyborgFolder-LeftArm" width="10" height="19" cocos2d_pX="5" cocos2d_pY="4" x="16" y="89"/>
|
||||
<SubTexture name="CyborgFolder-LeftHand" width="7" height="9" cocos2d_pX="3" cocos2d_pY="0" x="119" y="11"/>
|
||||
<SubTexture name="CyborgFolder-RightThigh" width="14" height="28" cocos2d_pX="7" cocos2d_pY="5" x="109" y="64"/>
|
||||
<SubTexture name="CyborgFolder-RightThigh" width="14" height="28" cocos2d_pX="7" cocos2d_pY="5" x="93" y="64"/>
|
||||
<SubTexture name="CyborgFolder-Head" width="32" height="18" cocos2d_pX="20" cocos2d_pY="18" x="94" y="44"/>
|
||||
<SubTexture name="CyborgFolder-Chest" width="18" height="9" cocos2d_pX="6" cocos2d_pY="7" x="40" y="89"/>
|
||||
<SubTexture name="CyborgFolder-Hip" width="4" height="4" cocos2d_pX="2" cocos2d_pY="2" x="119" y="22"/>
|
||||
<SubTexture name="CyborgFolder-Trunk" width="10" height="16" cocos2d_pX="3" cocos2d_pY="14" x="60" y="89"/>
|
||||
<SubTexture name="CyborgFolder-Leg" width="14" height="42" cocos2d_pX="7" cocos2d_pY="6" x="103" y="0"/>
|
||||
<SubTexture name="CyborgFolder-LeftThigh" width="14" height="28" cocos2d_pX="7" cocos2d_pY="5" x="93" y="64"/>
|
||||
<SubTexture name="CyborgFolder-LeftThigh" width="14" height="28" cocos2d_pX="7" cocos2d_pY="5" x="109" y="64"/>
|
||||
</TextureAtlas>
|
||||
</skeleton>
|
|
@ -1,287 +1,194 @@
|
|||
<skeleton name="Example03" frameRate="30" version="1.4">
|
||||
<skeleton name="Example03" frameRate="30" version="2.0">
|
||||
<armatures>
|
||||
<armature name="Knight_f/Knight">
|
||||
<b name="horseLegL2" parent="horseBody" x="-8" y="18" kX="0" kY="0" cX="1" cY="1" z="0">
|
||||
<b name="horseLegL2" parent="horseBody" x="-8" y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0">
|
||||
<d name="Knight_f-horse_leg"/>
|
||||
</b>
|
||||
<b name="horseLegL1" parent="horseBody" x="13" y="18" kX="0" kY="0" cX="1" cY="1" z="1">
|
||||
<b name="horseLegL1" parent="horseBody" x="13" y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="1">
|
||||
<d name="Knight_f-horse_leg"/>
|
||||
</b>
|
||||
<b name="horseLegR2" parent="horseBody" x="-14" y="18" kX="0" kY="0" cX="1" cY="1" z="2">
|
||||
<b name="horseLegR2" parent="horseBody" x="-14" y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="2">
|
||||
<d name="Knight_f-horse_leg"/>
|
||||
</b>
|
||||
<b name="horseLegR1" parent="horseBody" x="7" y="18" kX="0" kY="0" cX="1" cY="1" z="3">
|
||||
<b name="horseLegR1" parent="horseBody" x="7" y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="3">
|
||||
<d name="Knight_f-horse_leg"/>
|
||||
</b>
|
||||
<b name="horseBody" x="0" y="2" kX="0" kY="0" cX="1" cY="1" z="4">
|
||||
<b name="horseBody" x="0" y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4">
|
||||
<d name="Knight_f-horse_body"/>
|
||||
</b>
|
||||
<b name="horseTail" parent="horseBody" x="-20" y="4" kX="0" kY="0" cX="1" cY="1" z="5">
|
||||
<b name="horseTail" parent="horseBody" x="-20" y="4" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="5">
|
||||
<d name="Knight_f-horse_tail"/>
|
||||
</b>
|
||||
<b name="horseHead" parent="horseBody" x="20" y="2" kX="0" kY="0" cX="1" cY="1" z="6">
|
||||
<b name="horseHead" parent="horseBody" x="20" y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6">
|
||||
<d name="Knight_f-horse_head"/>
|
||||
</b>
|
||||
<b name="armL" parent="body" x="4.1" y="-12" kX="15" kY="15" cX="1" cY="1" z="7">
|
||||
<b name="armL" parent="body" x="4.1" y="-12" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="7">
|
||||
<d name="Knight_f-hero_arm"/>
|
||||
</b>
|
||||
<b name="body" parent="horseBody" x="0" y="0" kX="0" kY="0" cX="1" cY="1" z="8">
|
||||
<b name="body" parent="horseBody" x="0" y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8">
|
||||
<d name="Knight_f-hero_body"/>
|
||||
</b>
|
||||
<b name="leg" parent="body" x="-2" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9">
|
||||
<b name="leg" parent="body" x="-2" y="0" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9">
|
||||
<d name="Knight_f-hero_leg"/>
|
||||
</b>
|
||||
<b name="head" parent="body" x="0" y="-14" kX="0" kY="0" cX="1" cY="1" z="10">
|
||||
<b name="head" parent="body" x="0" y="-14" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="10">
|
||||
<d name="Knight_f-hero_head"/>
|
||||
</b>
|
||||
<b name="weapon" parent="armR" x="-10.05" y="3" kX="20" kY="20" cX="1" cY="1" z="11">
|
||||
<b name="weapon" parent="armR" x="-10.05" y="3" kX="20" kY="20" cX="1" cY="1" pX="0" pY="0" z="11">
|
||||
<d name="Knight_f-hero_sword"/>
|
||||
</b>
|
||||
<b name="armR" parent="body" x="-4" y="-12" kX="120" kY="120" cX="1" cY="1" z="12">
|
||||
<b name="armR" parent="body" x="-4" y="-12" kX="120" kY="120" cX="1" cY="1" pX="0" pY="0" z="12">
|
||||
<d name="Knight_f-hero_arm"/>
|
||||
</b>
|
||||
</armature>
|
||||
</armatures>
|
||||
<animations>
|
||||
<animation name="Knight_f/Knight">
|
||||
<mov name="stand" dr="2" to="6" drTW="49" lp="1" twE="2">
|
||||
<mov name="stand" dr="21" to="6" drTW="54" lp="1" twE="2">
|
||||
<b name="horseLegL2" sc="1" dl="0">
|
||||
<f x="-8" y="18" kX="0" kY="0" cX="1" cY="1" z="0" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="-8" y="18" kX="0" kY="0" cX="1" cY="1" z="0" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="-8" y="18" cocos2d_x="-8" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="-8" y="18" cocos2d_x="-8" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="-8" y="18" cocos2d_x="-8" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegL1" sc="1" dl="0">
|
||||
<f x="13" y="18" kX="0" kY="0" cX="1" cY="1" z="1" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="13" y="18" kX="0" kY="0" cX="1" cY="1" z="1" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="13" y="18" cocos2d_x="13" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="13" y="18" cocos2d_x="13" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="13" y="18" cocos2d_x="13" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegR2" sc="1" dl="0">
|
||||
<f x="-14" y="18" kX="0" kY="0" cX="1" cY="1" z="2" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="-14" y="18" kX="0" kY="0" cX="1" cY="1" z="2" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="-14" y="18" cocos2d_x="-14" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="-14" y="18" cocos2d_x="-14" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="-14" y="18" cocos2d_x="-14" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegR1" sc="1" dl="0">
|
||||
<f x="7" y="18" kX="0" kY="0" cX="1" cY="1" z="3" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="7" y="18" kX="0" kY="0" cX="1" cY="1" z="3" pX="4" pY="0" width="8" height="14" dI="0" dr="1"/>
|
||||
<f x="7" y="18" cocos2d_x="7" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="7" y="18" cocos2d_x="7" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="7" y="18" cocos2d_x="7" cocos2d_y="18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseBody" sc="1" dl="0">
|
||||
<f x="0" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="1"/>
|
||||
<f x="0" y="3" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="1"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="3" cocos2d_x="0" cocos2d_y="3" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseTail" sc="1" dl="0">
|
||||
<f x="-20" y="4" kX="0" kY="0" cX="1" cY="1" z="5" pX="6" pY="2" width="8" height="12" dI="0" dr="1"/>
|
||||
<f x="-20" y="4.95" kX="15" kY="15" cX="1" cY="1" z="5" pX="8.4" pY="3.5" width="11" height="14" dI="0" dr="1"/>
|
||||
<f x="-20" y="4" cocos2d_x="-20" cocos2d_y="4" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="-20" y="4.95" cocos2d_x="-20" cocos2d_y="4.95" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="-20" y="4" cocos2d_x="-20" cocos2d_y="4" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseHead" sc="1" dl="0">
|
||||
<f x="20" y="2" kX="0" kY="0" cX="1" cY="1" z="6" pX="2" pY="46" width="40" height="48" dI="0" dr="1"/>
|
||||
<f x="20.1" y="3" kX="5" kY="5" cX="1" cY="1" z="6" pX="2.15" pY="46" width="44" height="52" dI="0" dr="1"/>
|
||||
<f x="20" y="2" cocos2d_x="20" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="20.1" y="3" cocos2d_x="20.1" cocos2d_y="3" kX="5" kY="5" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="20" y="2" cocos2d_x="20" cocos2d_y="2" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="4.1" y="-12" kX="15" kY="15" cX="1" cY="1" z="7" pX="3.5" pY="4.35" width="22" height="15" dI="0" dr="1"/>
|
||||
<f x="4" y="-10.95" kX="24" kY="24" cX="1" cY="1" z="7" pX="4.3" pY="4.45" width="23" height="18" dI="0" dr="1"/>
|
||||
<f x="4.1" y="-12" cocos2d_x="4.1" cocos2d_y="-12" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="4" y="-10.95" cocos2d_x="4" cocos2d_y="-10.95" kX="24" kY="24" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="4.1" y="-12" cocos2d_x="4.1" cocos2d_y="-12" kX="15" kY="15" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="1"/>
|
||||
<f x="0" y="1" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="1"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="1" cocos2d_x="0" cocos2d_y="1" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="leg" sc="1" dl="0">
|
||||
<f x="-2" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="1"/>
|
||||
<f x="-2" y="1" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="1"/>
|
||||
<f x="-2" y="0" cocos2d_x="-2" cocos2d_y="0" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2" y="1" cocos2d_x="-2" cocos2d_y="1" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2" y="0" cocos2d_x="-2" cocos2d_y="0" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="0" y="-14" kX="0" kY="0" cX="1" cY="1" z="10" pX="22" pY="37.95" width="44" height="40" dI="0" dr="1"/>
|
||||
<f x="0" y="-11" kX="6" kY="6" cX="1" cY="1" z="10" pX="22.05" pY="40.05" width="48" height="44" dI="0" dr="1"/>
|
||||
<f x="0" y="-14" cocos2d_x="0" cocos2d_y="-14" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-11" cocos2d_x="0" cocos2d_y="-11" kX="6" kY="6" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-14" cocos2d_x="0" cocos2d_y="-14" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="weapon" sc="1" dl="0">
|
||||
<f x="-10.05" y="3" kX="20" kY="20" cX="1" cY="1" z="11" pX="14.55" pY="17.5" width="95" height="59" dI="0" dr="1"/>
|
||||
<f x="-14.1" y="1.05" kX="16" kY="16" cX="1" cY="1" z="11" pX="13.75" pY="17.15" width="95" height="54" dI="0" dr="1"/>
|
||||
<f x="-10.05" y="3" cocos2d_x="-10.05" cocos2d_y="3" kX="20" kY="20" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="10"/>
|
||||
<f x="-14.1" y="1.05" cocos2d_x="-14.1" cocos2d_y="1.05" kX="16" kY="16" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="10"/>
|
||||
<f x="-10.05" y="3" cocos2d_x="-10.05" cocos2d_y="3" kX="20" kY="20" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="-4" y="-12" kX="120" kY="120" cX="1" cY="1" z="12" pX="14.2" pY="4.75" width="19" height="23" dI="0" dr="1"/>
|
||||
<f x="-3.95" y="-11" kX="135" kY="135" cX="1" cY="1" z="12" pX="17" pY="5.65" width="22" height="22" dI="0" dr="1"/>
|
||||
<f x="-4" y="-12" cocos2d_x="-4" cocos2d_y="-12" kX="120" kY="120" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="10"/>
|
||||
<f x="-3.95" y="-11" cocos2d_x="-3.95" cocos2d_y="-11" kX="135" kY="135" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="10"/>
|
||||
<f x="-4" y="-12" cocos2d_x="-4" cocos2d_y="-12" kX="120" kY="120" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="run" dr="2" to="6" drTW="81" lp="1" twE="2">
|
||||
<mov name="run" dr="21" to="6" drTW="49" lp="1" twE="2">
|
||||
<b name="horseLegL2" sc="1" dl="0.1">
|
||||
<f x="-4.85" y="13.2" kX="64.3" kY="64.3" cX="1" cY="1" z="0" pX="14.35" pY="3.6" width="17" height="14" dI="0" dr="1"/>
|
||||
<f x="-8" y="18" kX="-45" kY="-45" cX="1" cY="1" z="0" pX="2.85" pY="2.85" width="16" height="16" dI="0" dr="1"/>
|
||||
<f x="-4.85" y="13.2" cocos2d_x="-4.85" cocos2d_y="13.2" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="-8" y="18" cocos2d_x="-8" cocos2d_y="18" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="10"/>
|
||||
<f x="-4.85" y="13.2" cocos2d_x="-4.85" cocos2d_y="13.2" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="0" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegL1" sc="1" dl="0.1">
|
||||
<f x="15.75" y="9.3" kX="-70.7" kY="-70.7" cX="1" cY="1" z="1" pX="1.3" pY="3.8" width="16" height="13" dI="0" dr="1"/>
|
||||
<f x="10.95" y="19.5" kX="52" kY="52" cX="1" cY="1" z="1" pX="13.5" pY="3.15" width="16" height="15" dI="0" dr="1"/>
|
||||
<f x="15.75" y="9.3" cocos2d_x="15.75" cocos2d_y="9.3" kX="-70.7" kY="-70.7" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="10.95" y="19.5" cocos2d_x="10.95" cocos2d_y="19.5" kX="52" kY="52" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="10"/>
|
||||
<f x="15.75" y="9.3" cocos2d_x="15.75" cocos2d_y="9.3" kX="-70.7" kY="-70.7" cX="1" cY="1" pX="0" pY="0" z="1" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegR2" sc="1" dl="0">
|
||||
<f x="-10.7" y="14.35" kX="64.3" kY="64.3" cX="1" cY="1" z="2" pX="14.35" pY="3.6" width="17" height="14" dI="0" dr="1"/>
|
||||
<f x="-15.85" y="16.2" kX="-38" kY="-38" cX="1" cY="1" z="2" pX="3.15" pY="2.45" width="15" height="16" dI="0" dr="1"/>
|
||||
<f x="-10.7" y="14.35" cocos2d_x="-10.7" cocos2d_y="14.35" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="-15.85" y="16.2" cocos2d_x="-15.85" cocos2d_y="16.2" kX="-38" kY="-38" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="10"/>
|
||||
<f x="-10.7" y="14.35" cocos2d_x="-10.7" cocos2d_y="14.35" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="2" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseLegR1" sc="1" dl="0">
|
||||
<f x="9.9" y="10.45" kX="-70.7" kY="-70.7" cX="1" cY="1" z="3" pX="1.3" pY="3.8" width="16" height="13" dI="0" dr="1"/>
|
||||
<f x="5" y="18.75" kX="52" kY="52" cX="1" cY="1" z="3" pX="13.5" pY="3.15" width="16" height="15" dI="0" dr="1"/>
|
||||
<f x="9.9" y="10.45" cocos2d_x="9.9" cocos2d_y="10.45" kX="-70.7" kY="-70.7" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="5" y="18.75" cocos2d_x="5" cocos2d_y="18.75" kX="52" kY="52" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="10"/>
|
||||
<f x="9.9" y="10.45" cocos2d_x="9.9" cocos2d_y="10.45" kX="-70.7" kY="-70.7" cX="1" cY="1" pX="0" pY="0" z="3" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseBody" sc="1" dl="0">
|
||||
<f x="0" y="-4" kX="-10.7" kY="-10.7" cX="1" cY="1" z="4" pX="20" pY="5.65" width="43" height="28" dI="0" dr="1"/>
|
||||
<f x="0" y="2" kX="6.99" kY="6.99" cX="1" cY="1" z="4" pX="22.05" pY="4.45" width="43" height="25" dI="0" dr="1"/>
|
||||
<f x="0" y="-4" cocos2d_x="0" cocos2d_y="-4" kX="-10.7" kY="-10.7" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="2" cocos2d_x="0" cocos2d_y="2" kX="6.99" kY="6.99" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-4" cocos2d_x="0" cocos2d_y="-4" kX="-10.7" kY="-10.7" cX="1" cY="1" pX="0" pY="0" z="4" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseTail" sc="1" dl="0">
|
||||
<f x="-19.25" y="1.7" kX="64.3" kY="64.3" cX="1" cY="1" z="5" pX="11.6" pY="6.25" width="15" height="13" dI="0" dr="1"/>
|
||||
<f x="-20.1" y="1.55" kX="0" kY="0" cX="1" cY="1" z="5" pX="6" pY="2" width="8" height="12" dI="0" dr="1"/>
|
||||
<f x="-19.25" y="1.7" cocos2d_x="-19.25" cocos2d_y="1.7" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="-20.1" y="1.55" cocos2d_x="-20.1" cocos2d_y="1.55" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="10"/>
|
||||
<f x="-19.25" y="1.7" cocos2d_x="-19.25" cocos2d_y="1.7" kX="64.3" kY="64.3" cX="1" cY="1" pX="0" pY="0" z="5" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="horseHead" sc="1" dl="0.15">
|
||||
<f x="19.65" y="-7.75" kX="-20" kY="-20" cX="1" cY="1" z="6" pX="17.65" pY="56.2" width="55" height="59" dI="0" dr="1"/>
|
||||
<f x="19.85" y="4.45" kX="27" kY="27" cX="1" cY="1" z="6" pX="2.7" pY="41.9" width="58" height="61" dI="0" dr="1"/>
|
||||
<f x="19.65" y="-7.75" cocos2d_x="19.65" cocos2d_y="-7.75" kX="-20" kY="-20" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="19.85" y="4.45" cocos2d_x="19.85" cocos2d_y="4.45" kX="27" kY="27" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="10"/>
|
||||
<f x="19.65" y="-7.75" cocos2d_x="19.65" cocos2d_y="-7.75" kX="-20" kY="-20" cX="1" cY="1" pX="0" pY="0" z="6" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="4.1" y="-18" kX="0" kY="0" cX="1" cY="1" z="7" pX="2" pY="4" width="20" height="10" dI="0" dr="1"/>
|
||||
<f x="4.1" y="-12" kX="30" kY="30" cX="1" cY="1" z="7" pX="4.75" pY="4.45" width="23" height="19" dI="0" dr="1"/>
|
||||
<f x="4.1" y="-18" cocos2d_x="4.1" cocos2d_y="-18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="4.1" y="-12" cocos2d_x="4.1" cocos2d_y="-12" kX="30" kY="30" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="10"/>
|
||||
<f x="4.1" y="-18" cocos2d_x="4.1" cocos2d_y="-18" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="7" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="0" y="-6" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="1"/>
|
||||
<f x="0" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="1"/>
|
||||
<f x="0" y="-6" cocos2d_x="0" cocos2d_y="-6" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="0" cocos2d_x="0" cocos2d_y="0" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-6" cocos2d_x="0" cocos2d_y="-6" kX="0" kY="0" cX="1" cY="1" pX="0" pY="0" z="8" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="leg" sc="1" dl="0">
|
||||
<f x="-2" y="-6" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="1"/>
|
||||
<f x="-2" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="1"/>
|
||||
<f x="-2" y="-6" cocos2d_x="-2" cocos2d_y="-6" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2" y="0" cocos2d_x="-2" cocos2d_y="0" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="10"/>
|
||||
<f x="-2" y="-6" cocos2d_x="-2" cocos2d_y="-6" kX="-45" kY="-45" cX="1" cY="1" pX="0" pY="0" z="9" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="0" y="-20" kX="-10" kY="-10" cX="1" cY="1" z="10" pX="28.25" pY="41.15" width="51" height="47" dI="0" dr="1"/>
|
||||
<f x="0" y="-12" kX="10" kY="10" cX="1" cY="1" z="10" pX="21.9" pY="41.15" width="51" height="47" dI="0" dr="1"/>
|
||||
<f x="0" y="-20" cocos2d_x="0" cocos2d_y="-20" kX="-10" kY="-10" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-12" cocos2d_x="0" cocos2d_y="-12" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="10"/>
|
||||
<f x="0" y="-20" cocos2d_x="0" cocos2d_y="-20" kX="-10" kY="-10" cX="1" cY="1" pX="0" pY="0" z="10" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="weapon" sc="1" dl="0.4">
|
||||
<f x="-5.05" y="-2" kX="10" kY="10" cX="1" cY="1" z="11" pX="12.45" pY="16.5" width="94" height="46" dI="0" dr="1"/>
|
||||
<f x="-10.85" y="2.05" kX="20" kY="20" cX="1" cY="1" z="11" pX="14.55" pY="17.5" width="95" height="59" dI="0" dr="1"/>
|
||||
<f x="-5.05" y="-2" cocos2d_x="-5.05" cocos2d_y="-2" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="10"/>
|
||||
<f x="-10.85" y="2.05" cocos2d_x="-10.85" cocos2d_y="2.05" kX="20" kY="20" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="10"/>
|
||||
<f x="-5.05" y="-2" cocos2d_x="-5.05" cocos2d_y="-2" kX="10" kY="10" cX="1" cY="1" pX="0" pY="0" z="11" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="-4" y="-18" kX="100" kY="100" cX="1" cY="1" z="12" pX="9.05" pY="3" width="14" height="22" dI="0" dr="1"/>
|
||||
<f x="-4" y="-12" kX="119.86" kY="119.85" cX="1" cY="1" z="12" pX="14.15" pY="4.75" width="19" height="23" dI="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
<mov name="attack" dr="29" to="6" drTW="50" lp="1" twE="NaN">
|
||||
<b name="horseLegL2" sc="1" dl="0">
|
||||
<f x="-13.6" y="19.5" kX="-45" kY="-45" cX="1" cY="1" z="0" pX="2.85" pY="2.85" width="16" height="16" dI="0" dr="5"/>
|
||||
<f x="-5" y="18" kX="30" kY="30" cX="1" cY="1" z="0" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="-9" y="18" kX="-15" kY="-15" cX="1" cY="1" z="0" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="5"/>
|
||||
<f x="-5" y="18" kX="30" kY="30" cX="1" cY="1" z="0" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="-8" y="18" kX="0" kY="0" cX="1" cY="1" z="0" pX="4" pY="0" width="8" height="14" dI="0" dr="6"/>
|
||||
<f x="-8" y="18" kX="30" kY="30" cX="1" cY="1" z="0" pX="10.45" pY="2" width="14" height="17" dI="0" dr="3"/>
|
||||
<f x="-10" y="18" kX="0" kY="0" cX="1" cY="1" z="0" pX="4" pY="0" width="8" height="14" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseLegL1" sc="1" dl="0">
|
||||
<f x="6.7" y="14.1" kX="-60" kY="-60" cX="1" cY="1" z="1" pX="2" pY="3.45" width="17" height="14" dI="0" dr="5"/>
|
||||
<f x="16" y="18" kX="30" kY="30" cX="1" cY="1" z="1" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="12" y="18" kX="-15" kY="-15" cX="1" cY="1" z="1" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="5"/>
|
||||
<f x="16" y="18" kX="30" kY="30" cX="1" cY="1" z="1" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="13" y="18" kX="0" kY="0" cX="1" cY="1" z="1" pX="4" pY="0" width="8" height="14" dI="0" dr="6"/>
|
||||
<f x="13" y="18" kX="30" kY="30" cX="1" cY="1" z="1" pX="10.45" pY="2" width="14" height="17" dI="0" dr="3"/>
|
||||
<f x="11" y="18" kX="-15" kY="-15" cX="1" cY="1" z="1" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseLegR2" sc="1" dl="0">
|
||||
<f x="-19.35" y="21.05" kX="-45" kY="-45" cX="1" cY="1" z="2" pX="2.85" pY="2.85" width="16" height="16" dI="0" dr="5"/>
|
||||
<f x="-11" y="18" kX="30" kY="30" cX="1" cY="1" z="2" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="-15" y="18" kX="-15" kY="-15" cX="1" cY="1" z="2" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="5"/>
|
||||
<f x="-11" y="18" kX="30" kY="30" cX="1" cY="1" z="2" pX="10.45" pY="2" width="14" height="17" dI="0" dr="2"/>
|
||||
<f x="-14" y="18" kX="15" kY="15" cX="1" cY="1" z="2" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="6"/>
|
||||
<f x="-14" y="18" kX="15" kY="15" cX="1" cY="1" z="2" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="3"/>
|
||||
<f x="-16" y="18" kX="-15" kY="-15" cX="1" cY="1" z="2" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseLegR1" sc="1" dl="0">
|
||||
<f x="0.9" y="15.65" kX="-45" kY="-45" cX="1" cY="1" z="3" pX="2.85" pY="2.85" width="16" height="16" dI="0" dr="5"/>
|
||||
<f x="10" y="18" kX="15" kY="15" cX="1" cY="1" z="3" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="2"/>
|
||||
<f x="6" y="18" kX="-15" kY="-15" cX="1" cY="1" z="3" pX="3.85" pY="1.05" width="12" height="16" dI="0" dr="5"/>
|
||||
<f x="10" y="18" kX="15" kY="15" cX="1" cY="1" z="3" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="2"/>
|
||||
<f x="7" y="18" kX="15" kY="15" cX="1" cY="1" z="3" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="6"/>
|
||||
<f x="7" y="18" kX="15" kY="15" cX="1" cY="1" z="3" pX="7.45" pY="1.05" width="12" height="16" dI="0" dr="3"/>
|
||||
<f x="5" y="18" kX="-30" kY="-30" cX="1" cY="1" z="3" pX="3.45" pY="2" width="14" height="17" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseBody" sc="1" dl="0">
|
||||
<f x="-10" y="2" kX="-15" kY="-15" cX="1" cY="1" z="4" pX="19.8" pY="7.15" width="44" height="30" dI="0" dr="5"/>
|
||||
<f x="3" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="2"/>
|
||||
<f x="-1" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="5"/>
|
||||
<f x="3" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="2"/>
|
||||
<f x="0" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="6"/>
|
||||
<f x="0" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="3"/>
|
||||
<f x="-2" y="2" kX="0" kY="0" cX="1" cY="1" z="4" pX="20" pY="2" width="40" height="20" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseTail" sc="1" dl="0">
|
||||
<f x="-28.75" y="9.1" kX="15" kY="15" cX="1" cY="1" z="5" pX="8.4" pY="3.5" width="11" height="14" dI="0" dr="5"/>
|
||||
<f x="-17" y="4" kX="0" kY="0" cX="1" cY="1" z="5" pX="6" pY="2" width="8" height="12" dI="0" dr="2"/>
|
||||
<f x="-21" y="4" kX="30" kY="30" cX="1" cY="1" z="5" pX="10.2" pY="4.75" width="13" height="15" dI="0" dr="5"/>
|
||||
<f x="-17" y="4" kX="0" kY="0" cX="1" cY="1" z="5" pX="6" pY="2" width="8" height="12" dI="0" dr="2"/>
|
||||
<f x="-20" y="4" kX="15" kY="15" cX="1" cY="1" z="5" pX="8.4" pY="3.5" width="11" height="14" dI="0" dr="6"/>
|
||||
<f x="-20" y="4" kX="0" kY="0" cX="1" cY="1" z="5" pX="6" pY="2" width="8" height="12" dI="0" dr="3"/>
|
||||
<f x="-22" y="4" kX="-30" kY="-30" cX="1" cY="1" z="5" pX="6.2" pY="2.75" width="13" height="15" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="horseHead" sc="1" dl="0">
|
||||
<f x="9.3" y="-3.2" kX="0" kY="0" cX="1" cY="1" z="6" pX="2" pY="46" width="40" height="48" dI="0" dr="5"/>
|
||||
<f x="23" y="2" kX="15" kY="15" cX="1" cY="1" z="6" pX="2.45" pY="44.95" width="52" height="57" dI="0" dr="2"/>
|
||||
<f x="19" y="2" kX="10.7" kY="10.7" cX="1" cY="1" z="6" pX="2.3" pY="45.55" width="49" height="55" dI="0" dr="5"/>
|
||||
<f x="23" y="2" kX="4.31" kY="4.31" cX="1" cY="1" z="6" pX="2.15" pY="46" width="44" height="51" dI="0" dr="2"/>
|
||||
<f x="20" y="2" kX="13.79" kY="13.79" cX="1" cY="1" z="6" pX="2.45" pY="45.2" width="51" height="57" dI="0" dr="6"/>
|
||||
<f x="20" y="2" kX="-4.69" kY="-4.69" cX="1" cY="1" z="6" pX="5.75" pY="48.95" width="44" height="52" dI="0" dr="3"/>
|
||||
<f x="18" y="2" kX="10.31" kY="10.31" cX="1" cY="1" z="6" pX="2.3" pY="45.6" width="48" height="55" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="armL" sc="1" dl="0">
|
||||
<f x="-9.65" y="-12.6" kX="0" kY="0" cX="1" cY="1" z="7" pX="2" pY="4" width="20" height="10" dI="0" dr="5"/>
|
||||
<f x="7.1" y="-12" kX="30" kY="30" cX="1" cY="1" z="7" pX="4.75" pY="4.45" width="23" height="19" dI="0" dr="2"/>
|
||||
<f x="5.45" y="-10.9" kX="26.72" kY="26.72" cX="1" cY="1" z="7" pX="4.5" pY="4.45" width="23" height="18" dI="0" dr="5"/>
|
||||
<f x="7.1" y="-12" kX="15" kY="15" cX="1" cY="1" z="7" pX="3.5" pY="4.35" width="22" height="15" dI="0" dr="2"/>
|
||||
<f x="4.1" y="-12" kX="-60" kY="-60" cX="1" cY="1" z="7" pX="4.45" pY="17.6" width="19" height="23" dI="0" dr="6"/>
|
||||
<f x="4.1" y="-12" kX="30" kY="30" cX="1" cY="1" z="7" pX="4.75" pY="4.45" width="23" height="19" dI="0" dr="3"/>
|
||||
<f x="2.1" y="-12" kX="30" kY="30" cX="1" cY="1" z="7" pX="4.75" pY="4.45" width="23" height="19" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="body" sc="1" dl="0">
|
||||
<f x="-10.5" y="0.05" kX="-15" kY="-15" cX="1" cY="1" z="8" pX="10.35" pY="15.3" width="18" height="20" dI="0" dr="5"/>
|
||||
<f x="3" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="2"/>
|
||||
<f x="-1" y="0" kX="11.72" kY="11.72" cX="1" cY="1" z="8" pX="7.25" pY="15.1" width="17" height="19" dI="0" dr="5"/>
|
||||
<f x="3" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="2"/>
|
||||
<f x="0" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="6"/>
|
||||
<f x="0" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="3"/>
|
||||
<f x="-2" y="0" kX="0" kY="0" cX="1" cY="1" z="8" pX="7" pY="14" width="14" height="16" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="leg" sc="1" dl="0">
|
||||
<f x="-12.45" y="0.55" kX="-60" kY="-60" cX="1" cY="1" z="9" pX="2" pY="3.45" width="18" height="15" dI="0" dr="5"/>
|
||||
<f x="1" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="2"/>
|
||||
<f x="-3" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="5"/>
|
||||
<f x="1" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="2"/>
|
||||
<f x="-2" y="0" kX="-45" kY="-45" cX="1" cY="1" z="9" pX="2.85" pY="2.85" width="17" height="17" dI="0" dr="6"/>
|
||||
<f x="-2" y="0" kX="-15" kY="-15" cX="1" cY="1" z="9" pX="3.85" pY="1.05" width="12" height="18" dI="0" dr="3"/>
|
||||
<f x="-4" y="0" kX="-15" kY="-15" cX="1" cY="1" z="9" pX="3.85" pY="1.05" width="12" height="18" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="head" sc="1" dl="0">
|
||||
<f x="-14.1" y="-13.45" kX="0" kY="0" cX="1" cY="1" z="10" pX="22" pY="37.95" width="44" height="40" dI="0" dr="5"/>
|
||||
<f x="3" y="-14" kX="15" kY="15" cX="1" cY="1" z="10" pX="21.65" pY="42.35" width="53" height="50" dI="0" dr="2"/>
|
||||
<f x="1.85" y="-13.7" kX="3.99" kY="3.99" cX="1" cY="1" z="10" pX="22.05" pY="39.4" width="47" height="43" dI="0" dr="5"/>
|
||||
<f x="3" y="-14" kX="-15" kY="-15" cX="1" cY="1" z="10" pX="31.05" pY="42.35" width="53" height="50" dI="0" dr="2"/>
|
||||
<f x="0" y="-14" kX="0" kY="0" cX="1" cY="1" z="10" pX="22" pY="37.95" width="44" height="40" dI="0" dr="6"/>
|
||||
<f x="0" y="-14" kX="9.25" kY="9.25" cX="1" cY="1" z="10" pX="21.95" pY="41" width="50" height="47" dI="0" dr="3"/>
|
||||
<f x="-2" y="-14" kX="-5.75" kY="-5.75" cX="1" cY="1" z="10" pX="25.7" pY="39.95" width="48" height="44" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="weapon" sc="1" dl="0">
|
||||
<f x="-13.3" y="-25.9" kX="-145" kY="-145" cX="1" cY="1" z="11" pX="74.15" pY="58.2" width="91" height="77" dI="0" dr="5"/>
|
||||
<f x="-14" y="-2" kX="80" kY="80" cX="1" cY="1" z="11" pX="16.5" pY="12.45" width="46" height="94" dI="0" dr="2"/>
|
||||
<f x="-0.05" y="3" kX="105" kY="105" cX="1" cY="1" z="11" pX="35.2" pY="13.55" width="53" height="95" dI="0" dr="5"/>
|
||||
<f x="13.75" y="-17" kX="-60" kY="-60" cX="1" cY="1" z="11" pX="18" pY="76.8" width="71" height="93" dI="0" dr="2"/>
|
||||
<f x="8.75" y="-21" kX="-91.03" kY="-91.03" cX="1" cY="1" z="11" pX="16.45" pY="80.25" width="32" height="91" dI="0" dr="6"/>
|
||||
<f x="-17.65" y="-5.5" kX="150" kY="150" cX="1" cY="1" z="11" pX="76.8" pY="18" width="93" height="71" dI="0" dr="3"/>
|
||||
<f x="-20.65" y="-5.5" kX="159.23" kY="159.23" cX="1" cY="1" z="11" pX="80.1" pY="17.55" width="95" height="60" dI="0" dr="6"/>
|
||||
</b>
|
||||
<b name="armR" sc="1" dl="0">
|
||||
<f x="-17.45" y="-10.5" kX="-66.27" kY="-66.27" cX="1" cY="1" z="12" pX="4.45" pY="18.1" width="18" height="23" dI="0" dr="5"/>
|
||||
<f x="-1" y="-12" kX="150" kY="150" cX="1" cY="1" z="12" pX="18.6" pY="6.2" width="23" height="19" dI="0" dr="2"/>
|
||||
<f x="-2.45" y="-12.55" kX="86.72" kY="86.72" cX="1" cY="1" z="12" pX="6.1" pY="2.25" width="12" height="21" dI="0" dr="5"/>
|
||||
<f x="-1" y="-12" kX="-12" kY="-12" cX="1" cY="1" z="12" pX="2.8" pY="7.65" width="22" height="14" dI="0" dr="2"/>
|
||||
<f x="-4" y="-12" kX="-27" kY="-27" cX="1" cY="1" z="12" pX="3.6" pY="11.7" width="23" height="18" dI="0" dr="6"/>
|
||||
<f x="-4" y="-12" kX="160" kY="160" cX="1" cY="1" z="12" pX="18.95" pY="6.35" width="23" height="17" dI="0" dr="3"/>
|
||||
<f x="-7" y="-12" kX="160" kY="160" cX="1" cY="1" z="12" pX="18.95" pY="6.35" width="23" height="17" dI="0" dr="6"/>
|
||||
<f x="-4" y="-18" cocos2d_x="-4" cocos2d_y="-18" kX="100" kY="100" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="10"/>
|
||||
<f x="-4" y="-12" cocos2d_x="-4" cocos2d_y="-12" kX="119.86" kY="119.85" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="10"/>
|
||||
<f x="-4" y="-18" cocos2d_x="-4" cocos2d_y="-18" kX="100" kY="100" cX="1" cY="1" pX="0" pY="0" z="12" dI="0" twE="0" dr="1"/>
|
||||
</b>
|
||||
</mov>
|
||||
</animation>
|
||||
</animations>
|
||||
<TextureAtlas name="Example03" width="512" height="64">
|
||||
<SubTexture name="Knight_f-hero_sword" pX="10" pY="15" width="90" height="30" x="0" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_head" pX="22" pY="37.95" width="44" height="40" x="134" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_leg" pX="4" pY="0" width="8" height="16" x="260" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_body" pX="7" pY="14" width="14" height="16" x="244" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_arm" pX="2" pY="4" width="20" height="10" x="222" y="0"/>
|
||||
<SubTexture name="Knight_f-horse_head" pX="2" pY="46" width="40" height="48" x="92" y="0"/>
|
||||
<SubTexture name="Knight_f-horse_tail" pX="6" pY="2" width="8" height="12" x="280" y="0"/>
|
||||
<SubTexture name="Knight_f-horse_body" pX="20" pY="2" width="40" height="20" x="180" y="0"/>
|
||||
<SubTexture name="Knight_f-horse_leg" pX="4" pY="0" width="8" height="14" x="270" y="0"/>
|
||||
<TextureAtlas name="Example03" width="128" height="128">
|
||||
<SubTexture name="Knight_f-hero_sword" width="90" height="30" cocos2d_pX="10" cocos2d_pY="15" x="0" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_head" width="44" height="40" cocos2d_pX="22.25" cocos2d_pY="39.05" x="42" y="32"/>
|
||||
<SubTexture name="Knight_f-hero_leg" width="8" height="16" cocos2d_pX="4" cocos2d_pY="0" x="114" y="0"/>
|
||||
<SubTexture name="Knight_f-hero_body" width="14" height="16" cocos2d_pX="7" cocos2d_pY="14" x="92" y="12"/>
|
||||
<SubTexture name="Knight_f-hero_arm" width="20" height="10" cocos2d_pX="2" cocos2d_pY="4" x="92" y="0"/>
|
||||
<SubTexture name="Knight_f-horse_head" width="40" height="45" cocos2d_pX="1.95" cocos2d_pY="45.95" x="0" y="32"/>
|
||||
<SubTexture name="Knight_f-horse_tail" width="8" height="12" cocos2d_pX="6" cocos2d_pY="2" x="118" y="18"/>
|
||||
<SubTexture name="Knight_f-horse_body" width="40" height="20" cocos2d_pX="20" cocos2d_pY="2" x="42" y="74"/>
|
||||
<SubTexture name="Knight_f-horse_leg" width="8" height="14" cocos2d_pX="4" cocos2d_pY="0" x="108" y="18"/>
|
||||
</TextureAtlas>
|
||||
</skeleton>
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue