Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into Merge_GUI_to_Develop

This commit is contained in:
CaiWenzhi 2013-09-16 20:55:55 +08:00
commit 759fcc147b
69 changed files with 5873 additions and 7042 deletions

View File

@ -1 +1 @@
82031186c5a74b94209ee517854294f4a1b672bc fad913317d2e64eb308c7066f450f3a351ee0aab

View File

@ -285,8 +285,6 @@ void EGLViewEventHandler::OnGLFWError(int errorID, const char* errorDesc)
void EGLViewEventHandler::OnGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify) void EGLViewEventHandler::OnGLFWMouseCallBack(GLFWwindow* window, int button, int action, int modify)
{ {
static int countxxx = 0;
CCLOG("OnGLFWMouseCallBack = %d", ++countxxx);
EGLView* eglView = EGLView::getInstance(); EGLView* eglView = EGLView::getInstance();
if(nullptr == eglView) return; if(nullptr == eglView) return;
if(GLFW_MOUSE_BUTTON_LEFT == button) if(GLFW_MOUSE_BUTTON_LEFT == button)
@ -314,8 +312,6 @@ void EGLViewEventHandler::OnGLFWMouseCallBack(GLFWwindow* window, int button, in
void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y) void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, double y)
{ {
static int countxxx = 0;
CCLOG("OnGLFWMouseMoveCallBack = %d, %lf, %lf", ++countxxx, x, y);
s_mouseX = (float)x; s_mouseX = (float)x;
s_mouseY = (float)y; s_mouseY = (float)y;
EGLView* eglView = EGLView::getInstance(); EGLView* eglView = EGLView::getInstance();

View File

@ -41,12 +41,9 @@ CocoStudio/Armature/display/CCBatchNode.cpp \
CocoStudio/Armature/display/CCDecorativeDisplay.cpp \ CocoStudio/Armature/display/CCDecorativeDisplay.cpp \
CocoStudio/Armature/display/CCDisplayFactory.cpp \ CocoStudio/Armature/display/CCDisplayFactory.cpp \
CocoStudio/Armature/display/CCDisplayManager.cpp \ CocoStudio/Armature/display/CCDisplayManager.cpp \
CocoStudio/Armature/display/CCShaderNode.cpp \
CocoStudio/Armature/display/CCSkin.cpp \ CocoStudio/Armature/display/CCSkin.cpp \
CocoStudio/Armature/external_tool/CCTexture2DMutable.cpp \
CocoStudio/Armature/external_tool/GLES-Render.cpp \
CocoStudio/Armature/physics/CCColliderDetector.cpp \ CocoStudio/Armature/physics/CCColliderDetector.cpp \
CocoStudio/Armature/physics/CCPhysicsWorld.cpp \ CocoStudio/Armature/utils/CCArmatureDefine.cpp \
CocoStudio/Armature/utils/CCArmatureDataManager.cpp \ CocoStudio/Armature/utils/CCArmatureDataManager.cpp \
CocoStudio/Armature/utils/CCDataReaderHelper.cpp \ CocoStudio/Armature/utils/CCDataReaderHelper.cpp \
CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.cpp \ CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.cpp \

View File

@ -29,9 +29,14 @@ THE SOFTWARE.
#include "datas/CCDatas.h" #include "datas/CCDatas.h"
#include "display/CCSkin.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;
NS_CC_EXT_ARMATURE_BEGIN
Armature *Armature::create() Armature *Armature::create()
{ {
@ -46,10 +51,10 @@ Armature *Armature::create()
} }
Armature *Armature::create(const char *_name) Armature *Armature::create(const char *name)
{ {
Armature *armature = new Armature(); Armature *armature = new Armature();
if (armature && armature->init(_name)) if (armature && armature->init(name))
{ {
armature->autorelease(); armature->autorelease();
return armature; return armature;
@ -71,25 +76,24 @@ Armature *Armature::create(const char *name, Bone *parentBone)
} }
Armature::Armature() Armature::Armature()
: _animation(NULL) : _armatureData(NULL)
, _armatureData(NULL) , _batchNode(NULL)
, _batchNode(NULL)
, _atlas(NULL) , _atlas(NULL)
, _parentBone(NULL) , _parentBone(NULL)
, _boneDic(NULL) , _armatureTransformDirty(true)
, _boneDic(NULL)
, _topBoneList(NULL) , _topBoneList(NULL)
, _animation(NULL)
{ {
} }
Armature::~Armature(void) Armature::~Armature(void)
{ {
CCLOGINFO("deallocing Armature: %p", this);
if(NULL != _boneDic) if(NULL != _boneDic)
{ {
_boneDic->removeAllObjects(); _boneDic->removeAllObjects();
CC_SAFE_RELEASE(_boneDic); CC_SAFE_DELETE(_boneDic);
} }
if (NULL != _topBoneList) if (NULL != _topBoneList)
{ {
@ -117,26 +121,28 @@ bool Armature::init(const char *name)
_animation = new ArmatureAnimation(); _animation = new ArmatureAnimation();
_animation->init(this); _animation->init(this);
CC_SAFE_RELEASE(_boneDic); CC_SAFE_DELETE(_boneDic);
_boneDic = new Dictionary(); _boneDic = new Dictionary();
_boneDic->init();
CC_SAFE_DELETE(_topBoneList); CC_SAFE_DELETE(_topBoneList);
_topBoneList = Array::create(); _topBoneList = new Array();
_topBoneList->retain(); _topBoneList->init();
_blendFunc.src = CC_BLEND_SRC;
_blendFunc.dst = CC_BLEND_DST;
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
_name = name == NULL ? "" : name; _name = name == NULL ? "" : name;
ArmatureDataManager *armatureDataManager = ArmatureDataManager::sharedArmatureDataManager(); ArmatureDataManager *armatureDataManager = ArmatureDataManager::getInstance();
if(_name.length() != 0) if(_name.length() != 0)
{ {
_name = name; _name = name;
AnimationData *animationData = armatureDataManager->getAnimationData(name); AnimationData *animationData = armatureDataManager->getAnimationData(name);
CCASSERT(animationData, "CCAnimationData not exist! "); CCASSERT(animationData, "AnimationData not exist! ");
_animation->setAnimationData(animationData); _animation->setAnimationData(animationData);
@ -148,7 +154,7 @@ bool Armature::init(const char *name)
DictElement *_element = NULL; DictElement *_element = NULL;
Dictionary *boneDataDic = armatureData->boneDataDic; Dictionary *boneDataDic = &armatureData->boneDataDic;
CCDICT_FOREACH(boneDataDic, _element) CCDICT_FOREACH(boneDataDic, _element)
{ {
Bone *bone = createBone(_element->getStrKey()); Bone *bone = createBone(_element->getStrKey());
@ -161,7 +167,7 @@ bool Armature::init(const char *name)
CC_BREAK_IF(!movData); CC_BREAK_IF(!movData);
MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str()); MovementBoneData *movBoneData = movData->getMovementBoneData(bone->getName().c_str());
CC_BREAK_IF(!movBoneData || movBoneData->frameList->count() <= 0); CC_BREAK_IF(!movBoneData || movBoneData->frameList.count() <= 0);
FrameData *frameData = movBoneData->getFrameData(0); FrameData *frameData = movBoneData->getFrameData(0);
CC_BREAK_IF(!frameData); CC_BREAK_IF(!frameData);
@ -191,7 +197,7 @@ bool Armature::init(const char *name)
} }
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
unscheduleUpdate(); unscheduleUpdate();
scheduleUpdate(); scheduleUpdate();
@ -294,9 +300,9 @@ void Armature::removeBone(Bone *bone, bool recursion)
} }
Bone *Armature::getBone(const char *_name) const Bone *Armature::getBone(const char *name) const
{ {
return (Bone *)_boneDic->objectForKey(_name); return (Bone *)_boneDic->objectForKey(name);
} }
@ -304,8 +310,11 @@ void Armature::changeBoneParent(Bone *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); if(bone->getParentBone())
bone->setParentBone(NULL); {
bone->getParentBone()->getChildren()->removeObject(bone);
bone->setParentBone(NULL);
}
if (parentName != NULL) if (parentName != NULL)
{ {
@ -314,6 +323,14 @@ void Armature::changeBoneParent(Bone *bone, const char *parentName)
if (boneParent) if (boneParent)
{ {
boneParent->addChildBone(bone); boneParent->addChildBone(bone);
if (_topBoneList->containsObject(bone))
{
_topBoneList->removeObject(bone);
}
}
else
{
_topBoneList->addObject(bone);
} }
} }
} }
@ -327,6 +344,8 @@ const AffineTransform& Armature::getNodeToParentTransform() const
{ {
if (_transformDirty) if (_transformDirty)
{ {
_armatureTransformDirty = true;
// Translate values // Translate values
float x = _position.x; float x = _position.x;
float y = _position.y; float y = _position.y;
@ -407,9 +426,26 @@ void Armature::updateOffsetPoint()
Rect rect = getBoundingBox(); Rect rect = getBoundingBox();
setContentSize(rect.size); setContentSize(rect.size);
_offsetPoint = Point(-rect.origin.x, -rect.origin.y); _offsetPoint = Point(-rect.origin.x, -rect.origin.y);
setAnchorPoint(Point(_offsetPoint.x / rect.size.width, _offsetPoint.y / rect.size.height)); if (rect.size.width != 0 && rect.size.height != 0)
{
setAnchorPoint(Point(_offsetPoint.x / rect.size.width, _offsetPoint.y / rect.size.height));
}
} }
void Armature::setAnimation(ArmatureAnimation *animation)
{
_animation = animation;
}
ArmatureAnimation *Armature::getAnimation()
{
return _animation;
}
bool Armature::getArmatureTransformDirty()
{
return _armatureTransformDirty;
}
void Armature::update(float dt) void Armature::update(float dt)
{ {
@ -420,6 +456,8 @@ void Armature::update(float dt)
{ {
static_cast<Bone*>(object)->update(dt); static_cast<Bone*>(object)->update(dt);
} }
_armatureTransformDirty = false;
} }
void Armature::draw() void Armature::draw()
@ -433,47 +471,78 @@ void Armature::draw()
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_children, object) CCARRAY_FOREACH(_children, object)
{ {
Bone *bone = static_cast<Bone *>(object); if (Bone *bone = dynamic_cast<Bone *>(object))
DisplayManager *displayManager = bone->getDisplayManager();
Node *node = displayManager->getDisplayRenderNode();
if (NULL == node)
continue;
if(Skin *skin = dynamic_cast<Skin *>(node))
{ {
TextureAtlas *textureAtlas = skin->getTextureAtlas(); DisplayManager *displayManager = bone->getDisplayManager();
if(_atlas != textureAtlas) Node *node = displayManager->getDisplayRenderNode();
if (NULL == node)
continue;
switch (displayManager->getCurrentDecorativeDisplay()->getDisplayData()->displayType)
{
case CS_DISPLAY_SPRITE:
{
Skin *skin = static_cast<Skin *>(node);
TextureAtlas *textureAtlas = skin->getTextureAtlas();
BlendType blendType = bone->getBlendType();
if(_atlas != textureAtlas || blendType != BLEND_NORMAL)
{
if (_atlas)
{
_atlas->drawQuads();
_atlas->removeAllQuads();
}
}
_atlas = textureAtlas;
if (_atlas->getCapacity() == _atlas->getTotalQuads() && !_atlas->resizeCapacity(_atlas->getCapacity() * 2))
return;
skin->updateTransform();
if (blendType != BLEND_NORMAL)
{
updateBlendType(blendType);
_atlas->drawQuads();
_atlas->removeAllQuads();
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
}
}
break;
case CS_DISPLAY_ARMATURE:
{
Armature *armature = static_cast<Armature *>(node);
TextureAtlas *textureAtlas = armature->getTextureAtlas();
if(_atlas != textureAtlas)
{
if (_atlas)
{
_atlas->drawQuads();
_atlas->removeAllQuads();
}
}
armature->draw();
}
break;
default:
{ {
if (_atlas) if (_atlas)
{ {
_atlas->drawQuads(); _atlas->drawQuads();
_atlas->removeAllQuads(); _atlas->removeAllQuads();
} }
node->visit();
CC_NODE_DRAW_SETUP();
GL::blendFunc(_blendFunc.src, _blendFunc.dst);
} }
break;
_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)
{
if (_atlas)
{
_atlas->drawQuads();
_atlas->removeAllQuads();
}
} }
armature->draw();
} }
else else if(Node *node = dynamic_cast<Node *>(object))
{ {
if (_atlas) if (_atlas)
{ {
@ -494,6 +563,48 @@ void Armature::draw()
} }
} }
void Armature::updateBlendType(BlendType 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 Armature::visit() void Armature::visit()
{ {
// quick return if not visible. children won't be drawn. // quick return if not visible. children won't be drawn.
@ -535,27 +646,29 @@ Rect Armature::getBoundingBox() const
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_children, object) CCARRAY_FOREACH(_children, object)
{ {
Bone *bone = static_cast<Bone *>(object); if (Bone *bone = dynamic_cast<Bone *>(object))
Rect r = bone->getDisplayManager()->getBoundingBox();
if(first)
{ {
minx = r.getMinX(); Rect r = bone->getDisplayManager()->getBoundingBox();
miny = r.getMinY();
maxx = r.getMaxX();
maxy = r.getMaxY();
first = false; if(first)
} {
else minx = r.getMinX();
{ miny = r.getMinY();
minx = r.getMinX() < boundingBox.getMinX() ? r.getMinX() : boundingBox.getMinX(); maxx = r.getMaxX();
miny = r.getMinY() < boundingBox.getMinY() ? r.getMinY() : boundingBox.getMinY(); maxy = r.getMaxY();
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); 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; return boundingBox;
@ -577,4 +690,102 @@ Bone *Armature::getBoneAtPoint(float x, float y)
return NULL; return NULL;
} }
}}} // namespace cocos2d { namespace extension { namespace armature { #if ENABLE_PHYSICS_BOX2D_DETECT
b2Body *Armature::getBody()
{
return _body;
}
void Armature::setBody(b2Body *body)
{
if (_body == body)
{
return;
}
_body = body;
_body->SetUserData(this);
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
if (Bone *bone = dynamic_cast<Bone *>(object))
{
Array *displayList = bone->getDisplayManager()->getDecorativeDisplayList();
Object *displayObject = NULL;
CCARRAY_FOREACH(displayList, displayObject)
{
ColliderDetector *detector = ((DecorativeDisplay *)displayObject)->getColliderDetector();
if (detector != NULL)
{
detector->setBody(_body);
}
}
}
}
}
b2Fixture *Armature::getShapeList()
{
if (_body)
{
return _body->GetFixtureList();
}
else
{
return NULL;
}
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
cpBody *Armature::getBody()
{
return _body;
}
void Armature::setBody(cpBody *body)
{
if (_body == body)
{
return;
}
_body = body;
_body->data = this;
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
if (Bone *bone = dynamic_cast<Bone *>(object))
{
Array *displayList = bone->getDisplayManager()->getDecorativeDisplayList();
Object *displayObject = NULL;
CCARRAY_FOREACH(displayList, displayObject)
{
ColliderDetector *detector = ((DecorativeDisplay *)displayObject)->getColliderDetector();
if (detector != NULL)
{
detector->setBody(_body);
}
}
}
}
}
cpShape *Armature::getShapeList()
{
if (_body)
{
return _body->shapeList_private;
}
else
{
return NULL;
}
}
#endif
NS_CC_EXT_ARMATURE_END

View File

@ -21,20 +21,21 @@ 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __CCARMATURE_H__ #ifndef __CCARMATURE_H__
#define __CCARMATURE_H__ #define __CCARMATURE_H__
#include "utils/CCArmatureDefine.h" #include "utils/CCArmatureDefine.h"
#include "CCBone.h" #include "CCBone.h"
#include "display/CCBatchNode.h" #include "display/CCBatchNode.h"
#include "display/CCShaderNode.h"
#include "animation/CCArmatureAnimation.h" #include "animation/CCArmatureAnimation.h"
#include "physics/CCPhysicsWorld.h"
#include "utils/CCSpriteFrameCacheHelper.h" #include "utils/CCSpriteFrameCacheHelper.h"
#include "utils/CCArmatureDataManager.h" #include "utils/CCArmatureDataManager.h"
namespace cocos2d { namespace extension { namespace armature { class b2Body;
struct cpBody;
NS_CC_EXT_ARMATURE_BEGIN
CC_DEPRECATED_ATTRIBUTE typedef ProcessBase CCProcessBase; CC_DEPRECATED_ATTRIBUTE typedef ProcessBase CCProcessBase;
CC_DEPRECATED_ATTRIBUTE typedef BaseData CCBaseData; CC_DEPRECATED_ATTRIBUTE typedef BaseData CCBaseData;
@ -42,7 +43,6 @@ CC_DEPRECATED_ATTRIBUTE typedef DisplayData CCDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef SpriteDisplayData CCSpriteDisplayData; CC_DEPRECATED_ATTRIBUTE typedef SpriteDisplayData CCSpriteDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef ArmatureDisplayData CCArmatureDisplayData; CC_DEPRECATED_ATTRIBUTE typedef ArmatureDisplayData CCArmatureDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef ParticleDisplayData CCParticleDisplayData; CC_DEPRECATED_ATTRIBUTE typedef ParticleDisplayData CCParticleDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef ShaderDisplayData CCShaderDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef BoneData CCBoneData; CC_DEPRECATED_ATTRIBUTE typedef BoneData CCBoneData;
CC_DEPRECATED_ATTRIBUTE typedef FrameData CCFrameData; CC_DEPRECATED_ATTRIBUTE typedef FrameData CCFrameData;
CC_DEPRECATED_ATTRIBUTE typedef MovementBoneData CCMovementBoneData; CC_DEPRECATED_ATTRIBUTE typedef MovementBoneData CCMovementBoneData;
@ -50,7 +50,6 @@ CC_DEPRECATED_ATTRIBUTE typedef MovementData CCMovementData;
CC_DEPRECATED_ATTRIBUTE typedef AnimationData CCAnimationData; CC_DEPRECATED_ATTRIBUTE typedef AnimationData CCAnimationData;
CC_DEPRECATED_ATTRIBUTE typedef ContourData CCContourData; CC_DEPRECATED_ATTRIBUTE typedef ContourData CCContourData;
CC_DEPRECATED_ATTRIBUTE typedef TextureData CCTextureData; CC_DEPRECATED_ATTRIBUTE typedef TextureData CCTextureData;
CC_DEPRECATED_ATTRIBUTE typedef ShaderNode CCShaderNode;
CC_DEPRECATED_ATTRIBUTE typedef DecorativeDisplay CCDecorativeDisplay; CC_DEPRECATED_ATTRIBUTE typedef DecorativeDisplay CCDecorativeDisplay;
CC_DEPRECATED_ATTRIBUTE typedef DisplayData CCDisplayData; CC_DEPRECATED_ATTRIBUTE typedef DisplayData CCDisplayData;
CC_DEPRECATED_ATTRIBUTE typedef DisplayFactory CCDisplayFactory; CC_DEPRECATED_ATTRIBUTE typedef DisplayFactory CCDisplayFactory;
@ -59,7 +58,6 @@ CC_DEPRECATED_ATTRIBUTE typedef DecorativeDisplay CCDecorativeDisplay;
CC_DEPRECATED_ATTRIBUTE typedef DisplayManager CCDisplayManager; CC_DEPRECATED_ATTRIBUTE typedef DisplayManager CCDisplayManager;
CC_DEPRECATED_ATTRIBUTE typedef ColliderBody CCColliderBody; CC_DEPRECATED_ATTRIBUTE typedef ColliderBody CCColliderBody;
CC_DEPRECATED_ATTRIBUTE typedef ColliderDetector CCColliderDetector; CC_DEPRECATED_ATTRIBUTE typedef ColliderDetector CCColliderDetector;
CC_DEPRECATED_ATTRIBUTE typedef PhysicsWorld CCPhysicsWorld;
CC_DEPRECATED_ATTRIBUTE typedef SpriteFrameCacheHelper CCSpriteFrameCacheHelper; CC_DEPRECATED_ATTRIBUTE typedef SpriteFrameCacheHelper CCSpriteFrameCacheHelper;
CC_DEPRECATED_ATTRIBUTE typedef TweenFunction CCTweenFunction; CC_DEPRECATED_ATTRIBUTE typedef TweenFunction CCTweenFunction;
CC_DEPRECATED_ATTRIBUTE typedef ArmatureData CCArmatureData; CC_DEPRECATED_ATTRIBUTE typedef ArmatureData CCArmatureData;
@ -67,57 +65,55 @@ CC_DEPRECATED_ATTRIBUTE typedef Bone CCBone;
CC_DEPRECATED_ATTRIBUTE typedef ArmatureAnimation CCArmatureAnimation; CC_DEPRECATED_ATTRIBUTE typedef ArmatureAnimation CCArmatureAnimation;
CC_DEPRECATED_ATTRIBUTE typedef Armature CCArmature; CC_DEPRECATED_ATTRIBUTE typedef Armature CCArmature;
CC_DEPRECATED_ATTRIBUTE typedef ArmatureDataManager CCArmatureDataManager; CC_DEPRECATED_ATTRIBUTE typedef ArmatureDataManager CCArmatureDataManager;
class Armature : public NodeRGBA, public BlendProtocol class Armature : public NodeRGBA, public BlendProtocol
{ {
public: 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 Armature *create();
/**
* Allocates an armature, and use the ArmatureData named name in ArmatureDataManager to initializes the armature.
*
* @param name Armature will use the name to find 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);
public: public:
/**
* @js ctor
*/
Armature(); Armature();
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual ~Armature(void); ~Armature(void);
/** /**
* Init the empty armature * Init the empty armature
*/ */
virtual bool init(); virtual bool init();
/** /**
* Init a armature with specified name * Init an armature with specified name
* @param name Armature name * @param name Armature name
*/ */
virtual bool init(const char *name); virtual bool init(const char *name);
virtual bool init(const char *name, Bone *parentBone); virtual bool init(const char *name, Bone *parentBone);
/** /**
* Add a Bone to this Armature, * Add a Bone to this Armature,
* *
* @param bone The Bone you want to add to Armature * @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 parentName The parent Bone's name you want to add to . If it's NULL, then set Armature to its parent
*/ */
virtual void addBone(Bone *bone, const char* parentName); virtual void addBone(Bone *bone, const char *parentName);
/** /**
* Get a bone with the specified name * Get a bone with the specified name
* *
@ -128,14 +124,14 @@ public:
* Change a bone's parent with the specified parent name. * Change a bone's parent with the specified parent name.
* *
* @param bone The bone you want to change parent * @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(Bone *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 Bone recursionly.
* *
* @param bone The bone you want to remove * @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(Bone *bone, bool recursion);
@ -143,61 +139,88 @@ public:
* Get Armature's bone dictionary * Get Armature's bone dictionary
* @return Armature's bone dictionary * @return Armature's bone dictionary
*/ */
Dictionary *getBoneDic(); Dictionary *getBoneDic();
Bone *getBoneAtPoint(float x, float y);
/** /**
* Set contentsize and Calculate anchor point. * This boundingBox will calculate all bones' boundingBox every time
*/ */
virtual void updateOffsetPoint(); virtual Rect getBoundingBox() const;
Bone *getBoneAtPoint(float x, float y);
// overrides // overrides
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual void visit() override; virtual void visit() override;
virtual void update(float dt) override; virtual void update(float dt) override;
virtual void draw() override; virtual void draw() override;
virtual const AffineTransform& getNodeToParentTransform() const override;
/** This boundingBox will calculate all bones' boundingBox every time */ virtual const AffineTransform& getNodeToParentTransform() const override;
virtual Rect getBoundingBox() const override;
inline void setBlendFunc(const BlendFunc& blendFunc) override { _blendFunc = blendFunc; } inline void setBlendFunc(const BlendFunc &blendFunc) override { _blendFunc = blendFunc; }
inline const BlendFunc& getBlendFunc(void) const override { return _blendFunc; } inline const BlendFunc &getBlendFunc(void) const override{ return _blendFunc; }
/**
* Set contentsize and Calculate anchor point.
*/
virtual void updateOffsetPoint();
virtual void setAnimation(ArmatureAnimation *animation);
virtual ArmatureAnimation *getAnimation();
virtual bool getArmatureTransformDirty();
#if ENABLE_PHYSICS_BOX2D_DETECT
virtual b2Fixture *getShapeList();
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
virtual cpShape *getShapeList();
#endif
protected: protected:
/* /*
* Used to create Bone internal * Used to create Bone internal
*/ */
Bone *createBone(const char *boneName ); Bone *createBone(const char *boneName );
//! Update blend function
void updateBlendType(BlendType blendType);
CC_SYNTHESIZE_RETAIN(ArmatureAnimation *, _animation, Animation);
CC_SYNTHESIZE(ArmatureData *, _armatureData, ArmatureData); CC_SYNTHESIZE(ArmatureData *, _armatureData, ArmatureData);
CC_SYNTHESIZE(BatchNode*, _batchNode, BatchNode); CC_SYNTHESIZE(BatchNode *, _batchNode, BatchNode);
CC_SYNTHESIZE_PASS_BY_REF(std::string, _name, Name); CC_SYNTHESIZE(std::string, _name, Name);
CC_SYNTHESIZE(TextureAtlas*, _atlas, TextureAtlas); CC_SYNTHESIZE(TextureAtlas *, _atlas, TextureAtlas);
CC_SYNTHESIZE(Bone *, _parentBone, ParentBone);
CC_SYNTHESIZE(float, _version, Version);
CC_SYNTHESIZE(Bone*, _parentBone, ParentBone);
protected: 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 _armatureTransformDirty;
Array *_topBoneList; 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 m_pChindren.
static std::map<int, Armature*> _armatureIndexDic; //! Use to save armature zorder info, Array *_topBoneList;
BlendFunc _blendFunc; //! It's required for TextureProtocol inheritance BlendFunc _blendFunc; //! It's required for CCTextureProtocol inheritance
Point _offsetPoint; Point _offsetPoint;
ArmatureAnimation *_animation;
#if ENABLE_PHYSICS_BOX2D_DETECT
CC_PROPERTY(b2Body *, _body, Body);
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
CC_PROPERTY(cpBody *, _body, Body);
#endif
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCARMATURE_H__*/ #endif /*__CCARMATURE_H__*/

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "utils/CCTransformHelp.h" #include "utils/CCTransformHelp.h"
#include "display/CCDisplayManager.h" #include "display/CCDisplayManager.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
Bone *Bone::create() Bone *Bone::create()
{ {
@ -61,7 +61,7 @@ Bone *Bone::create(const char *name)
Bone::Bone() Bone::Bone()
{ {
_tweenData = NULL; _tweenData = NULL;
_parent = NULL; _parentBone = NULL;
_armature = NULL; _armature = NULL;
_childArmature = NULL; _childArmature = NULL;
_boneData = NULL; _boneData = NULL;
@ -71,7 +71,8 @@ Bone::Bone()
_displayManager = NULL; _displayManager = NULL;
_ignoreMovementBoneData = false; _ignoreMovementBoneData = false;
_worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0); _worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);
_transformDirty = true; _boneTransformDirty = true;
_blendType = BLEND_NORMAL;
} }
@ -146,64 +147,66 @@ BoneData *Bone::getBoneData()
void Bone::setArmature(Armature *armature) void Bone::setArmature(Armature *armature)
{ {
_armature = armature; _armature = armature;
_tween->setAnimation(_armature->getAnimation()); if (_armature)
{
_tween->setAnimation(_armature->getAnimation());
}
} }
Armature *Bone::getArmature() Armature *Bone::getArmature()
{ {
return _armature; return _armature;
} }
void Bone::update(float delta) void Bone::update(float delta)
{ {
if (_parent) if (_parentBone)
_transformDirty = _transformDirty || _parent->isTransformDirty(); _boneTransformDirty = _boneTransformDirty || _parentBone->isTransformDirty();
if (_transformDirty) if (_boneTransformDirty)
{ {
float cosX = cos(_tweenData->skewX); if (_armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
float cosY = cos(_tweenData->skewY); {
float sinX = sin(_tweenData->skewX); TransformHelp::nodeConcat(*_tweenData, *_boneData);
float sinY = sin(_tweenData->skewY); _tweenData->scaleX -= 1;
_tweenData->scaleY -= 1;
}
_worldTransform.a = _tweenData->scaleX * cosY; TransformHelp::nodeToMatrix(*_tweenData, _worldTransform);
_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); _worldTransform = AffineTransformConcat(getNodeToParentTransform(), _worldTransform);
if(_parent) if(_parentBone)
{ {
_worldTransform = AffineTransformConcat(_worldTransform, _parent->_worldTransform); _worldTransform = AffineTransformConcat(_worldTransform, _parentBone->_worldTransform);
} }
} }
DisplayFactory::updateDisplay(this, _displayManager->getCurrentDecorativeDisplay(), delta, _transformDirty); DisplayFactory::updateDisplay(this, _displayManager->getCurrentDecorativeDisplay(), delta, _boneTransformDirty || _armature->getArmatureTransformDirty());
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_children, object) CCARRAY_FOREACH(_children, object)
{ {
Bone *childBone = static_cast<Bone *>(object); Bone *childBone = (Bone *)object;
childBone->update(delta); childBone->update(delta);
} }
_transformDirty = false; _boneTransformDirty = false;
} }
void Bone::updateDisplayedColor(const Color3B &parentColor) void Bone::updateDisplayedColor(const Color3B &parentColor)
{ {
_realColor = Color3B(255, 255, 255);
NodeRGBA::updateDisplayedColor(parentColor); NodeRGBA::updateDisplayedColor(parentColor);
updateColor(); updateColor();
} }
void Bone::updateDisplayedOpacity(GLubyte parentOpacity) void Bone::updateDisplayedOpacity(GLubyte parentOpacity)
{ {
_realOpacity = 255;
NodeRGBA::updateDisplayedOpacity(parentOpacity); NodeRGBA::updateDisplayedOpacity(parentOpacity);
updateColor(); updateColor();
} }
@ -219,15 +222,28 @@ void Bone::updateColor()
} }
} }
void Bone::updateZOrder()
{
if (_armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
{
int zorder = _tweenData->zOrder + _boneData->zOrder;
setZOrder(zorder);
}
else
{
setZOrder(_tweenData->zOrder);
}
}
void Bone::addChildBone(Bone *child) void Bone::addChildBone(Bone *child)
{ {
CCASSERT( NULL != child, "Argument must be non-nil"); CCASSERT( NULL != child, "Argument must be non-nil");
CCASSERT( NULL == child->_parent, "child already added. It can't be added again"); CCASSERT( NULL == child->_parentBone, "child already added. It can't be added again");
if(!_children) if(!_children)
{ {
childrenAlloc(); _children = Array::createWithCapacity(4);
_children->retain();
} }
if (_children->getIndexOfObject(child) == UINT_MAX) if (_children->getIndexOfObject(child) == UINT_MAX)
@ -247,7 +263,7 @@ void Bone::removeChildBone(Bone *bone, bool recursion)
Object *_object = NULL; Object *_object = NULL;
CCARRAY_FOREACH(_ccbones, _object) CCARRAY_FOREACH(_ccbones, _object)
{ {
Bone *_ccBone = static_cast<Bone *>(_object); Bone *_ccBone = (Bone *)_object;
bone->removeChildBone(_ccBone, recursion); bone->removeChildBone(_ccBone, recursion);
} }
} }
@ -262,30 +278,22 @@ void Bone::removeChildBone(Bone *bone, bool recursion)
void Bone::removeFromParent(bool recursion) void Bone::removeFromParent(bool recursion)
{ {
if (NULL != _parent) if (NULL != _parentBone)
{ {
_parent->removeChildBone(this, recursion); _parentBone->removeChildBone(this, recursion);
} }
} }
void Bone::setParentBone(Bone *parent) void Bone::setParentBone(Bone *parent)
{ {
_parent = parent; _parentBone = parent;
} }
Bone *Bone::getParentBone() Bone *Bone::getParentBone()
{ {
return _parent; return _parentBone;
} }
void Bone::childrenAlloc(void)
{
CC_SAFE_DELETE(_children);
_children = Array::createWithCapacity(4);
_children->retain();
}
void Bone::setChildArmature(Armature *armature) void Bone::setChildArmature(Armature *armature)
{ {
if (_childArmature != armature) if (_childArmature != armature)
@ -301,11 +309,6 @@ Armature *Bone::getChildArmature()
return _childArmature; return _childArmature;
} }
Array *Bone::getChildren()
{
return _children;
}
Tween *Bone::getTween() Tween *Bone::getTween()
{ {
return _tween; return _tween;
@ -319,27 +322,55 @@ void Bone::setZOrder(int zOrder)
void Bone::setTransformDirty(bool dirty) void Bone::setTransformDirty(bool dirty)
{ {
_transformDirty = dirty; _boneTransformDirty = dirty;
} }
bool Bone::isTransformDirty() bool Bone::isTransformDirty()
{ {
return _transformDirty; return _boneTransformDirty;
} }
AffineTransform Bone::nodeToArmatureTransform() AffineTransform Bone::getNodeToArmatureTransform() const
{ {
return _worldTransform; return _worldTransform;
} }
void Bone::addDisplay(DisplayData *_displayData, int _index) AffineTransform Bone::getNodeToWorldTransform() const
{ {
_displayManager->addDisplay(_displayData, _index); return AffineTransformConcat(_worldTransform, _armature->getNodeToWorldTransform());
} }
void Bone::changeDisplayByIndex(int _index, bool _force) Node *Bone::getDisplayRenderNode()
{ {
_displayManager->changeDisplayByIndex(_index, _force); return _displayManager->getDisplayRenderNode();
} }
}}} // namespace cocos2d { namespace extension { namespace armature { void Bone::addDisplay(DisplayData *displayData, int index)
{
_displayManager->addDisplay(displayData, index);
}
void Bone::addDisplay(Node *display, int index)
{
_displayManager->addDisplay(display, index);
}
void Bone::changeDisplayByIndex(int index, bool force)
{
_displayManager->changeDisplayByIndex(index, force);
}
Array *Bone::getColliderBodyList()
{
if (DecorativeDisplay *decoDisplay = _displayManager->getCurrentDecorativeDisplay())
{
if (ColliderDetector *detector = decoDisplay->getColliderDetector())
{
return detector->getColliderBodyList();
}
}
return NULL;
}
NS_CC_EXT_ARMATURE_END

View File

@ -28,11 +28,11 @@ THE SOFTWARE.
#include "utils/CCArmatureDefine.h" #include "utils/CCArmatureDefine.h"
#include "datas/CCDatas.h" #include "datas/CCDatas.h"
#include "animation/CCTween.h" #include "animation/CCTween.h"
#include "external_tool/CCTexture2DMutable.h"
#include "display/CCDecorativeDisplay.h" #include "display/CCDecorativeDisplay.h"
#include "display/CCDisplayManager.h" #include "display/CCDisplayManager.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class Armature; class Armature;
@ -72,7 +72,7 @@ public:
virtual bool init(const char *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 already have a display, then replace it.
* If index is current display index, then also change display to _index * If index is current display index, then also change display to _index
* *
@ -84,18 +84,20 @@ public:
*/ */
void addDisplay(DisplayData *displayData, int index); void addDisplay(DisplayData *displayData, int index);
void addDisplay(Node *display, int index);
void changeDisplayByIndex(int index, bool force); 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 * 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. * @param child the child you want to add
*/ */
void addChildBone(Bone *child); void addChildBone(Bone *child);
/** /**
* Set parent bone. * Set parent bone.
* If _parent is NUll, then also remove this bone from armature. * 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). * 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).
* *
* @param parent the parent bone. * @param parent the parent bone.
* NULL : remove this bone from armature * NULL : remove this bone from armature
@ -109,14 +111,14 @@ public:
Bone *getParentBone(); Bone *getParentBone();
/** /**
* Remove itself from its parent Bone. * Remove itself from its parent.
* @param recursion Whether to remove Child display * @param recursion whether or not to remove childBone's display
*/ */
void removeFromParent(bool recursion); void removeFromParent(bool recursion);
/** /**
* Removes a child Bone * Removes a child Bone
* @param bone The bone you want to remove. * @param bone the bone you want to remove
*/ */
void removeChildBone(Bone *bone, bool recursion); void removeChildBone(Bone *bone, bool recursion);
@ -128,10 +130,13 @@ public:
//! Update color to render display //! Update color to render display
void updateColor(); void updateColor();
Array *getChildren(); //! Update zorder
Tween *getTween(); void updateZOrder();
virtual void setZOrder(int zOrder); virtual void setZOrder(int zOrder);
Tween *getTween();
/* /*
* Whether or not the bone's transform property changed. if true, the bone will update the transform. * Whether or not the bone's transform property changed. if true, the bone will update the transform.
*/ */
@ -139,11 +144,19 @@ public:
virtual bool isTransformDirty(); virtual bool isTransformDirty();
virtual AffineTransform nodeToArmatureTransform(); virtual AffineTransform getNodeToArmatureTransform() const;
virtual AffineTransform getNodeToWorldTransform() const override;
Node *getDisplayRenderNode();
/*
* Get the ColliderBody list in this bone. The object in the Array is ColliderBody.
*/
virtual Array *getColliderBodyList();
public: public:
/* /*
* The origin state of the Bone. Display's state is effected by _boneData, _node, _tweenData * The origin state of the Bone. Display's state is effected by _boneData, m_pNode, _tweenData
* when call setData function, it will copy from the BoneData. * when call setData function, it will copy from the BoneData.
*/ */
CC_PROPERTY(BoneData *, _boneData, BoneData); CC_PROPERTY(BoneData *, _boneData, BoneData);
@ -157,30 +170,27 @@ public:
CC_SYNTHESIZE(DisplayManager *, _displayManager, DisplayManager) CC_SYNTHESIZE(DisplayManager *, _displayManager, DisplayManager)
/* /*
* When Armature play a animation, if there is not a MovementBoneData of this bone in this MovementData, this bone will hide. * When Armature play an animation, if there is not a MovementBoneData of this bone in this MovementData, this bone will be hidden.
* Set IgnoreMovementBoneData to true, then this bone will also show. * Set IgnoreMovementBoneData to true, then this bone will also be shown.
*/ */
CC_SYNTHESIZE_PASS_BY_REF(bool, _ignoreMovementBoneData, IgnoreMovementBoneData) CC_SYNTHESIZE(bool, _ignoreMovementBoneData, IgnoreMovementBoneData)
CC_SYNTHESIZE(BlendType, _blendType, BlendType)
protected: protected:
Tween *_tween; //! Calculate tween effect Tween *_tween; //! Calculate tween effect
//! Used for make tween effect between every frame //! Used for making tween effect in every frame
CC_SYNTHESIZE_READONLY(FrameData *, _tweenData, TweenData); CC_SYNTHESIZE_READONLY(FrameData *, _tweenData, TweenData);
CC_SYNTHESIZE_PASS_BY_REF(std::string, _name, Name); CC_SYNTHESIZE(std::string, _name, Name);
//! Lazy allocs Bone *_parentBone; //! A weak reference to its parent
void childrenAlloc(void); bool _boneTransformDirty; //! Whether or not transform dirty
Array *_children;
Bone *_parent; //! A weak reference to it's parent
bool _transformDirty; //! Whether or not transform dirty
//! self Transform, use this to change display's state //! self Transform, use this to change display's state
AffineTransform _worldTransform; AffineTransform _worldTransform;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCBONE_H__*/ #endif /*__CCBONE_H__*/

View File

@ -27,11 +27,10 @@ THE SOFTWARE.
#include "../CCBone.h" #include "../CCBone.h"
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../utils/CCUtilMath.h" #include "../utils/CCUtilMath.h"
#include "../utils/CCConstValue.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
ArmatureAnimation *ArmatureAnimation::create(Armature *armature) ArmatureAnimation *ArmatureAnimation::create(Armature *armature)
{ {
@ -47,20 +46,28 @@ ArmatureAnimation *ArmatureAnimation::create(Armature *armature)
ArmatureAnimation::ArmatureAnimation() ArmatureAnimation::ArmatureAnimation()
: _animationData(NULL) : _animationData(NULL)
, _armature(NULL) , _speedScale(1)
, _movementData(NULL)
, _armature(NULL)
, _movementID("") , _movementID("")
, _toIndex(0) , _toIndex(0)
, _movementEventCallFunc(NULL)
, _frameEventCallFunc(NULL)
, _movementEventTarget(NULL)
, _frameEventTarget(NULL)
{ {
} }
ArmatureAnimation::~ArmatureAnimation(void) ArmatureAnimation::~ArmatureAnimation(void)
{ {
CCLOGINFO("deallocing ArmatureAnimation: %p", this);
CC_SAFE_RELEASE_NULL(_tweenList); CC_SAFE_RELEASE_NULL(_tweenList);
CC_SAFE_RELEASE_NULL(_animationData); CC_SAFE_RELEASE_NULL(_animationData);
CC_SAFE_RELEASE_NULL(_movementEventTarget);
CC_SAFE_RELEASE_NULL(_frameEventTarget);
} }
bool ArmatureAnimation::init(Armature *armature) bool ArmatureAnimation::init(Armature *armature)
@ -86,7 +93,7 @@ void ArmatureAnimation:: pause()
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object) CCARRAY_FOREACH(_tweenList, object)
{ {
static_cast<Tween *>(object)->pause(); static_cast<Tween*>(object)->pause();
} }
ProcessBase::pause(); ProcessBase::pause();
} }
@ -96,7 +103,7 @@ void ArmatureAnimation::resume()
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object) CCARRAY_FOREACH(_tweenList, object)
{ {
static_cast<Tween *>(object)->resume(); static_cast<Tween*>(object)->resume();
} }
ProcessBase::resume(); ProcessBase::resume();
} }
@ -106,7 +113,7 @@ void ArmatureAnimation::stop()
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object) CCARRAY_FOREACH(_tweenList, object)
{ {
static_cast<Tween *>(object)->stop(); static_cast<Tween*>(object)->stop();
} }
_tweenList->removeAllObjects(); _tweenList->removeAllObjects();
ProcessBase::stop(); ProcessBase::stop();
@ -114,22 +121,63 @@ void ArmatureAnimation::stop()
void ArmatureAnimation::setAnimationScale(float animationScale ) void ArmatureAnimation::setAnimationScale(float animationScale )
{ {
if(animationScale == _animationScale) setSpeedScale(animationScale);
}
float ArmatureAnimation::getAnimationScale() const
{
return getSpeedScale();
}
void ArmatureAnimation::setSpeedScale(float speedScale)
{
if(speedScale == _speedScale)
{ {
return; return;
} }
_animationScale = animationScale; _speedScale = speedScale;
_processScale = !_movementData ? _speedScale : _speedScale * _movementData->scale;
DictElement *element = NULL; DictElement *element = NULL;
Dictionary *dict = _armature->getBoneDic(); Dictionary *dict = _armature->getBoneDic();
CCDICT_FOREACH(dict, element) CCDICT_FOREACH(dict, element)
{ {
Bone *bone = (Bone *)element->getObject(); Bone *bone = static_cast<Bone*>(element->getObject());
bone->getTween()->setAnimationScale(_animationScale);
bone->getTween()->setProcessScale(_processScale);
if (bone->getChildArmature()) if (bone->getChildArmature())
{ {
bone->getChildArmature()->getAnimation()->setAnimationScale(_animationScale); bone->getChildArmature()->getAnimation()->setProcessScale(_processScale);
}
}
}
float ArmatureAnimation::getSpeedScale() const
{
return _speedScale;
}
void ArmatureAnimation::setAnimationInternal(float animationInternal)
{
if(animationInternal == _animationInternal)
{
return;
}
_animationInternal = animationInternal;
DictElement *element = NULL;
Dictionary *dict = _armature->getBoneDic();
CCDICT_FOREACH(dict, element)
{
Bone *bone = static_cast<Bone*>(element->getObject());
bone->getTween()->setAnimationInternal(_animationInternal);
if (bone->getChildArmature())
{
bone->getChildArmature()->getAnimation()->setAnimationInternal(_animationInternal);
} }
} }
} }
@ -147,6 +195,8 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
_movementID = animationName; _movementID = animationName;
_processScale = _speedScale * _movementData->scale;
//! Further processing parameters //! Further processing parameters
durationTo = (durationTo == -1) ? _movementData->durationTo : durationTo; durationTo = (durationTo == -1) ? _movementData->durationTo : durationTo;
@ -160,7 +210,7 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
ProcessBase::play((void *)animationName, durationTo, durationTween, loop, tweenEasing); ProcessBase::play((void *)animationName, durationTo, durationTween, loop, tweenEasing);
if (_rawDuration == 1) if (_rawDuration == 0)
{ {
_loopType = SINGLE_FRAME; _loopType = SINGLE_FRAME;
} }
@ -186,19 +236,23 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
CCDICT_FOREACH(dict, element) CCDICT_FOREACH(dict, element)
{ {
Bone *bone = (Bone *)element->getObject(); Bone *bone = static_cast<Bone*>(element->getObject());
movementBoneData = (MovementBoneData *)_movementData->movBoneDataDic->objectForKey(bone->getName()); movementBoneData = static_cast<MovementBoneData *>(_movementData->movBoneDataDic.objectForKey(bone->getName()));
Tween *tween = bone->getTween(); Tween *tween = bone->getTween();
if(movementBoneData && movementBoneData->frameList->count() > 0) if(movementBoneData && movementBoneData->frameList.count() > 0)
{ {
_tweenList->addObject(tween); _tweenList->addObject(tween);
movementBoneData->duration = _movementData->duration;
tween->play(movementBoneData, durationTo, durationTween, loop, tweenEasing); tween->play(movementBoneData, durationTo, durationTween, loop, tweenEasing);
tween->setAnimationScale(_animationScale); tween->setProcessScale(_processScale);
tween->setAnimationInternal(_animationInternal);
if (bone->getChildArmature()) if (bone->getChildArmature())
{ {
bone->getChildArmature()->getAnimation()->setAnimationScale(_animationScale); bone->getChildArmature()->getAnimation()->setProcessScale(_processScale);
bone->getChildArmature()->getAnimation()->setAnimationInternal(_animationInternal);
} }
} }
else else
@ -212,8 +266,6 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
} }
} }
//_armature->update(0);
} }
@ -239,7 +291,7 @@ void ArmatureAnimation::update(float dt)
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object) CCARRAY_FOREACH(_tweenList, object)
{ {
static_cast<Tween *>(object)->update(dt); static_cast<Tween *>(object)->update(dt);
} }
} }
@ -262,7 +314,10 @@ void ArmatureAnimation::updateHandler()
{ {
_nextFrameIndex = _durationTween; _nextFrameIndex = _durationTween;
MovementEventSignal.emit(_armature, START, _movementID.c_str()); if (_movementEventTarget && _movementEventCallFunc)
{
(_movementEventTarget->*_movementEventCallFunc)(_armature, START, _movementID.c_str());
}
break; break;
} }
@ -273,45 +328,79 @@ void ArmatureAnimation::updateHandler()
{ {
_currentPercent = 1; _currentPercent = 1;
_isComplete = true; _isComplete = true;
_isPlaying = false;
MovementEventSignal.emit(_armature, COMPLETE, _movementID.c_str()); if (_movementEventTarget && _movementEventCallFunc)
{
(_movementEventTarget->*_movementEventCallFunc)(_armature, COMPLETE, _movementID.c_str());
}
} }
break; break;
case ANIMATION_TO_LOOP_FRONT: case ANIMATION_TO_LOOP_FRONT:
{ {
_loopType = ANIMATION_LOOP_FRONT; _loopType = ANIMATION_LOOP_FRONT;
_currentPercent = fmodf(_currentPercent, 1); _currentPercent = fmodf(_currentPercent, 1);
_currentFrame = fmodf(_currentFrame, _nextFrameIndex); _currentFrame = _nextFrameIndex == 0 ? 0 : fmodf(_currentFrame, _nextFrameIndex);
_nextFrameIndex = _durationTween > 0 ? _durationTween : 1; _nextFrameIndex = _durationTween > 0 ? _durationTween : 1;
MovementEventSignal.emit(_armature, START, _movementID.c_str()); if (_movementEventTarget && _movementEventCallFunc)
{
(_movementEventTarget->*_movementEventCallFunc)(_armature, START, _movementID.c_str());
}
} }
break; break;
default: default:
{ {
_currentPercent = fmodf(_currentPercent, 1); //_currentPercent = fmodf(_currentPercent, 1);
_currentFrame = fmodf(_currentFrame, _nextFrameIndex); _currentFrame = fmodf(_currentFrame, _nextFrameIndex);
_toIndex = 0; _toIndex = 0;
MovementEventSignal.emit(_armature, LOOP_COMPLETE, _movementID.c_str()); if (_movementEventTarget && _movementEventCallFunc)
{
(_movementEventTarget->*_movementEventCallFunc)(_armature, LOOP_COMPLETE, _movementID.c_str());
}
} }
break; break;
} }
} }
}
if (_loopType == ANIMATION_LOOP_FRONT || _loopType == ANIMATION_LOOP_BACK) std::string ArmatureAnimation::getCurrentMovementID()
{
if (_isComplete)
{ {
updateFrameData(_currentPercent); return "";
}
return _movementID;
}
void ArmatureAnimation::setMovementEventCallFunc(Object *target, SEL_MovementEventCallFunc callFunc)
{
if (target != _movementEventTarget)
{
CC_SAFE_RETAIN(target);
CC_SAFE_RELEASE_NULL(_movementEventTarget);
_movementEventTarget = target;
}
_movementEventCallFunc = callFunc;
}
void ArmatureAnimation::setFrameEventCallFunc(Object *target, SEL_FrameEventCallFunc callFunc)
{
if (target != _frameEventTarget)
{
CC_SAFE_RETAIN(target);
CC_SAFE_RELEASE_NULL(_frameEventTarget);
_frameEventTarget = target;
}
_frameEventCallFunc = callFunc;
}
void ArmatureAnimation::frameEvent(Bone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex)
{
if (_frameEventTarget && _frameEventCallFunc)
{
(_frameEventTarget->*_frameEventCallFunc)(bone, frameEventName, originFrameIndex, currentFrameIndex);
} }
} }
NS_CC_EXT_ARMATURE_END
void ArmatureAnimation::updateFrameData(float currentPercent)
{
_prevFrameIndex = _curFrameIndex;
_curFrameIndex = _rawDuration * currentPercent;
_curFrameIndex = _curFrameIndex % _rawDuration;
}
}}} // namespace cocos2d { namespace extension { namespace armature {

View File

@ -27,22 +27,28 @@ THE SOFTWARE.
#define __CCANIMATION_H__ #define __CCANIMATION_H__
#include "CCProcessBase.h" #include "CCProcessBase.h"
#include "../external_tool/sigslot.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
enum MovementEventType enum MovementEventType
{ {
START, START,
COMPLETE, COMPLETE,
LOOP_COMPLETE LOOP_COMPLETE
}; };
class Armature; class Armature;
class Bone; class Bone;
typedef void (Object::*SEL_MovementEventCallFunc)(Armature *, MovementEventType, const char *);
typedef void (Object::*SEL_FrameEventCallFunc)(Bone *, const char *, int, int);
#define movementEvent_selector(_SELECTOR) (SEL_MovementEventCallFunc)(&_SELECTOR)
#define frameEvent_selector(_SELECTOR) (SEL_FrameEventCallFunc)(&_SELECTOR)
class ArmatureAnimation : public ProcessBase class ArmatureAnimation : public ProcessBase
{ {
public: public:
@ -52,7 +58,7 @@ public:
*/ */
static ArmatureAnimation *create(Armature *armature); static ArmatureAnimation *create(Armature *armature);
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ArmatureAnimation(); ArmatureAnimation();
@ -73,6 +79,17 @@ public:
* @param animationScale Scale value * @param animationScale Scale value
*/ */
virtual void setAnimationScale(float animationScale); 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. * Play animation by animation name.
@ -106,7 +123,7 @@ public:
/** /**
* Play animation by index, the other param is the same to play. * 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); void playByIndex(int animationIndex, int durationTo = -1, int durationTween = -1, int loop = -1, int tweenEasing = TWEEN_EASING_MAX);
@ -130,6 +147,25 @@ public:
int getMovementCount(); int getMovementCount();
void update(float dt); 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: protected:
/** /**
@ -142,10 +178,18 @@ protected:
*/ */
void updateFrameData(float currentPercent); void updateFrameData(float currentPercent);
/**
* Emit a frame event
*/
void frameEvent(Bone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex);
friend class Tween;
protected: protected:
//! AnimationData save all MovementDatas this animation used. //! AnimationData save all MovementDatas this animation used.
CC_SYNTHESIZE_RETAIN(AnimationData *, _animationData, AnimationData); CC_SYNTHESIZE_RETAIN(AnimationData *, _animationData, AnimationData);
//! Scale the animation speed
float _speedScale;
MovementData *_movementData; //! MovementData save all MovementFrameDatas this animation used. MovementData *_movementData; //! MovementData save all MovementFrameDatas this animation used.
@ -153,20 +197,33 @@ protected:
std::string _movementID; //! Current movment's name std::string _movementID; //! Current movment's name
int _prevFrameIndex; //! Prev key frame index int _toIndex; //! The frame index in MovementData->m_pMovFrameDataArr, it's different from m_iFrameIndex.
int _toIndex; //! The frame index in MovementData->_movFrameDataArr, it's different from _frameIndex.
Array *_tweenList; 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.
*/
sigslot::signal3<Armature *, MovementEventType, const char *> MovementEventSignal;
sigslot::signal2<Bone *, const char *> FrameEventSignal; protected:
/**
* MovementEvent CallFunc.
* @param Armature* a Armature
* @param MovementEventType, Event Type, like START, COMPLETE.
* @param const char*, Movement ID, also called Movement Name
*/
SEL_MovementEventCallFunc _movementEventCallFunc;
/**
* FrameEvent CallFunc.
* @param Bone*, a Bone
* @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 _frameEventCallFunc;
Object *_movementEventTarget;
Object *_frameEventTarget;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCANIMATION_H__*/ #endif /*__CCANIMATION_H__*/

View File

@ -25,18 +25,18 @@ THE SOFTWARE.
#include "CCProcessBase.h" #include "CCProcessBase.h"
#include "../utils/CCUtilMath.h" #include "../utils/CCUtilMath.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
ProcessBase::ProcessBase(void) ProcessBase::ProcessBase(void)
: _animationScale(1) : _processScale(1)
, _isPause(true) , _isPause(true)
, _isComplete(true) , _isComplete(true)
, _isPlaying(false) , _isPlaying(false)
, _currentPercent(0.0f) , _currentPercent(0.0f)
, _rawDuration(0) , _rawDuration(0)
, _loopType(ANIMATION_LOOP_BACK) , _loopType(ANIMATION_LOOP_BACK)
, _tweenEasing(Linear) , _tweenEasing(Linear)
, _durationTween(0) , _durationTween(0)
, _currentFrame(0) , _currentFrame(0)
, _curFrameIndex(0) , _curFrameIndex(0)
, _isLoopBack(false) , _isLoopBack(false)
@ -45,7 +45,7 @@ ProcessBase::ProcessBase(void)
* set _animationInternal defualt value to Director::getInstance() * set _animationInternal defualt value to Director::getInstance()
* ->getAnimationInterval(), in line with game update speed * ->getAnimationInterval(), in line with game update speed
*/ */
_animationInternal = Director::getInstance()->getAnimationInterval(); _animationInternal = CCDirector::getInstance()->getAnimationInterval();
} }
@ -57,17 +57,20 @@ ProcessBase::~ProcessBase(void)
void ProcessBase::pause() void ProcessBase::pause()
{ {
_isPause = true; _isPause = true;
_isPlaying = false;
} }
void ProcessBase::resume() void ProcessBase::resume()
{ {
_isPause = false; _isPause = false;
_isPlaying = true;
} }
void ProcessBase::stop() void ProcessBase::stop()
{ {
_isComplete = true; _isComplete = true;
_isPlaying = false;
_currentFrame = 0; _currentFrame = 0;
_currentPercent = 0; _currentPercent = 0;
} }
@ -80,11 +83,11 @@ void ProcessBase::play(void *animation, int durationTo, int durationTween, int
_currentFrame = 0; _currentFrame = 0;
/* /*
* Set _totalFrames to durationTo, it is used for change tween between two animation. * Set m_iTotalFrames to durationTo, it is used for change tween between two animation.
* When changing end, _totalFrames will be setted to _durationTween * When changing end, m_iTotalFrames will be setted to _durationTween
*/ */
_nextFrameIndex = durationTo; _nextFrameIndex = durationTo;
_tweenEasing = (TweenType)tweenEasing; _tweenEasing = (CCTweenType)tweenEasing;
} }
@ -97,7 +100,7 @@ void ProcessBase::update(float dt)
} }
/* /*
* 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 dt>1, generally speaking the reason is the device is stuck.
*/ */
if(_rawDuration <= 0 || dt > 1) if(_rawDuration <= 0 || dt > 1)
@ -107,24 +110,27 @@ void ProcessBase::update(float dt)
if (_nextFrameIndex <= 0) if (_nextFrameIndex <= 0)
{ {
_currentFrame = _nextFrameIndex = 1; _currentPercent = 1;
_currentFrame = 0;
} }
else
/* {
* 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 * update _currentFrame, every update add the frame passed.
* animation speed slower or quicker. * 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); */
_currentFrame += _processScale * (dt / _animationInternal);
_currentPercent = _currentFrame / _nextFrameIndex; _currentPercent = _currentFrame / _nextFrameIndex;
/* /*
* if _currentFrame is bigger or equal than _totalFrames, then reduce it util _currentFrame is * if _currentFrame is bigger or equal than m_iTotalFrames, then reduce it util _currentFrame is
* smaller than _totalFrames * smaller than m_iTotalFrames
*/ */
_currentFrame = fmodf(_currentFrame, _nextFrameIndex); _currentFrame = fmodf(_currentFrame, _nextFrameIndex);
}
updateHandler(); updateHandler();
} }
@ -134,12 +140,13 @@ void ProcessBase::update(float dt)
void ProcessBase::gotoFrame(int frameIndex) void ProcessBase::gotoFrame(int frameIndex)
{ {
_curFrameIndex = frameIndex; _curFrameIndex = frameIndex;
stop(); pause();
} }
int ProcessBase::getCurrentFrameIndex() int ProcessBase::getCurrentFrameIndex()
{ {
_curFrameIndex = _rawDuration * _currentPercent;
return _curFrameIndex; return _curFrameIndex;
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
enum AnimationType enum AnimationType
{ {
@ -50,7 +50,7 @@ enum AnimationType
class ProcessBase : public Object class ProcessBase : public Object
{ {
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ProcessBase(void); ProcessBase(void);
@ -110,7 +110,7 @@ public:
* You should never call this function, unless you know what you do * You should never call this function, unless you know what you do
* Update the Process, include current process, current frame and son on * 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); virtual void update(float dt);
@ -125,32 +125,32 @@ protected:
virtual void updateHandler() {}; virtual void updateHandler() {};
protected: protected:
//! Scale the animation speed //! Scale the process speed
CC_SYNTHESIZE_PASS_BY_REF(float, _animationScale, AnimationScale); CC_SYNTHESIZE(float, _processScale, ProcessScale);
//! Set and get whether the aniamtion is pause //! Set and get whether the aniamtion is pause
CC_SYNTHESIZE_PASS_BY_REF(bool, _isPause, IsPause); CC_SYNTHESIZE(bool, _isPause, IsPause);
//! Set and get whether the aniamtion is complete //! Set and get whether the aniamtion is complete
CC_SYNTHESIZE_PASS_BY_REF(bool, _isComplete, IsComplete); CC_SYNTHESIZE(bool, _isComplete, IsComplete);
//! Set and get whether the aniamtion is playing //! Set and get whether the aniamtion is playing
CC_SYNTHESIZE_PASS_BY_REF(bool, _isPlaying, IsPlaying); CC_SYNTHESIZE(bool, _isPlaying, IsPlaying);
//! Current percent this process arrived //! Current percent this process arrived
CC_SYNTHESIZE_PASS_BY_REF(float, _currentPercent, CurrentPercent); CC_SYNTHESIZE(float, _currentPercent, CurrentPercent);
//! The raw duration //! The raw duration
CC_SYNTHESIZE_PASS_BY_REF(int, _rawDuration, RawDuration); CC_SYNTHESIZE(int, _rawDuration, RawDuration);
//! The animation whether or not loop //! The animation whether or not loop
CC_SYNTHESIZE_PASS_BY_REF(AnimationType, _loopType, LoopType); CC_SYNTHESIZE(AnimationType, _loopType, LoopType);
//! The tween easing effect //! The tween easing effect
CC_SYNTHESIZE_PASS_BY_REF(TweenType, _tweenEasing, TweenEasing); CC_SYNTHESIZE(CCTweenType, _tweenEasing, TweenEasing);
//! The animation update speed //! The animation update speed
CC_SYNTHESIZE_PASS_BY_REF(float, _animationInternal, AnimationInternal); CC_SYNTHESIZE(float, _animationInternal, AnimationInternal);
protected: protected:
@ -169,6 +169,6 @@ protected:
bool _isLoopBack; bool _isLoopBack;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCPROCESSBASE_H__*/ #endif /*__CCPROCESSBASE_H__*/

View File

@ -29,9 +29,10 @@ THE SOFTWARE.
#include "../CCArmature.h" #include "../CCArmature.h"
#include "../utils/CCUtilMath.h" #include "../utils/CCUtilMath.h"
#include "../utils/CCTweenFunction.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) Tween *Tween::create(Bone *bone)
{ {
@ -51,12 +52,11 @@ Tween *Tween::create(Bone *bone)
Tween::Tween() Tween::Tween()
: _movementBoneData(NULL) : _movementBoneData(NULL)
, _tweenData(NULL) , _tweenData(NULL)
, _from(NULL) , _from(NULL)
, _to(NULL) , _to(NULL)
, _between(NULL) , _between(NULL)
, _currentKeyFrame(NULL)
, _bone(NULL) , _bone(NULL)
, _frameTweenEasing(Linear) , _frameTweenEasing(Linear)
, _fromIndex(0) , _fromIndex(0)
, _toIndex(0) , _toIndex(0)
@ -83,6 +83,7 @@ bool Tween::init(Bone *bone)
_bone = bone; _bone = bone;
_tweenData = _bone->getTweenData(); _tweenData = _bone->getTweenData();
_tweenData->displayIndex = -1;
_animation = _bone->getArmature() != NULL ? _bone->getArmature()->getAnimation() : NULL; _animation = _bone->getArmature() != NULL ? _bone->getArmature()->getAnimation() : NULL;
@ -100,45 +101,47 @@ void Tween::play(MovementBoneData *movementBoneData, int durationTo, int duratio
_loopType = (AnimationType)loop; _loopType = (AnimationType)loop;
_currentKeyFrame = NULL;
_isTweenKeyFrame = false;
_totalDuration = 0; _totalDuration = 0;
betweenDuration = 0; _betweenDuration = 0;
_toIndex = 0; _fromIndex = _toIndex = 0;
bool difMovement = movementBoneData != _movementBoneData;
setMovementBoneData(movementBoneData); setMovementBoneData(movementBoneData);
_rawDuration = _movementBoneData->duration;
FrameData *nextKeyFrame = _movementBoneData->getFrameData(0);
_tweenData->displayIndex = nextKeyFrame->displayIndex;
if (_movementBoneData->frameList->count() == 1) if (_bone->getArmature()->getArmatureData()->dataVersion >= VERSION_COMBINED)
{
TransformHelp::nodeSub(*_tweenData, *_bone->getBoneData());
_tweenData->scaleX += 1;
_tweenData->scaleY += 1;
}
if (_rawDuration == 0 )
{ {
_loopType = SINGLE_FRAME; _loopType = SINGLE_FRAME;
FrameData *_nextKeyFrame = _movementBoneData->getFrameData(0);
if(durationTo == 0) if(durationTo == 0)
{ {
setBetween(_nextKeyFrame, _nextKeyFrame); setBetween(nextKeyFrame, nextKeyFrame);
} }
else else
{ {
_tweenData->displayIndex = _nextKeyFrame->displayIndex; setBetween(_tweenData, nextKeyFrame);
setBetween(_tweenData, _nextKeyFrame);
} }
_isTweenKeyFrame = true;
_frameTweenEasing = Linear; _frameTweenEasing = Linear;
_rawDuration = _movementBoneData->duration;
_fromIndex = _toIndex = 0;
} }
else if (_movementBoneData->frameList->count() > 1) else if (_movementBoneData->frameList.count() > 1)
{ {
if (loop) if (loop)
{ {
_loopType = ANIMATION_TO_LOOP_BACK; _loopType = ANIMATION_TO_LOOP_BACK;
_rawDuration = _movementBoneData->duration;
} }
else else
{ {
_loopType = ANIMATION_NO_LOOP; _loopType = ANIMATION_NO_LOOP;
_rawDuration = _movementBoneData->duration - 1;
} }
_durationTween = durationTween * _movementBoneData->scale; _durationTween = durationTween * _movementBoneData->scale;
@ -146,21 +149,25 @@ void Tween::play(MovementBoneData *movementBoneData, int durationTo, int duratio
if (loop && _movementBoneData->delay != 0) if (loop && _movementBoneData->delay != 0)
{ {
setBetween(_tweenData, tweenNodeTo(updateFrameData(1 - _movementBoneData->delay), _between)); setBetween(_tweenData, tweenNodeTo(updateFrameData(1 - _movementBoneData->delay), _between));
} }
else else
{ {
FrameData *_nextKeyFrame = _movementBoneData->getFrameData(0); if (!difMovement || durationTo == 0)
setBetween(_tweenData, _nextKeyFrame); {
_isTweenKeyFrame = true; setBetween(nextKeyFrame, nextKeyFrame);
}
else
{
setBetween(_tweenData, nextKeyFrame);
}
} }
} }
tweenNodeTo(0);
} }
void Tween::updateHandler() void Tween::updateHandler()
{ {
if (_currentPercent >= 1) if (_currentPercent >= 1)
{ {
switch(_loopType) switch(_loopType)
@ -169,6 +176,7 @@ void Tween::updateHandler()
{ {
_currentPercent = 1; _currentPercent = 1;
_isComplete = true; _isComplete = true;
_isPlaying = false;
} }
break; break;
case ANIMATION_NO_LOOP: case ANIMATION_NO_LOOP:
@ -189,6 +197,7 @@ void Tween::updateHandler()
{ {
_currentPercent = 1; _currentPercent = 1;
_isComplete = true; _isComplete = true;
_isPlaying = false;
break; break;
} }
else else
@ -196,8 +205,8 @@ void Tween::updateHandler()
_nextFrameIndex = _durationTween; _nextFrameIndex = _durationTween;
_currentFrame = _currentPercent * _nextFrameIndex; _currentFrame = _currentPercent * _nextFrameIndex;
_totalDuration = 0; _totalDuration = 0;
betweenDuration = 0; _betweenDuration = 0;
_toIndex = 0; _fromIndex = _toIndex = 0;
break; break;
} }
} }
@ -213,8 +222,6 @@ void Tween::updateHandler()
// //
_currentFrame = (1 - _movementBoneData->delay) * (float)_nextFrameIndex; _currentFrame = (1 - _movementBoneData->delay) * (float)_nextFrameIndex;
_currentPercent = _currentFrame / _nextFrameIndex; _currentPercent = _currentFrame / _nextFrameIndex;
} }
else else
{ {
@ -223,30 +230,29 @@ void Tween::updateHandler()
} }
_totalDuration = 0; _totalDuration = 0;
betweenDuration = 0; _betweenDuration = 0;
_toIndex = 0; _fromIndex = _toIndex = 0;
} }
break; break;
case ANIMATION_MAX: case ANIMATION_MAX:
{ {
_currentPercent = 1; _currentPercent = 1;
_isComplete = true; _isComplete = true;
_isPlaying = false;
} }
break; break;
default: default:
{ {
_currentPercent = fmodf(_currentPercent, 1);
_currentFrame = fmodf(_currentFrame, _nextFrameIndex); _currentFrame = fmodf(_currentFrame, _nextFrameIndex);
_totalDuration = 0; _totalDuration = 0;
betweenDuration = 0; _betweenDuration = 0;
_toIndex = 0; _fromIndex = _toIndex = 0;
} }
break; break;
} }
} }
if (_currentPercent < 1 && _loopType <= ANIMATION_TO_LOOP_BACK) if (_currentPercent < 1 && _loopType <= ANIMATION_TO_LOOP_BACK)
{ {
_currentPercent = sin(_currentPercent * CC_HALF_PI); _currentPercent = sin(_currentPercent * CC_HALF_PI);
@ -256,32 +262,28 @@ void Tween::updateHandler()
if (_loopType > ANIMATION_TO_LOOP_BACK) if (_loopType > ANIMATION_TO_LOOP_BACK)
{ {
percent = updateFrameData(percent, true); percent = updateFrameData(percent);
} }
if(_frameTweenEasing != TWEEN_EASING_MAX) if(_frameTweenEasing != TWEEN_EASING_MAX)
{ {
tweenNodeTo(percent); tweenNodeTo(percent);
} }
else if(_currentKeyFrame)
{
tweenNodeTo(0);
}
} }
void Tween::setBetween(FrameData *from, FrameData *to) void Tween::setBetween(FrameData *from, FrameData *to)
{ {
do do
{ {
if(to->displayIndex < 0 && from->displayIndex > 0) if(from->displayIndex < 0 && to->displayIndex >= 0)
{ {
_from->copy(from); _from->copy(to);
_between->subtract(to, to); _between->subtract(to, to);
break; break;
} }
else if(from->displayIndex < 0 && to->displayIndex > 0) else if(to->displayIndex < 0 && from->displayIndex >= 0)
{ {
_from->copy(to); _from->copy(from);
_between->subtract(to, to); _between->subtract(to, to);
break; break;
} }
@ -299,41 +301,37 @@ void Tween::arriveKeyFrame(FrameData *keyFrameData)
{ {
if(keyFrameData) if(keyFrameData)
{ {
DisplayManager *displayManager = _bone->getDisplayManager();
//! Change bone's display
int displayIndex = keyFrameData->displayIndex; 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
_tweenData->zOrder = keyFrameData->zOrder;
_bone->updateZOrder();
_bone->setZOrder(keyFrameData->zOrder); //! Update blend type
_bone->setBlendType(keyFrameData->blendType);
//! Update child armature's movement
Armature *childAramture = _bone->getChildArmature(); Armature *childAramture = _bone->getChildArmature();
if(childAramture) 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) FrameData *Tween::tweenNodeTo(float percent, FrameData *node)
{ {
node = node == NULL ? _tweenData : node; node = node == NULL ? _tweenData : node;
node->x = _from->x + percent * _between->x; node->x = _from->x + percent * _between->x;
@ -345,95 +343,112 @@ FrameData *Tween::tweenNodeTo(float percent, FrameData *node)
_bone->setTransformDirty(true); _bone->setTransformDirty(true);
if(_between->isUseColorInfo) if (node && _between->isUseColorInfo)
{ {
node->a = _from->a + percent * _between->a; tweenColorTo(percent, node);
node->r = _from->r + percent * _between->r;
node->g = _from->g + percent * _between->g;
node->b = _from->b + percent * _between->b;
_bone->updateColor();
} }
// 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; return node;
} }
float Tween::updateFrameData(float currentPrecent, bool activeFrame) void Tween::tweenColorTo(float percent, FrameData *node)
{ {
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();
}
float playedTime = (float)_rawDuration * currentPrecent; float Tween::updateFrameData(float currentPercent)
{
if (currentPercent > 1 && _movementBoneData->delay != 0)
{
currentPercent = fmodf(currentPercent, 1);
}
float playedTime = (float)_rawDuration * currentPercent;
FrameData *from;
FrameData *to;
bool isListEnd;
//! If play to current frame's front or back, then find current frame again //! If play to current frame's front or back, then find current frame again
if (playedTime >= _totalDuration || playedTime < _totalDuration - betweenDuration) if (playedTime < _totalDuration || playedTime >= _totalDuration + _betweenDuration)
{ {
/* /*
* Get frame length, if _toIndex >= _length, then set _toIndex to 0, start anew. * Get frame length, if _toIndex >= _length, then set _toIndex to 0, start anew.
* _toIndex is next index will play * _toIndex is next index will play
*/ */
int length = _movementBoneData->frameList->count(); int length = _movementBoneData->frameList.count();
FrameData **frames = (FrameData **)_movementBoneData->frameList.data->arr;
FrameData *from = NULL;
FrameData *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 do
{ {
betweenDuration = _movementBoneData->getFrameData(_toIndex)->duration; from = frames[_fromIndex];
_totalDuration += betweenDuration; _totalDuration = from->frameID;
_fromIndex = _toIndex;
if (++_toIndex >= length) if (++_toIndex >= length)
{ {
_toIndex = 0; _toIndex = 0;
} }
}
while (playedTime >= _totalDuration);
_fromIndex = _toIndex;
to = frames[_toIndex];
isListEnd = _loopType == ANIMATION_MAX && _toIndex == 0; //! Guaranteed to trigger frame event
if(from->strEvent.length() != 0)
{
_animation->frameEvent(_bone, from->strEvent.c_str(), from->frameID, playedTime);
}
if(isListEnd) if (playedTime == from->frameID)
{ {
to = from = _movementBoneData->getFrameData(_fromIndex); break;
} }
else
{
from = _movementBoneData->getFrameData(_fromIndex);
to = _movementBoneData->getFrameData(_toIndex);
} }
while (playedTime < from->frameID || playedTime >= to->frameID);
_betweenDuration = to->frameID - from->frameID;
_frameTweenEasing = from->tweenEasing; _frameTweenEasing = from->tweenEasing;
setBetween(from, to); setBetween(from, to);
} }
currentPrecent = 1 - (_totalDuration - playedTime) / (float)betweenDuration; currentPercent = _betweenDuration == 0 ? 0 : (playedTime - _totalDuration) / (float)_betweenDuration;
/* /*
* If frame tween easing equal to TWEEN_EASING_MAX, then it will not do tween. * 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 ( _frameTweenEasing != TWEEN_EASING_MAX)
{ {
tweenType = (_tweenEasing == TWEEN_EASING_MAX) ? _frameTweenEasing : _tweenEasing; tweenType = (_tweenEasing == TWEEN_EASING_MAX) ? _frameTweenEasing : _tweenEasing;
if (tweenType != TWEEN_EASING_MAX) if (tweenType != TWEEN_EASING_MAX && tweenType != Linear)
{ {
currentPrecent = TweenFunction::tweenTo(0, 1, currentPrecent, 1, tweenType); currentPercent = TweenFunction::tweenTo(0, 1, currentPercent, 1, tweenType);
} }
} }
return currentPrecent; return currentPercent;
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "CCProcessBase.h" #include "CCProcessBase.h"
#include "../utils/CCTweenFunction.h" #include "../utils/CCTweenFunction.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class Bone; class Bone;
class ArmatureAnimation; class ArmatureAnimation;
@ -43,7 +43,7 @@ public:
*/ */
static Tween *create(Bone *bone); static Tween *create(Bone *bone);
public: public:
/** /**
* @js ctor * @js ctor
*/ */
Tween(void); Tween(void);
@ -62,25 +62,19 @@ public:
/** /**
* Start the Process * Start the Process
* *
* @param movementBoneData the MovementBoneData include all frame datas * @param movementBoneData the MovementBoneData include all FrameData
* @param durationTo the frames between two animation changing-over. * @param durationTo the number of frames changing to this animation needs.
* It's meaning is changing to this animation need how many frames * @param durationTween the number of frames this animation actual last.
*
* -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 loop whether the animation is loop * @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 MovementData get from Action Editor
* loop = 0 : this animation is not loop * loop = 0 : this animation is not loop
* loop > 0 : this animation is loop * loop > 0 : this animation is loop
* *
* @param tweenEasing tween easing is used for calculate easing effect * @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 MovementData get from Action Editor
* -1 : fade out * -1 : fade out
* 0 : line * 0 : line
* 1 : fade in * 1 : fade in
@ -89,8 +83,14 @@ public:
*/ */
virtual void play(MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing); virtual void play(MovementBoneData *movementBoneData, int durationTo, int durationTween, int loop, int tweenEasing);
inline void setAnimation(ArmatureAnimation *animation) { _animation = animation; } inline void setAnimation(ArmatureAnimation *animation)
inline ArmatureAnimation *getAnimation() const { return _animation; } {
_animation = animation;
}
inline ArmatureAnimation *getAnimation() const
{
return _animation;
}
protected: protected:
/** /**
@ -101,7 +101,7 @@ protected:
/** /**
* Calculate which frame arrived, and if current frame have event, then call the event listener * 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 * Calculate the between value of _from and _to, and give it to between frame data
@ -113,6 +113,11 @@ protected:
*/ */
virtual FrameData *tweenNodeTo(float percent, FrameData *node = NULL); virtual FrameData *tweenNodeTo(float percent, FrameData *node = NULL);
/**
* According to the percent to calculate current color with tween effect
*/
virtual void tweenColorTo(float percent, FrameData *node);
/** /**
* Update display index and process the key frame event when arrived a key frame * Update display index and process the key frame event when arrived a key frame
*/ */
@ -124,26 +129,24 @@ protected:
FrameData *_tweenData; //! The computational tween frame data, //! A weak reference to the Bone's tweenData 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 *_from; //! From frame data, used for calculate between value
FrameData *_to; //! To 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 *_between; //! Between frame data, used for calculate current FrameData(m_pNode) 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 Bone *_bone; //! A weak reference to the Bone
TweenType _frameTweenEasing; //! Dedermine which tween effect current frame use CCTweenType _frameTweenEasing; //! Dedermine which tween effect current frame use
bool _isTweenKeyFrame; int _betweenDuration; //! Current key frame will last _betweenDuration frames
int betweenDuration; //! Current key frame will last betweenDuration frames
int _totalDuration; int _totalDuration;
int _fromIndex; //! The current frame index in FrameList of MovementBoneData, it's different from _frameIndex int _fromIndex; //! The current frame index in FrameList of MovementBoneData, it's different from m_iFrameIndex
int _toIndex; //! The next 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 m_iFrameIndex
ArmatureAnimation *_animation; ArmatureAnimation *_animation;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCTWEEN_H__*/ #endif /*__CCTWEEN_H__*/

View File

@ -24,27 +24,28 @@ THE SOFTWARE.
#include "CCDatas.h" #include "CCDatas.h"
#include "../utils/CCUtilMath.h" #include "../utils/CCUtilMath.h"
#include "../utils/CCTransformHelp.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
BaseData::BaseData() BaseData::BaseData()
: x(0.0f) : x(0.0f)
, y(0.0f) , y(0.0f)
, zOrder(0) , zOrder(0)
, skewX(0.0f) , skewX(0.0f)
, skewY(0.0f) , skewY(0.0f)
, scaleX(1.0f) , scaleX(1.0f)
, scaleY(1.0f) , scaleY(1.0f)
, tweenRotate(0.0f) , tweenRotate(0.0f)
, isUseColorInfo(false) , isUseColorInfo(false)
, a(255) , a(255)
, r(255) , r(255)
, g(255) , g(255)
, b(255) , b(255)
{ {
} }
@ -54,70 +55,86 @@ BaseData::~BaseData()
void BaseData::copy(const BaseData *node ) void BaseData::copy(const BaseData *node )
{ {
x = node->x; x = node->x;
y = node->y; y = node->y;
zOrder = node->zOrder; zOrder = node->zOrder;
scaleX = node->scaleX; scaleX = node->scaleX;
scaleY = node->scaleY; scaleY = node->scaleY;
skewX = node->skewX; skewX = node->skewX;
skewY = node->skewY; skewY = node->skewY;
tweenRotate = node->tweenRotate; tweenRotate = node->tweenRotate;
isUseColorInfo = node->isUseColorInfo; isUseColorInfo = node->isUseColorInfo;
r = node->r; r = node->r;
g = node->g; g = node->g;
b = node->b; b = node->b;
a = node->a; a = node->a;
} }
void BaseData::subtract(BaseData *from, BaseData *to) void BaseData::subtract(BaseData *from, BaseData *to)
{ {
x = to->x - from->x; x = to->x - from->x;
y = to->y - from->y; y = to->y - from->y;
scaleX = to->scaleX - from->scaleX; scaleX = to->scaleX - from->scaleX;
scaleY = to->scaleY - from->scaleY; scaleY = to->scaleY - from->scaleY;
skewX = to->skewX - from->skewX; skewX = to->skewX - from->skewX;
skewY = to->skewY - from->skewY; skewY = to->skewY - from->skewY;
if(from->isUseColorInfo || to->isUseColorInfo) if(isUseColorInfo || from->isUseColorInfo || to->isUseColorInfo)
{ {
a = to->a - from->a; a = to->a - from->a;
r = to->r - from->r; r = to->r - from->r;
g = to->g - from->g; g = to->g - from->g;
b = to->b - from->b; 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) if (skewY > M_PI)
{ {
skewX -= (float)CC_DOUBLE_PI; skewY -= (float)CC_DOUBLE_PI;
} }
if (skewX < -M_PI) if (skewY < -M_PI)
{ {
skewX += (float)CC_DOUBLE_PI; skewY += (float)CC_DOUBLE_PI;
} }
if (skewY > M_PI) if (to->tweenRotate)
{ {
skewY -= (float)CC_DOUBLE_PI; skewX += to->tweenRotate;
} skewY -= to->tweenRotate;
if (skewY < -M_PI) }
{
skewY += (float)CC_DOUBLE_PI;
}
if (to->tweenRotate)
{
skewX += to->tweenRotate;
skewY -= to->tweenRotate;
}
} }
void BaseData::setColor(const Color4B &color)
{
r = color.r;
g = color.g;
b = color.b;
a = color.a;
}
Color4B BaseData::getColor()
{
return Color4B(r, g, b, a);
}
const char *DisplayData::changeDisplayToTexture(const char *displayName) const char *DisplayData::changeDisplayToTexture(const char *displayName)
{ {
@ -134,7 +151,7 @@ const char *DisplayData::changeDisplayToTexture(const char *displayName)
} }
DisplayData::DisplayData(void) DisplayData::DisplayData(void)
: displayType(CS_DISPLAY_SPRITE) : displayType(CS_DISPLAY_MAX)
{ {
} }
@ -156,6 +173,8 @@ void SpriteDisplayData::copy(SpriteDisplayData *displayData)
{ {
displayName = displayData->displayName; displayName = displayData->displayName;
displayType = displayData->displayType; displayType = displayData->displayType;
skinData = displayData->skinData;
} }
ArmatureDisplayData::ArmatureDisplayData(void) ArmatureDisplayData::ArmatureDisplayData(void)
@ -186,20 +205,6 @@ void ParticleDisplayData::copy(ParticleDisplayData *displayData)
displayType = displayData->displayType; 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) BoneData::BoneData(void)
: name("") : name("")
@ -209,67 +214,60 @@ BoneData::BoneData(void)
BoneData::~BoneData(void) BoneData::~BoneData(void)
{ {
CC_SAFE_RELEASE(displayDataList);
} }
bool BoneData::init() bool BoneData::init()
{ {
displayDataList = new Array; displayDataList.init();
displayDataList->init();
return true; return true;
} }
void BoneData::addDisplayData(DisplayData *displayData) void BoneData::addDisplayData(DisplayData *displayData)
{ {
displayDataList->addObject(displayData); displayDataList.addObject(displayData);
} }
DisplayData *BoneData::getDisplayData(int index) DisplayData *BoneData::getDisplayData(int index)
{ {
return static_cast<DisplayData *>( displayDataList->getObjectAtIndex(index) ); return static_cast<DisplayData *>(displayDataList.getObjectAtIndex(index));
} }
ArmatureData::ArmatureData() ArmatureData::ArmatureData()
: dataVersion(0.1f)
{ {
} }
ArmatureData::~ArmatureData() ArmatureData::~ArmatureData()
{ {
CC_SAFE_RELEASE(boneList);
CC_SAFE_RELEASE(boneDataDic);
} }
bool ArmatureData::init() bool ArmatureData::init()
{ {
boneList = new Array;
boneList->init();
boneDataDic = new Dictionary;
boneDataDic->init();
return true; return true;
} }
void ArmatureData::addBoneData(BoneData *boneData) void ArmatureData::addBoneData(BoneData *boneData)
{ {
boneDataDic->setObject(boneData, boneData->name); boneDataDic.setObject(boneData, boneData->name);
boneList->addObject(boneData);
} }
BoneData *ArmatureData::getBoneData(const char *boneName) BoneData *ArmatureData::getBoneData(const char *boneName)
{ {
return static_cast<BoneData *>( boneDataDic->objectForKey(boneName) ); return static_cast<BoneData*>(boneDataDic.objectForKey(boneName));
} }
FrameData::FrameData(void) FrameData::FrameData(void)
: duration(1) : frameID(0)
, duration(1)
, tweenEasing(Linear) , tweenEasing(Linear)
, displayIndex(0) , displayIndex(0)
, blendType(BLEND_NORMAL)
, _movement("") , strEvent("")
, _event("") , strMovement("")
, _sound("") , strSound("")
, _soundEffect("") , strSoundEffect("")
{ {
} }
@ -277,13 +275,17 @@ FrameData::~FrameData(void)
{ {
} }
void FrameData::copy(FrameData *frameData) void FrameData::copy(const BaseData *baseData)
{ {
BaseData::copy(frameData); BaseData::copy(baseData);
duration = frameData->duration; if (const FrameData *frameData = dynamic_cast<const FrameData*>(baseData))
displayIndex = frameData->displayIndex; {
tweenEasing = frameData->tweenEasing; duration = frameData->duration;
displayIndex = frameData->displayIndex;
tweenEasing = frameData->tweenEasing;
blendType = frameData->blendType;
}
} }
MovementBoneData::MovementBoneData() MovementBoneData::MovementBoneData()
@ -292,113 +294,101 @@ MovementBoneData::MovementBoneData()
, duration(0) , duration(0)
, name("") , name("")
{ {
frameList = new Array;
frameList->init();
} }
MovementBoneData::~MovementBoneData(void) MovementBoneData::~MovementBoneData(void)
{ {
CC_SAFE_RELEASE(frameList);
} }
bool MovementBoneData::init() bool MovementBoneData::init()
{ {
return true; return frameList.init();
} }
void MovementBoneData::addFrameData(FrameData *frameData) void MovementBoneData::addFrameData(FrameData *frameData)
{ {
frameList->addObject(frameData); frameList.addObject(frameData);
duration += frameData->duration;
} }
FrameData *MovementBoneData::getFrameData(int index) FrameData *MovementBoneData::getFrameData(int index)
{ {
return static_cast<FrameData *>( frameList->getObjectAtIndex(index) ); return static_cast<FrameData*>(frameList.getObjectAtIndex(index));
} }
MovementData::MovementData(void) MovementData::MovementData(void)
: name("") : name("")
, duration(0) , duration(0)
, scale(1.0f)
, durationTo(0) , durationTo(0)
, durationTween(0) , durationTween(0)
, loop(true) , loop(true)
, tweenEasing(Linear) , tweenEasing(Linear)
{ {
movBoneDataDic = new Dictionary;
movBoneDataDic->init();
} }
MovementData::~MovementData(void) MovementData::~MovementData(void)
{ {
CC_SAFE_RELEASE(movBoneDataDic);
} }
void MovementData::addMovementBoneData(MovementBoneData *movBoneData) void MovementData::addMovementBoneData(MovementBoneData *movBoneData)
{ {
movBoneDataDic->setObject(movBoneData, movBoneData->name); movBoneDataDic.setObject(movBoneData, movBoneData->name);
} }
MovementBoneData *MovementData::getMovementBoneData(const char *boneName) MovementBoneData *MovementData::getMovementBoneData(const char *boneName)
{ {
return static_cast<MovementBoneData *>( movBoneDataDic->objectForKey(boneName) ); return static_cast<MovementBoneData *>(movBoneDataDic.objectForKey(boneName));
} }
AnimationData::AnimationData(void) AnimationData::AnimationData(void)
{ {
movementDataDic = new Dictionary;
movementDataDic->init();
} }
AnimationData::~AnimationData(void) AnimationData::~AnimationData(void)
{ {
CC_SAFE_RELEASE(movementDataDic);
}
void AnimationData::release()
{
Object::release();
}
void AnimationData::retain()
{
Object::retain();
} }
void AnimationData::addMovement(MovementData *movData) void AnimationData::addMovement(MovementData *movData)
{ {
movementDataDic->setObject(movData, movData->name); movementDataDic.setObject(movData, movData->name);
movementNames.push_back(movData->name); movementNames.push_back(movData->name);
} }
MovementData *AnimationData::getMovement(const char *movementName) MovementData *AnimationData::getMovement(const char *movementName)
{ {
return (MovementData *)movementDataDic->objectForKey(movementName); return static_cast<MovementData *>(movementDataDic.objectForKey(movementName));
} }
int AnimationData::getMovementCount() int AnimationData::getMovementCount()
{ {
return movementDataDic->count(); return movementDataDic.count();
} }
ContourData::ContourData() ContourData::ContourData()
{ {
vertexList = new Array;
vertexList->init();
} }
ContourData::~ContourData() ContourData::~ContourData()
{ {
CC_SAFE_RELEASE(vertexList);
} }
bool ContourData::init() bool ContourData::init()
{ {
return true; return vertexList.init();
}
void ContourData::addVertex(Point *vertex)
{
ContourVertex2 *vertex2 = new ContourVertex2(vertex->x, vertex->y);
vertex2->autorelease();
vertexList.addObject(vertex2);
} }
TextureData::TextureData() TextureData::TextureData()
@ -408,29 +398,26 @@ TextureData::TextureData()
, pivotY(0.5f) , pivotY(0.5f)
, name("") , name("")
{ {
contourDataList = new Array;
contourDataList->init();
} }
TextureData::~TextureData() TextureData::~TextureData()
{ {
CC_SAFE_RELEASE(contourDataList);
} }
bool TextureData::init() bool TextureData::init()
{ {
return true; return contourDataList.init();
} }
void TextureData::addContourData(ContourData *contourData) void TextureData::addContourData(ContourData *contourData)
{ {
contourDataList->addObject(contourData); contourDataList.addObject(contourData);
} }
ContourData *TextureData::getContourData(int index) ContourData *TextureData::getContourData(int index)
{ {
return static_cast<ContourData *>( contourDataList->getObjectAtIndex(index) ); return static_cast<ContourData *>(contourDataList.getObjectAtIndex(index));
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -29,43 +29,43 @@ THE SOFTWARE.
#include "../utils/CCTweenFunction.h" #include "../utils/CCTweenFunction.h"
#define CS_CREATE_NO_PARAM_NO_INIT(varType)\ #define CC_CREATE_NO_PARAM_NO_INIT(varType)\
public: \ public: \
static inline varType *create(void){ \ static inline varType *create(void){ \
varType *var = new varType();\ varType *var = new varType();\
if (var)\ if (var)\
{\ {\
var->autorelease();\ var->autorelease();\
return var;\ return var;\
}\ }\
CC_SAFE_DELETE(var);\ CC_SAFE_DELETE(var);\
return NULL;\ return NULL;\
} }
#define CS_CREATE_NO_PARAM(varType)\ #define CC_CREATE_NO_PARAM(varType)\
public: \ public: \
static inline varType *create(void){ \ static inline varType *create(void){ \
varType *var = new varType();\ varType *var = new varType();\
if (var && var->init())\ if (var && var->init())\
{\ {\
var->autorelease();\ var->autorelease();\
return var;\ return var;\
}\ }\
CC_SAFE_DELETE(var);\ CC_SAFE_DELETE(var);\
return NULL;\ 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 BaseData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(BaseData) CC_CREATE_NO_PARAM_NO_INIT(BaseData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
BaseData(); BaseData();
@ -76,8 +76,8 @@ public:
~BaseData(void); ~BaseData(void);
/* /*
* Copy datas from node * Copy data from node
* @param node A BaseData to copy datas * @param node A BaseData to copy data
*/ */
virtual void copy(const BaseData *node); virtual void copy(const BaseData *node);
@ -88,10 +88,13 @@ public:
* @param to to BaseData * @param to to BaseData
*/ */
virtual void subtract(BaseData *from, BaseData *to); virtual void subtract(BaseData *from, BaseData *to);
virtual void setColor(const Color4B &color);
virtual Color4B getColor();
public: public:
float x; //! position x attribute float x; //! position x attribute
float y; //! position y attribute float y; //! position y attribute
int zOrder; //! zorder attribute, used to order the Bone's depth order int zOrder; //! zorder attribute, used to order the Bone's depth order
/** /**
* x y skewX skewY scaleX scaleY used to calculate transform matrix * x y skewX skewY scaleX scaleY used to calculate transform matrix
@ -103,23 +106,22 @@ public:
float scaleX; float scaleX;
float scaleY; 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; int a, r, g, b;
}; };
/** /**
* DisplayType distinguish which type you display is. * DisplayType distinguish which type your display is.
*/ */
enum DisplayType enum DisplayType
{ {
CS_DISPLAY_SPRITE, //! display is a single Sprite CS_DISPLAY_SPRITE, //! display is a single Sprite
CS_DISPLAY_ARMATURE, //! display is a Armature CS_DISPLAY_ARMATURE, //! display is a Armature
CS_DISPLAY_PARTICLE, //! display is a Particle. CS_DISPLAY_PARTICLE, //! display is a CCParticle.
CS_DISPLAY_SHADER, //! display is a shader
CS_DISPLAY_MAX CS_DISPLAY_MAX
}; };
@ -127,11 +129,11 @@ enum DisplayType
class DisplayData : public Object class DisplayData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(DisplayData) CC_CREATE_NO_PARAM_NO_INIT(DisplayData)
static const char *changeDisplayToTexture(const char *); static const char *changeDisplayToTexture(const char *displayName);
public: public:
/** /**
* @js ctor * @js ctor
*/ */
DisplayData(); DisplayData();
@ -149,9 +151,9 @@ public:
class SpriteDisplayData : public DisplayData class SpriteDisplayData : public DisplayData
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(SpriteDisplayData) CC_CREATE_NO_PARAM_NO_INIT(SpriteDisplayData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
SpriteDisplayData(); SpriteDisplayData();
@ -168,23 +170,24 @@ public:
void copy(SpriteDisplayData *displayData); void copy(SpriteDisplayData *displayData);
public: public:
/** /**
* If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from SpriteFrameCache. * If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from CCSpriteFrameCache.
* 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". * It should note that when use this name to create Sprite from CCSpriteFrameCache, 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, * 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. * then Bone will create a Armature.
*/ */
std::string displayName; std::string displayName;
BaseData skinData;
}; };
class ArmatureDisplayData : public DisplayData class ArmatureDisplayData : public DisplayData
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(ArmatureDisplayData) CC_CREATE_NO_PARAM_NO_INIT(ArmatureDisplayData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ArmatureDisplayData(); ArmatureDisplayData();
@ -201,8 +204,8 @@ public:
void copy(ArmatureDisplayData *displayData); void copy(ArmatureDisplayData *displayData);
public: public:
/** /**
* If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from SpriteFrameCache. * If DisplayType is CS_DISPLAY_SPRITE, then Bone will use this image name to create a Sprite from CCSpriteFrameCache.
* 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". * It should note that when use this name to create Sprite from CCSpriteFrameCache, 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, * 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. * then Bone will create a Armature.
@ -215,9 +218,9 @@ public:
class ParticleDisplayData : public DisplayData class ParticleDisplayData : public DisplayData
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(ParticleDisplayData) CC_CREATE_NO_PARAM_NO_INIT(ParticleDisplayData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ParticleDisplayData(); ParticleDisplayData();
@ -238,33 +241,6 @@ public:
}; };
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 used to init a Bone.
@ -274,9 +250,9 @@ public:
class BoneData : public BaseData class BoneData : public BaseData
{ {
public: public:
CS_CREATE_NO_PARAM(BoneData) CC_CREATE_NO_PARAM(BoneData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
BoneData(void); BoneData(void);
@ -291,23 +267,24 @@ public:
void addDisplayData(DisplayData *displayData); void addDisplayData(DisplayData *displayData);
DisplayData *getDisplayData(int index); DisplayData *getDisplayData(int index);
public: public:
std::string name; //! the bone's name std::string name; //! the bone's name
std::string parentName; //! the bone parent's name std::string parentName; //! the bone parent's name
Array *displayDataList; //! save DisplayData informations for the Bone Array displayDataList; //! save DisplayData informations for the Bone
AffineTransform boneDataTransform;
}; };
/** /**
* ArmatureData saved the Armature name and Bonedatas needed for the Bones in this Armature * ArmatureData saved the Armature name and Bonedata needed for the CCBones in this Armature
* When we create a Armature, we need to get each Bone's BoneData as it's init information. * 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. * So we can get a BoneData from the Dictionary saved in the ArmatureData.
*/ */
class ArmatureData : public Object class ArmatureData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM(ArmatureData) CC_CREATE_NO_PARAM(ArmatureData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ArmatureData(); ArmatureData();
@ -322,17 +299,35 @@ public:
BoneData *getBoneData(const char *boneName); BoneData *getBoneData(const char *boneName);
public: public:
std::string name; std::string name;
Dictionary *boneDataDic; Dictionary boneDataDic;
Array *boneList; float dataVersion;
};
enum BlendType
{
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 FrameData : public BaseData
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(FrameData) CC_CREATE_NO_PARAM_NO_INIT(FrameData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
FrameData(); FrameData();
@ -342,33 +337,36 @@ public:
*/ */
~FrameData(); ~FrameData();
virtual void copy(FrameData *frameData); virtual void copy(const BaseData *baseData);
public: public:
int duration; //! The frame will last _duration frames int frameID;
TweenType tweenEasing; //! Every frame's tween easing effect 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. * 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; int displayIndex;
BlendType 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 strMovement;
std::string _event; std::string strSound;
std::string _sound; std::string strSoundEffect;
std::string _soundEffect;
}; };
class MovementBoneData : public Object class MovementBoneData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM(MovementBoneData) CC_CREATE_NO_PARAM(MovementBoneData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
MovementBoneData(); MovementBoneData();
@ -383,21 +381,21 @@ public:
void addFrameData(FrameData *frameData); void addFrameData(FrameData *frameData);
FrameData *getFrameData(int index); FrameData *getFrameData(int index);
public: public:
float delay; //! movement delay percent, this value can produce a delay effect float delay; //! movement delay percent, this value can produce a delay effect
float scale; //! scale this movement float scale; //! scale this movement
float duration; //! this Bone in this movement will last _duration frames float duration; //! this Bone in this movement will last m_iDuration frames
std::string name; //! bone name std::string name; //! bone name
Array *frameList; Array frameList;
}; };
class MovementData : public Object class MovementData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(MovementData) CC_CREATE_NO_PARAM_NO_INIT(MovementData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
MovementData(void); MovementData(void);
@ -412,35 +410,38 @@ public:
public: public:
std::string name; std::string name;
int duration; //! the frames this movement will last 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. * change to "run" instead of changing to "run" directly.
*/ */
int durationTo; int durationTo;
/* /*
* This is different from _duration, _durationTween contain 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.
* 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 * 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; int durationTween;
bool loop; //! whether the movement is looped bool loop; //! whether the movement was looped
/** /**
* Which tween easing effect the movement use * 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 MovementData get from flash design panel
*/ */
TweenType tweenEasing; CCTweenType tweenEasing;
/** /**
* Dictionary to save movment bone data. * @brief save movment bone data
* Key type is std::string, value type is MovementBoneData *. * @key const char *
*/ * @value MovementBoneData *
Dictionary *movBoneDataDic; */
Dictionary movBoneDataDic;
}; };
@ -452,9 +453,9 @@ public:
class AnimationData : public Object class AnimationData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM_NO_INIT(AnimationData) CC_CREATE_NO_PARAM_NO_INIT(AnimationData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
AnimationData(void); AnimationData(void);
@ -464,22 +465,19 @@ public:
*/ */
~AnimationData(void); ~AnimationData(void);
void release();
void retain();
void addMovement(MovementData *movData); void addMovement(MovementData *movData);
MovementData *getMovement(const char *movementName); MovementData *getMovement(const char *movementName);
int getMovementCount(); int getMovementCount();
public: public:
std::string name; std::string name;
Dictionary *movementDataDic; Dictionary movementDataDic;
std::vector<std::string> movementNames; std::vector<std::string> movementNames;
}; };
struct ContourVertex2F : public Object struct ContourVertex2 : public Object
{ {
ContourVertex2F(float x, float y) ContourVertex2(float x, float y)
{ {
this->x = x; this->x = x;
this->y = y; this->y = y;
@ -495,9 +493,9 @@ struct ContourVertex2F : public Object
class ContourData : public Object class ContourData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM(ContourData) CC_CREATE_NO_PARAM(ContourData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ContourData(); ContourData();
@ -508,8 +506,9 @@ public:
~ContourData(void); ~ContourData(void);
virtual bool init(); virtual bool init();
virtual void addVertex(Point *vertex);
public: public:
Array *vertexList; //! Save contour vertex info, vertex saved in a Point Array vertexList; //! Save contour vertex info, vertex saved in a Point
}; };
@ -521,9 +520,9 @@ public:
class TextureData : public Object class TextureData : public Object
{ {
public: public:
CS_CREATE_NO_PARAM(TextureData) CC_CREATE_NO_PARAM(TextureData)
public: public:
/** /**
* @js ctor * @js ctor
*/ */
TextureData(); TextureData();
@ -539,18 +538,18 @@ public:
ContourData *getContourData(int index); ContourData *getContourData(int index);
public: public:
float height; //! The texture's width, height float height; //! The texture's width, height
float width; float width;
float pivotX; //! The texture's anchor point float pivotX; //! The texture's anchor point
float pivotY; 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__*/ #endif /*__CCARMATURE_DATAS_H__*/

View File

@ -26,7 +26,7 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../CCArmature.h" #include "../CCArmature.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
BatchNode *BatchNode::create() BatchNode *BatchNode::create()
{ {
@ -48,7 +48,7 @@ BatchNode::BatchNode()
bool BatchNode::init() bool BatchNode::init()
{ {
bool ret = Node::init(); bool ret = Node::init();
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
return ret; return ret;
} }
@ -106,7 +106,7 @@ void BatchNode::draw()
} }
else else
{ {
static_cast<Node*>(object)->visit(); ((Node *)object)->visit();
} }
} }
@ -117,4 +117,4 @@ void BatchNode::draw()
} }
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -27,13 +27,16 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class BatchNode : public Node class BatchNode : public Node
{ {
public: public:
static BatchNode *create(); static BatchNode *create();
public: public:
/**
* @js ctor
*/
BatchNode(); BatchNode();
virtual bool init(); virtual bool init();
@ -45,6 +48,6 @@ protected:
TextureAtlas *_atlas; TextureAtlas *_atlas;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCBATCHNODE_H__*/ #endif /*__CCBATCHNODE_H__*/

View File

@ -23,9 +23,8 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCDecorativeDisplay.h" #include "CCDecorativeDisplay.h"
#include "../utils/CCConstValue.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
DecorativeDisplay *DecorativeDisplay::create() DecorativeDisplay *DecorativeDisplay::create()
{ {
@ -44,7 +43,7 @@ DecorativeDisplay::DecorativeDisplay()
, _displayData(NULL) , _displayData(NULL)
{ {
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
_colliderDetector = NULL; _colliderDetector = NULL;
#endif #endif
} }
@ -55,7 +54,7 @@ DecorativeDisplay::~DecorativeDisplay(void)
CC_SAFE_RELEASE_NULL(_displayData); CC_SAFE_RELEASE_NULL(_displayData);
CC_SAFE_RELEASE_NULL(_display); CC_SAFE_RELEASE_NULL(_display);
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
CC_SAFE_RELEASE_NULL(_colliderDetector); CC_SAFE_RELEASE_NULL(_colliderDetector);
#endif #endif
} }
@ -65,9 +64,4 @@ bool DecorativeDisplay::init()
return true; return true;
} }
NS_CC_EXT_ARMATURE_END
void DecorativeDisplay::anchorPointChanged(float pointX, float pointY)
{
}
}}} // namespace cocos2d { namespace extension { namespace armature {

View File

@ -28,21 +28,20 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "CCDisplayFactory.h" #include "CCDisplayFactory.h"
#include "../datas/CCDatas.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" #include "../physics/CCColliderDetector.h"
#endif #endif
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class DecorativeDisplay: public Object, public sigslot::has_slots<> class DecorativeDisplay: public Object
{ {
public: public:
static DecorativeDisplay *create(); static DecorativeDisplay *create();
public: public:
/** /**
* @js ctor * @js ctor
*/ */
DecorativeDisplay(void); DecorativeDisplay(void);
@ -59,13 +58,11 @@ protected:
CC_SYNTHESIZE_RETAIN(Node *, _display, Display); CC_SYNTHESIZE_RETAIN(Node *, _display, Display);
CC_SYNTHESIZE_RETAIN(DisplayData *, _displayData, DisplayData); CC_SYNTHESIZE_RETAIN(DisplayData *, _displayData, DisplayData);
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
CC_SYNTHESIZE_RETAIN(ColliderDetector *, _colliderDetector, ColliderDetector); CC_SYNTHESIZE_RETAIN(ColliderDetector *, _colliderDetector, ColliderDetector);
#endif #endif
public:
void anchorPointChanged(float pointX, float pointY);
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCDECORATIVEDISPLAY_H__*/ #endif /*__CCDECORATIVEDISPLAY_H__*/

View File

@ -26,12 +26,11 @@ THE SOFTWARE.
#include "../CCBone.h" #include "../CCBone.h"
#include "../CCArmature.h" #include "../CCArmature.h"
#include "../display/CCSkin.h" #include "../display/CCSkin.h"
#include "../display/CCShaderNode.h"
#include "../utils/CCSpriteFrameCacheHelper.h" #include "../utils/CCSpriteFrameCacheHelper.h"
#include "../utils/CCArmatureDataManager.h" #include "../utils/CCArmatureDataManager.h"
#include "../utils/CCTransformHelp.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 DisplayFactory::addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData)
{ {
@ -73,32 +72,48 @@ void DisplayFactory::updateDisplay(Bone *bone, DecorativeDisplay *decoDisplay, f
{ {
CS_RETURN_IF(!decoDisplay); CS_RETURN_IF(!decoDisplay);
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
if (dirty) if (dirty)
{ {
ColliderDetector *detector = decoDisplay->getColliderDetector(); ColliderDetector *detector = decoDisplay->getColliderDetector();
if (detector) if (detector)
{ {
AffineTransform t = AffineTransformConcat(bone->nodeToArmatureTransform(), bone->getArmature()->getNodeToWorldTransform()); do
detector->updateTransform(t); {
CC_BREAK_IF(!detector->getBody());
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 #endif
Node *display = decoDisplay->getDisplay();
switch(decoDisplay->getDisplayData()->displayType) switch(decoDisplay->getDisplayData()->displayType)
{ {
case CS_DISPLAY_SPRITE: case CS_DISPLAY_SPRITE:
updateSpriteDisplay(bone, decoDisplay, dt, dirty); updateSpriteDisplay(bone, display, dt, dirty);
break; break;
case CS_DISPLAY_PARTICLE: case CS_DISPLAY_PARTICLE:
updateParticleDisplay(bone, decoDisplay, dt, dirty); updateParticleDisplay(bone, display, dt, dirty);
break; break;
case CS_DISPLAY_ARMATURE: case CS_DISPLAY_ARMATURE:
updateArmatureDisplay(bone, decoDisplay, dt, dirty); updateArmatureDisplay(bone, display, dt, dirty);
break; break;
default: default:
break; {
display->setAdditionalTransform(bone->getNodeToArmatureTransform());
}
break;
} }
} }
@ -118,7 +133,6 @@ void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisp
SpriteDisplayData *displayData = (SpriteDisplayData *)decoDisplay->getDisplayData(); SpriteDisplayData *displayData = (SpriteDisplayData *)decoDisplay->getDisplayData();
//! remove .xxx
std::string textureName = displayData->displayName; std::string textureName = displayData->displayName;
size_t startPos = textureName.find_last_of("."); size_t startPos = textureName.find_last_of(".");
@ -137,38 +151,64 @@ void DisplayFactory::createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisp
skin = Skin::createWithSpriteFrameName((textureName + ".png").c_str()); skin = Skin::createWithSpriteFrameName((textureName + ".png").c_str());
} }
TextureAtlas *atlas = SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->getTextureAtlas((textureName + ".png").c_str()); skin->setBone(bone);
skin->setTextureAtlas(atlas);
TextureData *textureData = ArmatureDataManager::sharedArmatureDataManager()->getTextureData(textureName.c_str()); initSpriteDisplay(bone, decoDisplay, displayData->displayName.c_str(), skin);
Armature *armature = bone->getArmature();
if (armature)
{
if (armature->getArmatureData()->dataVersion >= VERSION_COMBINED)
{
skin->setSkinData(displayData->skinData);
}
else
{
skin->setSkinData(*bone->getBoneData());
}
}
decoDisplay->setDisplay(skin);
}
void DisplayFactory::initSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, const char *displayName, Skin *skin)
{
//! remove .xxx
std::string textureName = displayName;
size_t startPos = textureName.find_last_of(".");
if(startPos != std::string::npos)
{
textureName = textureName.erase(startPos);
}
TextureData *textureData = ArmatureDataManager::getInstance()->getTextureData(textureName.c_str());
if(textureData) if(textureData)
{ {
//! Init display anchorPoint, every Texture have a anchor point //! Init display anchorPoint, every Texture have a anchor point
skin->setAnchorPoint(Point( textureData->pivotX, textureData->pivotY)); skin->setAnchorPoint(Point( textureData->pivotX, textureData->pivotY));
} }
skin->setBone(bone);
skin->setSkinData(*bone->getBoneData());
decoDisplay->setDisplay(skin); #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
if (textureData && textureData->contourDataList.count() > 0)
#if ENABLE_PHYSICS_DETECT
if (textureData && textureData->contourDataList->count() > 0)
{ {
//! create ContourSprite //! create ContourSprite
ColliderDetector *colliderDetector = ColliderDetector::create(bone); ColliderDetector *colliderDetector = ColliderDetector::create(bone);
colliderDetector->addContourDataList(textureData->contourDataList); colliderDetector->addContourDataList(&textureData->contourDataList);
decoDisplay->setColliderDetector(colliderDetector); decoDisplay->setColliderDetector(colliderDetector);
} }
#endif #endif
} }
void DisplayFactory::updateSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty) void DisplayFactory::updateSpriteDisplay(Bone *bone, Node *display, float dt, bool dirty)
{ {
Skin *skin = (Skin *)decoDisplay->getDisplay(); CS_RETURN_IF(!dirty);
skin->updateTransform(); Skin *skin = (Skin *)display;
skin->updateArmatureTransform();
} }
@ -194,11 +234,9 @@ void DisplayFactory::createArmatureDisplay(Bone *bone, DecorativeDisplay *decoDi
decoDisplay->setDisplay(armature); decoDisplay->setDisplay(armature);
} }
void DisplayFactory::updateArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty) void DisplayFactory::updateArmatureDisplay(Bone *bone, Node *display, float dt, bool dirty)
{ {
CS_RETURN_IF(!dirty); Armature *armature = (Armature *)display;
Armature *armature = bone->getChildArmature();
if(armature) if(armature)
{ {
armature->sortAllChildren(); armature->sortAllChildren();
@ -222,11 +260,11 @@ void DisplayFactory::createParticleDisplay(Bone *bone, DecorativeDisplay *decoDi
ParticleSystem *system = ParticleSystemQuad::create(displayData->plist.c_str()); ParticleSystem *system = ParticleSystemQuad::create(displayData->plist.c_str());
decoDisplay->setDisplay(system); decoDisplay->setDisplay(system);
} }
void DisplayFactory::updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty) void DisplayFactory::updateParticleDisplay(Bone *bone, Node *display, float dt, bool dirty)
{ {
ParticleSystem *system = (ParticleSystem *)decoDisplay->getDisplay(); ParticleSystem *system = (ParticleSystem *)display;
BaseData node; BaseData node;
TransformHelp::matrixToNode(bone->nodeToArmatureTransform(), node); TransformHelp::matrixToNode(bone->getNodeToArmatureTransform(), node);
system->setPosition(node.x, node.y); system->setPosition(node.x, node.y);
system->setScaleX(node.scaleX); system->setScaleX(node.scaleX);
system->setScaleY(node.scaleY); system->setScaleY(node.scaleY);
@ -234,20 +272,4 @@ void DisplayFactory::updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDi
} }
NS_CC_EXT_ARMATURE_END
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 {

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class Skin; class Skin;
class Bone; class Bone;
@ -38,28 +38,26 @@ class DisplayData;
class DisplayFactory class DisplayFactory
{ {
public: public:
static void addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData); static void addDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
static void createDisplay(Bone *bone, DecorativeDisplay *decoDisplay); static void createDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
static void updateDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty); static void updateDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty);
static void addSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData); static void addSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
static void createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay); static void createSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
static void updateSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty); static void initSpriteDisplay(Bone *bone, DecorativeDisplay *decoDisplay, const char *displayName, Skin *skin);
static void updateSpriteDisplay(Bone *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 addArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
static void createParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay); static void createArmatureDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
static void updateParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, float dt, bool dirty); static void updateArmatureDisplay(Bone *bone, Node *display, float dt, bool dirty);
static void addShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
static void createShaderDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
static void addParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay, DisplayData *displayData);
static void createParticleDisplay(Bone *bone, DecorativeDisplay *decoDisplay);
static void updateParticleDisplay(Bone *bone, Node *display, float dt, bool dirty);
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCDISPLAYFACTORY_H__*/ #endif /*__CCDISPLAYFACTORY_H__*/

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "../utils/CCUtilMath.h" #include "../utils/CCUtilMath.h"
#include "../display/CCSkin.h" #include "../display/CCSkin.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
DisplayManager *DisplayManager::create(Bone *bone) DisplayManager *DisplayManager::create(Bone *bone)
{ {
@ -44,12 +44,12 @@ DisplayManager *DisplayManager::create(Bone *bone)
DisplayManager::DisplayManager() DisplayManager::DisplayManager()
: _decoDisplayList(NULL) : _decoDisplayList(NULL)
, _displayRenderNode(NULL) , _displayRenderNode(NULL)
, _currentDecoDisplay(NULL) , _currentDecoDisplay(NULL)
, _displayIndex(-1) , _displayIndex(-1)
, _forceChangeDisplay(false) , _forceChangeDisplay(false)
, _visible(true) , _visible(true)
, _bone(NULL) , _bone(NULL)
{ {
} }
@ -110,6 +110,63 @@ void DisplayManager::addDisplay(DisplayData *displayData, int index)
} }
} }
void DisplayManager::addDisplay(Node *display, int index)
{
DecorativeDisplay *decoDisplay = NULL;
if(index >= 0 && (unsigned int)index < _decoDisplayList->count())
{
decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
}
else
{
decoDisplay = DecorativeDisplay::create();
_decoDisplayList->addObject(decoDisplay);
}
DisplayData *displayData = NULL;
if (Skin *skin = dynamic_cast<Skin *>(display))
{
skin->setBone(_bone);
displayData = SpriteDisplayData::create();
DisplayFactory::initSpriteDisplay(_bone, decoDisplay, skin->getDisplayName().c_str(), skin);
if (SpriteDisplayData *spriteDisplayData = (SpriteDisplayData *)decoDisplay->getDisplayData())
{
skin->setSkinData(spriteDisplayData->skinData);
}
else
{
BaseData baseData;
skin->setSkinData(baseData);
}
}
else if (dynamic_cast<ParticleSystemQuad *>(display))
{
displayData = ParticleDisplayData::create();
}
else if(Armature *armature = dynamic_cast<Armature *>(display))
{
displayData = ArmatureDisplayData::create();
armature->setParentBone(_bone);
}
else
{
displayData = DisplayData::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 == _displayIndex)
{
_displayIndex = -1;
changeDisplayByIndex(index, false);
}
}
void DisplayManager::removeDisplay(int index) void DisplayManager::removeDisplay(int index)
{ {
_decoDisplayList->removeObjectAtIndex(index); _decoDisplayList->removeObjectAtIndex(index);
@ -120,6 +177,11 @@ void DisplayManager::removeDisplay(int index)
} }
} }
Array *DisplayManager::getDecorativeDisplayList()
{
return _decoDisplayList;
}
void DisplayManager::changeDisplayByIndex(int index, bool force) void DisplayManager::changeDisplayByIndex(int index, bool force)
{ {
CCASSERT( (_decoDisplayList ? index < (int)_decoDisplayList->count() : true), "the _index value is out of range"); CCASSERT( (_decoDisplayList ? index < (int)_decoDisplayList->count() : true), "the _index value is out of range");
@ -152,7 +214,7 @@ void DisplayManager::changeDisplayByIndex(int index, bool force)
void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay) void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay)
{ {
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector()) if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector())
{ {
_currentDecoDisplay->getColliderDetector()->setActive(false); _currentDecoDisplay->getColliderDetector()->setActive(false);
@ -161,7 +223,7 @@ void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay)
_currentDecoDisplay = decoDisplay; _currentDecoDisplay = decoDisplay;
#if ENABLE_PHYSICS_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT || ENABLE_PHYSICS_CHIPMUNK_DETECT
if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector()) if (_currentDecoDisplay && _currentDecoDisplay->getColliderDetector())
{ {
_currentDecoDisplay->getColliderDetector()->setActive(true); _currentDecoDisplay->getColliderDetector()->setActive(true);
@ -175,7 +237,6 @@ void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay)
{ {
_bone->setChildArmature(NULL); _bone->setChildArmature(NULL);
} }
_displayRenderNode->removeFromParentAndCleanup(true); _displayRenderNode->removeFromParentAndCleanup(true);
_displayRenderNode->release(); _displayRenderNode->release();
} }
@ -184,12 +245,23 @@ void DisplayManager::setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay)
if(_displayRenderNode) if(_displayRenderNode)
{ {
if (dynamic_cast<Armature *>(_displayRenderNode) != NULL) if (Armature *armature = dynamic_cast<Armature *>(_displayRenderNode))
{ {
_bone->setChildArmature((Armature *)_displayRenderNode); _bone->setChildArmature(armature);
} }
else if (ParticleSystemQuad *particle = dynamic_cast<ParticleSystemQuad *>(_displayRenderNode))
{
particle->resetSystem();
}
if (RGBAProtocol *rgbaProtocaol = dynamic_cast<RGBAProtocol *>(_displayRenderNode))
{
rgbaProtocaol->setColor(_bone->getDisplayedColor());
rgbaProtocaol->setOpacity(_bone->getDisplayedOpacity());
}
_displayRenderNode->retain(); _displayRenderNode->retain();
_displayRenderNode->setVisible(_visible); _displayRenderNode->setVisible(_visible);
} }
} }
@ -210,7 +282,7 @@ DecorativeDisplay *DisplayManager::getCurrentDecorativeDisplay()
DecorativeDisplay *DisplayManager::getDecorativeDisplayByIndex( int index) DecorativeDisplay *DisplayManager::getDecorativeDisplayByIndex( int index)
{ {
return static_cast<DecorativeDisplay *>( _decoDisplayList->getObjectAtIndex(index) ); return (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
} }
void DisplayManager::initDisplayList(BoneData *boneData) void DisplayManager::initDisplayList(BoneData *boneData)
@ -222,10 +294,10 @@ void DisplayManager::initDisplayList(BoneData *boneData)
CS_RETURN_IF(!boneData); CS_RETURN_IF(!boneData);
Object *object = NULL; Object *object = NULL;
Array *displayDataList = boneData->displayDataList; Array *displayDataList = &boneData->displayDataList;
CCARRAY_FOREACH(displayDataList, object) CCARRAY_FOREACH(displayDataList, object)
{ {
DisplayData *displayData = static_cast<DisplayData *>(object); DisplayData *displayData = (DisplayData *)object;
DecorativeDisplay *decoDisplay = DecorativeDisplay::create(); DecorativeDisplay *decoDisplay = DecorativeDisplay::create();
decoDisplay->setDisplayData(displayData); decoDisplay->setDisplayData(displayData);
@ -320,4 +392,4 @@ Point DisplayManager::getAnchorPointInPoints()
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -29,7 +29,7 @@ THE SOFTWARE.
#include "../display/CCDecorativeDisplay.h" #include "../display/CCDecorativeDisplay.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class Bone; class Bone;
@ -40,7 +40,7 @@ public:
static DisplayManager *create(Bone *bone); static DisplayManager *create(Bone *bone);
public: public:
/** /**
* @js ctor * @js ctor
*/ */
DisplayManager(); DisplayManager();
@ -57,7 +57,7 @@ public:
* If display is a sprite, and it have texture info in the TexutreData, then use TexutreData to init the display's anchor point * 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 Armature, then create a new Armature
*/ */
void initDisplayList(BoneData *boneData); virtual void initDisplayList(BoneData *boneData);
/** /**
* Add display and use _DisplayData init the display. * Add display and use _DisplayData init the display.
@ -72,6 +72,8 @@ public:
*/ */
void addDisplay(DisplayData *displayData, int index); void addDisplay(DisplayData *displayData, int index);
void addDisplay(Node *display, int index);
void removeDisplay(int index); void removeDisplay(int index);
Array *getDecorativeDisplayList(); Array *getDecorativeDisplayList();
@ -92,9 +94,9 @@ public:
int getCurrentDisplayIndex(); int getCurrentDisplayIndex();
void setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay); virtual void setCurrentDecorativeDisplay(DecorativeDisplay *decoDisplay);
DecorativeDisplay *getCurrentDecorativeDisplay(); virtual DecorativeDisplay *getCurrentDecorativeDisplay();
DecorativeDisplay *getDecorativeDisplayByIndex( int index); virtual DecorativeDisplay *getDecorativeDisplayByIndex( int index);
/** /**
* Sets whether the display is visible * Sets whether the display is visible
@ -128,15 +130,15 @@ public:
virtual bool containPoint(float x, float y); virtual bool containPoint(float x, float y);
protected: protected:
Array *_decoDisplayList; Array *_decoDisplayList;
//! Display render node. //! Display render node.
Node *_displayRenderNode; Node *_displayRenderNode;
//! Include current display information, like contour sprite, etc. //! Include current display information, like contour sprite, etc.
DecorativeDisplay *_currentDecoDisplay; DecorativeDisplay *_currentDecoDisplay;
//! Current display index //! Current display index
int _displayIndex; int _displayIndex;
CC_SYNTHESIZE_PASS_BY_REF(bool, _forceChangeDisplay, ForceChangeDisplay) CC_SYNTHESIZE(bool, _forceChangeDisplay, ForceChangeDisplay)
//! Whether of not the bone is visible. Default is true //! Whether of not the bone is visible. Default is true
bool _visible; bool _visible;
@ -144,6 +146,6 @@ protected:
Bone *_bone; Bone *_bone;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCDISPLAYMANAGER_H__*/ #endif /*__CCDISPLAYMANAGER_H__*/

View File

@ -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 {

View File

@ -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__*/

View File

@ -24,8 +24,10 @@ THE SOFTWARE.
#include "CCSkin.h" #include "CCSkin.h"
#include "../utils/CCTransformHelp.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 #if CC_SPRITEBATCHNODE_RENDER_SUBPIXEL
#define RENDER_IN_SUBPIXEL #define RENDER_IN_SUBPIXEL
@ -57,9 +59,53 @@ Skin *Skin::createWithSpriteFrameName(const char *pszSpriteFrameName)
return NULL; return NULL;
} }
Skin *Skin::create(const char *pszFileName)
{
Skin *skin = new Skin();
if(skin && skin->initWithFile(pszFileName))
{
skin->autorelease();
return skin;
}
CC_SAFE_DELETE(skin);
return NULL;
}
Skin::Skin() Skin::Skin()
: _bone(NULL) : _bone(NULL)
, _displayName("")
{ {
_skinTransform = AffineTransformIdentity;
}
bool Skin::initWithSpriteFrameName(const char *pszSpriteFrameName)
{
bool ret = Sprite::initWithSpriteFrameName(pszSpriteFrameName);
if (ret)
{
TextureAtlas *atlas = SpriteFrameCacheHelper::getInstance()->getTexureAtlasWithTexture(_texture);
setTextureAtlas(atlas);
_displayName = pszSpriteFrameName;
}
return ret;
}
bool Skin::initWithFile(const char *pszFilename)
{
bool ret = Sprite::initWithFile(pszFilename);
if (ret)
{
TextureAtlas *atlas = SpriteFrameCacheHelper::getInstance()->getTexureAtlasWithTexture(_texture);
setTextureAtlas(atlas);
_displayName = pszFilename;
}
return ret;
} }
void Skin::setSkinData(const BaseData &var) void Skin::setSkinData(const BaseData &var)
@ -79,12 +125,12 @@ const BaseData &Skin::getSkinData() const
return _skinData; return _skinData;
} }
void Skin::updateTransform() void Skin::updateArmatureTransform()
{ {
_transform = AffineTransformConcat(_skinTransform, _bone->nodeToArmatureTransform()); _transform = AffineTransformConcat(_skinTransform, _bone->getNodeToArmatureTransform());
} }
void Skin::draw() void Skin::updateTransform()
{ {
// If it is not visible, or one of its ancestors is not visible, then do nothing: // If it is not visible, or one of its ancestors is not visible, then do nothing:
if( !_visible) if( !_visible)
@ -97,7 +143,7 @@ void Skin::draw()
// calculate the Quad based on the Affine Matrix // calculate the Quad based on the Affine Matrix
// //
Size size = _rect.size; Size &size = _rect.size;
float x1 = _offsetPosition.x; float x1 = _offsetPosition.x;
float y1 = _offsetPosition.y; float y1 = _offsetPosition.y;
@ -137,4 +183,22 @@ void Skin::draw()
} }
} }
}}} // namespace cocos2d { namespace extension { namespace armature { AffineTransform Skin::getNodeToWorldTransform() const
{
return AffineTransformConcat(_transform, _bone->getArmature()->getNodeToWorldTransform());
}
AffineTransform Skin::getNodeToWorldTransformAR() const
{
AffineTransform displayTransform = _transform;
Point anchorPoint = _anchorPointInPoints;
anchorPoint = PointApplyAffineTransform(anchorPoint, displayTransform);
displayTransform.tx = anchorPoint.x;
displayTransform.ty = anchorPoint.y;
return AffineTransformConcat(displayTransform, _bone->getArmature()->getNodeToWorldTransform());
}
NS_CC_EXT_ARMATURE_END

View File

@ -28,26 +28,34 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../CCBone.h" #include "../CCBone.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class Skin : public Sprite class Skin : public Sprite
{ {
public: public:
static Skin *create(); static Skin *create();
static Skin *createWithSpriteFrameName(const char *pszSpriteFrameName); static Skin *createWithSpriteFrameName(const char *pszSpriteFrameName);
static Skin *create(const char *pszFileName);
public: public:
Skin(); Skin();
bool initWithSpriteFrameName(const char *pszSpriteFrameName);
bool initWithFile(const char *pszFilename);
void updateArmatureTransform();
void updateTransform(); void updateTransform();
void draw();
AffineTransform getNodeToWorldTransform() const;
AffineTransform getNodeToWorldTransformAR() const;
CC_PROPERTY_PASS_BY_REF(BaseData, _skinData, SkinData); CC_PROPERTY_PASS_BY_REF(BaseData, _skinData, SkinData);
CC_SYNTHESIZE(Bone *, _bone, Bone); CC_SYNTHESIZE(Bone *, _bone, Bone);
protected: protected:
AffineTransform _skinTransform; AffineTransform _skinTransform;
CC_SYNTHESIZE_READONLY(std::string, _displayName, DisplayName)
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCSKIN_H__*/ #endif /*__CCSKIN_H__*/

View File

@ -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
}

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -23,11 +23,47 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCColliderDetector.h" #include "CCColliderDetector.h"
#include "CCPhysicsWorld.h"
#include "../CCBone.h" #include "../CCBone.h"
#include "Box2D/Box2D.h" #include "../utils/CCTransformHelp.h"
#if ENABLE_PHYSICS_BOX2D_DETECT
#include "Box2D/Box2D.h"
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
#include "chipmunk.h"
#endif
NS_CC_EXT_ARMATURE_BEGIN
#if ENABLE_PHYSICS_BOX2D_DETECT
ColliderBody::ColliderBody(ContourData *contourData)
: _fixture(NULL)
, _filter(NULL)
, _contourData(contourData)
{
CC_SAFE_RETAIN(_contourData);
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
ColliderBody::ColliderBody(ContourData *contourData)
: _shape(NULL)
, _contourData(contourData)
{
CC_SAFE_RETAIN(_contourData);
}
#endif
ColliderBody::~ColliderBody()
{
CC_SAFE_RELEASE(_contourData);
#if ENABLE_PHYSICS_BOX2D_DETECT
CC_SAFE_DELETE(_filter);
#endif
}
namespace cocos2d { namespace extension { namespace armature {
ColliderDetector *ColliderDetector::create() ColliderDetector *ColliderDetector::create()
{ {
@ -55,21 +91,13 @@ ColliderDetector *ColliderDetector::create(Bone *bone)
ColliderDetector::ColliderDetector() ColliderDetector::ColliderDetector()
: _colliderBodyList(NULL) : _colliderBodyList(NULL)
, _active(false)
{ {
_body = NULL;
} }
ColliderDetector::~ColliderDetector() ColliderDetector::~ColliderDetector()
{ {
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
b2Body *body = colliderBody->getB2Body();
PhysicsWorld::sharedPhysicsWorld()->getNoGravityWorld()->DestroyBody(body);
}
_colliderBodyList->removeAllObjects(); _colliderBodyList->removeAllObjects();
CC_SAFE_DELETE(_colliderBodyList); CC_SAFE_DELETE(_colliderBodyList);
} }
@ -93,38 +121,7 @@ bool ColliderDetector::init(Bone *bone)
void ColliderDetector::addContourData(ContourData *contourData) void ColliderDetector::addContourData(ContourData *contourData)
{ {
const Array *array = contourData->vertexList; ColliderBody *colliderBody = new ColliderBody(contourData);
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); _colliderBodyList->addObject(colliderBody);
colliderBody->release(); colliderBody->release();
} }
@ -134,13 +131,21 @@ void ColliderDetector::addContourDataList(Array *contourDataList)
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(contourDataList, object) CCARRAY_FOREACH(contourDataList, object)
{ {
addContourData(static_cast<ContourData *>(object)); addContourData((ContourData *)object);
} }
} }
void ColliderDetector::removeContourData(ContourData *_contourData) void ColliderDetector::removeContourData(ContourData *contourData)
{ {
_colliderBodyList->removeObject(_contourData); Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *body = (ColliderBody*)object;
if (body && body->getContourData() == contourData)
{
_colliderBodyList->removeObject(body);
}
}
} }
void ColliderDetector::removeAll() void ColliderDetector::removeAll()
@ -148,59 +153,244 @@ void ColliderDetector::removeAll()
_colliderBodyList->removeAllObjects(); _colliderBodyList->removeAllObjects();
} }
void ColliderDetector::setColliderFilter(b2Filter &filter)
{
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
colliderBody->getB2Body()->GetFixtureList()->SetFilterData(filter);
}
}
void ColliderDetector::setActive(bool active) void ColliderDetector::setActive(bool active)
{ {
Object *object = NULL; if (_active == active)
CCARRAY_FOREACH(_colliderBodyList, object)
{ {
ColliderBody *colliderBody = static_cast<ColliderBody *>(object); return;
colliderBody->getB2Body()->SetActive(active);
} }
_active = active;
#if ENABLE_PHYSICS_BOX2D_DETECT
if (_body)
{
if (active)
{
setBody(_body);
}
else
{
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
b2Fixture *fixture = colliderBody->getB2Fixture();
b2Filter *filter = colliderBody->getB2Filter();
*filter = fixture->GetFilterData();
_body->DestroyFixture(fixture);
colliderBody->setB2Fixture(NULL);
}
}
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
if (_body)
{
Object *object = NULL;
if (_active)
{
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
cpShape *shape = colliderBody->getShape();
cpSpaceAddShape(_body->space_private, shape);
}
}
else
{
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
cpShape *shape = colliderBody->getShape();
cpSpaceRemoveShape(_body->space_private, shape);
}
}
}
#endif
} }
bool ColliderDetector::getActive()
{
return _active;
}
Array *ColliderDetector::getColliderBodyList()
{
return _colliderBodyList;
}
Point helpPoint; Point helpPoint;
void ColliderDetector::updateTransform(AffineTransform &t) void ColliderDetector::updateTransform(AffineTransform &t)
{ {
if (!_active)
{
return;
}
Object *object = NULL; Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object) CCARRAY_FOREACH(_colliderBodyList, object)
{ {
ColliderBody *colliderBody = static_cast<ColliderBody *>(object); ColliderBody *colliderBody = (ColliderBody *)object;
ContourData *contourData = colliderBody->getContourData();
#if ENABLE_PHYSICS_BOX2D_DETECT
b2PolygonShape *shape = NULL;
if (_body != NULL)
{
shape = (b2PolygonShape *)colliderBody->getB2Fixture()->GetShape();
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
cpPolyShape *shape = NULL;
if (_body != NULL)
{
shape = (cpPolyShape *)colliderBody->getShape();
}
#endif
int num = contourData->vertexList.count();
ContourVertex2 **vs = (ContourVertex2 **)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 ColliderDetector::setBody(b2Body *pBody)
{
_body = pBody;
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ContourData *contourData = colliderBody->getContourData(); ContourData *contourData = colliderBody->getContourData();
b2Body *body = colliderBody->getB2Body(); const Array *array = &contourData->vertexList;
b2PolygonShape *shape = (b2PolygonShape *)body->GetFixtureList()->GetShape();
//! update every vertex
const Array *array = contourData->vertexList;
Object *object = NULL; Object *object = NULL;
b2Vec2 *b2bv = new b2Vec2[contourData->vertexList.count()];
int i = 0; int i = 0;
CCARRAY_FOREACH(array, object) CCARRAY_FOREACH(array, object)
{ {
ContourVertex2F *cv = static_cast<ContourVertex2F *>(object); ContourVertex2 *v = (ContourVertex2 *)object;
b2Vec2 &bv = shape->m_vertices[i]; b2bv[i].Set(v->x / PT_RATIO, v->y / PT_RATIO);
helpPoint.setPoint(cv->x, cv->y);
helpPoint = PointApplyAffineTransform(helpPoint, t);
bv.Set(helpPoint.x / PT_RATIO, helpPoint.y / PT_RATIO);
i++; i++;
} }
b2PolygonShape polygon;
polygon.Set(b2bv, contourData->vertexList.count());
CC_SAFE_DELETE(b2bv);
b2FixtureDef fixtureDef;
fixtureDef.shape = &polygon;
fixtureDef.isSensor = true;
b2Fixture *fixture = _body->CreateFixture(&fixtureDef);
fixture->SetUserData(_bone);
if (colliderBody->getB2Fixture() != NULL)
{
_body->DestroyFixture(colliderBody->getB2Fixture());
}
colliderBody->setB2Fixture(fixture);
if (colliderBody->getB2Filter() == NULL)
{
b2Filter *filter = new b2Filter;
colliderBody->setB2Filter(filter);
}
else
{
fixture->SetFilterData(*colliderBody->getB2Filter());
}
} }
} }
b2Body *ColliderDetector::getBody()
{
return _body;
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
void ColliderDetector::setBody(cpBody *pBody)
{
_body = pBody;
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ContourData *contourData = colliderBody->getContourData();
int num = contourData->vertexList.count();
ContourVertex2 **vs = (ContourVertex2 **)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(_body, num, verts, cpvzero);
shape->sensor = true;
shape->data = _bone;
cpSpaceAddShape(_body->space_private, shape);
colliderBody->setShape(shape);
delete []verts;
}
}
cpBody *ColliderDetector::getBody()
{
return _body;
}
#endif
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -28,46 +28,43 @@ THE SOFTWARE.
#include "../utils/CCArmatureDefine.h" #include "../utils/CCArmatureDefine.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
#ifndef PT_RATIO
#define PT_RATIO 32
#endif
class b2Body; class b2Body;
class b2Fixture;
struct b2Filter; struct b2Filter;
namespace cocos2d { namespace extension { namespace armature { struct cpBody;
struct cpShape;
NS_CC_EXT_ARMATURE_BEGIN
class Bone; class Bone;
class ColliderBody : public Object class ColliderBody : public Object
{ {
public: public:
ColliderBody(b2Body *b2b, ContourData *contourData) #if ENABLE_PHYSICS_BOX2D_DETECT
:_pB2b(NULL) CC_SYNTHESIZE(b2Fixture *, _fixture, B2Fixture)
,_contourData(NULL) CC_SYNTHESIZE(b2Filter *, _filter, B2Filter)
{
this->_pB2b = b2b;
this->_contourData = contourData;
CC_SAFE_RETAIN(_contourData);
}
/**
* @js NA
* @lua NA
*/
~ColliderBody()
{
CC_SAFE_RELEASE(_contourData);
}
inline b2Body *getB2Body() #elif ENABLE_PHYSICS_CHIPMUNK_DETECT
{ CC_SYNTHESIZE(cpShape *, _shape, Shape)
return _pB2b; #endif
}
inline ContourData *getContourData() public:
{ ColliderBody(ContourData *contourData);
return _contourData; ~ColliderBody();
}
inline ContourData *getContourData()
{
return _contourData;
}
private: private:
b2Body *_pB2b; ContourData *_contourData;
ContourData *_contourData;
}; };
/* /*
@ -76,40 +73,49 @@ private:
class ColliderDetector : public Object class ColliderDetector : public Object
{ {
public: public:
static ColliderDetector *create(); static ColliderDetector *create();
static ColliderDetector *create(Bone *bone); static ColliderDetector *create(Bone *bone);
public: public:
/** /**
* @js ctor * @js ctor
*/ */
ColliderDetector(); ColliderDetector();
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
~ColliderDetector(void); ~ColliderDetector(void);
virtual bool init(); virtual bool init();
virtual bool init(Bone *bone); virtual bool init(Bone *bone);
void addContourData(ContourData *contourData); void addContourData(ContourData *contourData);
void addContourDataList(Array *contourDataList); void addContourDataList(Array *contourDataList);
void removeContourData(ContourData *contourData); void removeContourData(ContourData *contourData);
void removeAll(); void removeAll();
void updateTransform(AffineTransform &t); void updateTransform(AffineTransform &t);
void setColliderFilter(b2Filter &filter);
void setActive(bool active); void setActive(bool active);
private: bool getActive();
Array *_colliderBodyList;
CC_SYNTHESIZE(Bone*, _bone, Bone);
Array *getColliderBodyList();
protected:
Array *_colliderBodyList;
CC_SYNTHESIZE(Bone *, _bone, Bone);
#if ENABLE_PHYSICS_BOX2D_DETECT
CC_PROPERTY(b2Body *, _body, Body);
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
CC_PROPERTY(cpBody *, _body, Body);
#endif
protected:
bool _active;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCCOLLIDERDETECTOR_H__*/ #endif /*__CCCOLLIDERDETECTOR_H__*/

View File

@ -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 {

View File

@ -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__*/

View File

@ -27,14 +27,13 @@ THE SOFTWARE.
#include "CCTransformHelp.h" #include "CCTransformHelp.h"
#include "CCDataReaderHelper.h" #include "CCDataReaderHelper.h"
#include "CCSpriteFrameCacheHelper.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 ArmatureDataManager *s_sharedArmatureDataManager = NULL;
ArmatureDataManager *ArmatureDataManager::sharedArmatureDataManager() ArmatureDataManager *ArmatureDataManager::getInstance()
{ {
if (s_sharedArmatureDataManager == NULL) if (s_sharedArmatureDataManager == NULL)
{ {
@ -47,49 +46,48 @@ ArmatureDataManager *ArmatureDataManager::sharedArmatureDataManager()
return s_sharedArmatureDataManager; return s_sharedArmatureDataManager;
} }
void ArmatureDataManager::purge()
{
SpriteFrameCacheHelper::purge();
DataReaderHelper::purge();
CC_SAFE_RELEASE_NULL(s_sharedArmatureDataManager);
}
ArmatureDataManager::ArmatureDataManager(void) ArmatureDataManager::ArmatureDataManager(void)
{ {
_armarureDatas = NULL; _armarureDatas = NULL;
_animationDatas = NULL; _animationDatas = NULL;
_textureDatas = NULL; _textureDatas = NULL;
_autoLoadSpriteFile = false;
} }
ArmatureDataManager::~ArmatureDataManager(void) ArmatureDataManager::~ArmatureDataManager(void)
{ {
CCLOGINFO("deallocing ArmatureDataManager: %p", this);
removeAll(); removeAll();
CC_SAFE_RELEASE(_animationDatas); CC_SAFE_DELETE(_animationDatas);
CC_SAFE_RELEASE(_armarureDatas); CC_SAFE_DELETE(_armarureDatas);
CC_SAFE_RELEASE(_textureDatas); CC_SAFE_DELETE(_textureDatas);
} }
void ArmatureDataManager::purgeArmatureSystem()
{
SpriteFrameCacheHelper::purgeSpriteFrameCacheHelper();
PhysicsWorld::purgePhysicsWorld();
CC_SAFE_RELEASE_NULL(s_sharedArmatureDataManager);
}
bool ArmatureDataManager::init() bool ArmatureDataManager::init()
{ {
bool bRet = false; bool bRet = false;
do do
{ {
_armarureDatas = new Dictionary; _armarureDatas = Dictionary::create();
CCASSERT(_armarureDatas, "create ArmatureDataManager::_armarureDatas fail!"); CCASSERT(_armarureDatas, "create ArmatureDataManager::_armarureDatas fail!");
_armarureDatas->init(); _armarureDatas->retain();
_animationDatas = new Dictionary; _animationDatas = Dictionary::create();
CCASSERT(_animationDatas, "create ArmatureDataManager::_animationDatas fail!"); CCASSERT(_animationDatas, "create ArmatureDataManager::_animationDatas fail!");
_animationDatas->init(); _animationDatas->retain();
_textureDatas = new Dictionary; _textureDatas = Dictionary::create();
CCASSERT(_textureDatas, "create ArmatureDataManager::_textureDatas fail!"); CCASSERT(_textureDatas, "create ArmatureDataManager::_textureDatas fail!");
_textureDatas->init(); _textureDatas->retain();
bRet = true; bRet = true;
} }
@ -116,6 +114,14 @@ ArmatureData *ArmatureDataManager::getArmatureData(const char *id)
return armatureData; return armatureData;
} }
void ArmatureDataManager::removeArmatureData(const char *id)
{
if (_armarureDatas)
{
_armarureDatas->removeObjectForKey(id);
}
}
void ArmatureDataManager::addAnimationData(const char *id, AnimationData *animationData) void ArmatureDataManager::addAnimationData(const char *id, AnimationData *animationData)
{ {
if(_animationDatas) if(_animationDatas)
@ -124,14 +130,6 @@ void ArmatureDataManager::addAnimationData(const char *id, AnimationData *animat
} }
} }
void ArmatureDataManager::addTextureData(const char *id, TextureData *textureData)
{
if(_textureDatas)
{
_textureDatas->setObject(textureData, id);
}
}
AnimationData *ArmatureDataManager::getAnimationData(const char *id) AnimationData *ArmatureDataManager::getAnimationData(const char *id)
{ {
AnimationData *animationData = NULL; AnimationData *animationData = NULL;
@ -142,6 +140,23 @@ AnimationData *ArmatureDataManager::getAnimationData(const char *id)
return animationData; return animationData;
} }
void ArmatureDataManager::removeAnimationData(const char *id)
{
if (_animationDatas)
{
_animationDatas->removeObjectForKey(id);
}
}
void ArmatureDataManager::addTextureData(const char *id, TextureData *textureData)
{
if(_textureDatas)
{
_textureDatas->setObject(textureData, id);
}
}
TextureData *ArmatureDataManager::getTextureData(const char *id) TextureData *ArmatureDataManager::getTextureData(const char *id)
{ {
TextureData *textureData = NULL; TextureData *textureData = NULL;
@ -153,30 +168,43 @@ TextureData *ArmatureDataManager::getTextureData(const char *id)
} }
void ArmatureDataManager::removeTextureData(const char *id)
void ArmatureDataManager::addArmatureFileInfo(const char *armatureName, const char *useExistFileInfo, const char *imagePath, const char *plistPath, const char *configFilePath)
{ {
addArmatureFileInfo(imagePath, plistPath, configFilePath); if(_textureDatas)
{
_textureDatas->removeObjectForKey(id);
}
}
void ArmatureDataManager::addArmatureFileInfo(const char *configFilePath)
{
_autoLoadSpriteFile = true;
DataReaderHelper::getInstance()->addDataFromFile(configFilePath);
}
void ArmatureDataManager::addArmatureFileInfoAsync(const char *configFilePath, Object *target, SEL_SCHEDULE selector)
{
_autoLoadSpriteFile = true;
DataReaderHelper::getInstance()->addDataFromFileAsync(configFilePath, target, selector);
} }
void ArmatureDataManager::addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath) void ArmatureDataManager::addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath)
{ {
_autoLoadSpriteFile = false;
DataReaderHelper::getInstance()->addDataFromFile(configFilePath);
addSpriteFrameFromFile(plistPath, imagePath);
}
DataReaderHelper::addDataFromFile(configFilePath); void ArmatureDataManager::addArmatureFileInfoAsync(const char *imagePath, const char *plistPath, const char *configFilePath, Object *target, SEL_SCHEDULE selector)
{
_autoLoadSpriteFile = false;
DataReaderHelper::getInstance()->addDataFromFileAsync(configFilePath, target, selector);
addSpriteFrameFromFile(plistPath, imagePath); addSpriteFrameFromFile(plistPath, imagePath);
} }
void ArmatureDataManager::addSpriteFrameFromFile(const char *plistPath, const char *imagePath) void ArmatureDataManager::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
{ {
// if(Game::sharedGame()->isUsePackage()) SpriteFrameCacheHelper::getInstance()->addSpriteFrameFromFile(plistPath, imagePath);
// {
// SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromPak(plistPath, imagePath);
// }
// else
// {
// SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromFile(plistPath, imagePath);
// }
SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper()->addSpriteFrameFromFile(plistPath, imagePath);
} }
@ -199,4 +227,22 @@ void ArmatureDataManager::removeAll()
DataReaderHelper::clear(); DataReaderHelper::clear();
} }
}}} // namespace cocos2d { namespace extension { namespace armature { bool ArmatureDataManager::isAutoLoadSpriteFile()
{
return _autoLoadSpriteFile;
}
Dictionary *ArmatureDataManager::getArmatureDatas() const
{
return _armarureDatas;
}
Dictionary *ArmatureDataManager::getAnimationDatas() const
{
return _animationDatas;
}
Dictionary *ArmatureDataManager::getTextureDatas() const
{
return _textureDatas;
}
NS_CC_EXT_ARMATURE_END

View File

@ -26,22 +26,25 @@ THE SOFTWARE.
#define __CCARMATUREDATAMANAGER_H__ #define __CCARMATUREDATAMANAGER_H__
#include "CCArmatureDefine.h" #include "CCArmatureDefine.h"
#include "CCConstValue.h"
#include "../datas/CCDatas.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 ArmatureDataManager : public Object
{ {
public: public:
static ArmatureDataManager *sharedArmatureDataManager(); /** @deprecated Use getInstance() instead */
static void purgeArmatureSystem(); CC_DEPRECATED_ATTRIBUTE static ArmatureDataManager *sharedArmatureDataManager() { return ArmatureDataManager::getInstance(); }
static ArmatureDataManager *getInstance();
static void purge();
private: private:
/** /**
* @js ctor * @js ctor
*/ */
ArmatureDataManager(void); ArmatureDataManager(void);
@ -52,105 +55,140 @@ private:
~ArmatureDataManager(void); ~ArmatureDataManager(void);
public: public:
/** /**
* Init ArmatureDataManager * Init ArmatureDataManager
*/ */
virtual bool init(); virtual bool init();
/** /**
* @brief Add armature data. * Add armature data
* * @param id The id of the armature data
* @param id The id of the armature data. * @param armatureData ArmatureData *
* @param armatureData The armature data to be added.
*/ */
void addArmatureData(const char *id, ArmatureData *armatureData); void addArmatureData(const char *id, ArmatureData *armatureData);
/** /**
* @brief Get armature data. * @brief get armature data
* * @param id the id of the armature data you want to get
* @param id The id of the armature data you want to get. * @return ArmatureData *
*
* @return The ArmatureData whose id is @p id.
*/ */
ArmatureData *getArmatureData(const char *id); ArmatureData *getArmatureData(const char *id);
/** /**
* @brief Add animation data. * @brief remove armature data
* * @param id the id of the armature data you want to get
* @param id The id of the animation data. */
* @param animationData The animation data to be added. void removeArmatureData(const char *id);
/**
* @brief add animation data
* @param id the id of the animation data
* @return AnimationData *
*/ */
void addAnimationData(const char *id, AnimationData *animationData); void addAnimationData(const char *id, AnimationData *animationData);
/** /**
* @brief Get animation data. * @brief get animation data from _animationDatas(Dictionary)
* * @param id the id of the animation data you want to get
* @param id The id of the animation data you want to get. * @return AnimationData *
*
* @return The AnimationData whose id is @p id.
*/ */
AnimationData *getAnimationData(const char *id); AnimationData *getAnimationData(const char *id);
/** /**
* @brief Add texture data. * @brief remove animation data
* * @param id the id of the animation data
* @param id The id of the texture data.
* @param textureData The texture data to be added.
*/ */
void addTextureData(const char *id, TextureData *textureData); void removeAnimationData(const char *id);
/**
* @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);
/** /**
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager. * @brief add texture data
* @param id the id of the texture data
* @return TextureData *
*/
void addTextureData(const char *id, TextureData *textureData);
/**
* @brief get texture data
* @param id the id of the texture data you want to get
* @return TextureData *
*/
TextureData *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 ArmatureDataManager.
*/
void addArmatureFileInfo(const char *configFilePath);
/**
* @brief Add ArmatureFileInfo, it is managed by ArmatureDataManager.
* 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 ArmatureDataManager.
*/ */
void addArmatureFileInfo(const char *imagePath, const char *plistPath, const char *configFilePath); 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 ArmatureDataManager.
* 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); 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 _armarureDatas and _animationDatas, and set _armarureDatas and _animationDatas to NULL
*/ */
void removeAll(); void removeAll();
/**
* @brief Juge whether or not need auto load sprite file
*/
bool isAutoLoadSpriteFile();
Dictionary *getArmatureDatas() const;
Dictionary *getAnimationDatas() const;
Dictionary *getTextureDatas() const;
private: private:
/** /**
* Dictionary to save amature data. * @brief save amature datas
* Key type is std::string, value type is ArmatureData *. * @key std::string
* @value ArmatureData *
*/ */
CC_SYNTHESIZE_READONLY(Dictionary *, _armarureDatas, ArmarureDatas); Dictionary *_armarureDatas;
/** /**
* Dictionary to save animation data. * @brief save animation datas
* Key type is std::string, value type is AnimationData *. * @key std::string
* @value AnimationData *
*/ */
CC_SYNTHESIZE_READONLY(Dictionary *, _animationDatas, AnimationDatas); Dictionary *_animationDatas;
/** /**
* Dictionary to save texture data. * @brief save texture datas
* Key type is std::string, value type is TextureData *. * @key std::string
* @value TextureData *
*/ */
CC_SYNTHESIZE_READONLY(Dictionary *, _textureDatas, TextureDatas); Dictionary *_textureDatas;
bool _autoLoadSpriteFile;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif/*__CCARMATUREDATAMANAGER_H__*/ #endif/*__CCARMATUREDATAMANAGER_H__*/

View File

@ -22,8 +22,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#ifndef __CCCONSTVALUE_H__ #include "CCArmatureDefine.h"
#define __CCCONSTVALUE_H__
NS_CC_EXT_ARMATURE_BEGIN
#endif /*__CCCONSTVALUE_H__*/ const char *armatureVersion()
{
return "0.4.0.0";
}
NS_CC_EXT_ARMATURE_END

View File

@ -25,27 +25,37 @@ THE SOFTWARE.
#ifndef __CCARMATUREDEFINE_H__ #ifndef __CCARMATUREDEFINE_H__
#define __CCARMATUREDEFINE_H__ #define __CCARMATUREDEFINE_H__
//#define _USRDLL 1
#include "cocos2d.h" #include "cocos2d.h"
#include "ExtensionMacros.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 #endif
#ifndef ENABLE_PHYSICS_DETECT #ifndef ENABLE_PHYSICS_CHIPMUNK_DETECT
#define ENABLE_PHYSICS_DETECT 1 #define ENABLE_PHYSICS_CHIPMUNK_DETECT 1
#endif #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_IF(cond) if (cond) return
#define CS_RETURN_NULL_IF(cond) if (cond) return NULL; #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__*/ #endif /*__CCARMATUREDEFINE_H__*/

File diff suppressed because it is too large Load Diff

View File

@ -27,19 +27,57 @@ THE SOFTWARE.
#include "CCArmatureDefine.h" #include "CCArmatureDefine.h"
#include "../datas/CCDatas.h" #include "../datas/CCDatas.h"
#include "../utils/CCConstValue.h"
#include "../CCArmature.h" #include "../CCArmature.h"
#include "../../Json/CSContentJsonDictionary.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 { namespace tinyxml2
class DataReaderHelper
{ {
class XMLElement;
}
NS_CC_EXT_ARMATURE_BEGIN
class DataReaderHelper : 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: public:
/** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static DataReaderHelper *sharedDataReaderHelper() { return DataReaderHelper::getInstance(); }
static DataReaderHelper *getInstance();
/** /**
* Scale the position data, used for multiresolution adapter * Scale the position data, used for multiresolution adapter
* It won't effect the data already read. * It won't effect the data already read.
@ -47,34 +85,33 @@ public:
static void setPositionReadScale(float scale); static void setPositionReadScale(float scale);
static float getPositionReadScale(); static float getPositionReadScale();
static void addDataFromFile(const char *filePath); static void purge();
static void clear(); static void clear();
public:
/**
* @js ctor
*/
DataReaderHelper();
/**
* @js NA
* @lua NA
*/
~DataReaderHelper();
void addDataFromFile(const char *filePath);
void addDataFromFileAsync(const char *filePath, Object *target, SEL_SCHEDULE selector);
void addDataAsyncCallBack(float dt);
public: public:
/** /**
* Translate XML export from Dragon Bone flash tool to datas, and save them. * 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. * When you add a new xml, the data already saved will be keeped.
* *
* @param xmlPath Path of xml file * @param xmlPath The cache of the xml
*/ */
static void addDataFromXML(const char *xmlPath); static void addDataFromCache(const char *pFileContent, DataInfo *dataInfo = NULL);
/**
* 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);
@ -106,9 +143,7 @@ public:
static ContourData *decodeContour(tinyxml2::XMLElement *contourXML); static ContourData *decodeContour(tinyxml2::XMLElement *contourXML);
public: public:
static void addDataFromJsonCache(const char *fileContent, DataInfo *dataInfo = NULL);
static void addDataFromJson(const char *filePath);
static void addDataFromJsonCache(const char *fileContent);
static ArmatureData *decodeArmature(cs::JsonDictionary &json); static ArmatureData *decodeArmature(cs::JsonDictionary &json);
static BoneData *decodeBone(cs::JsonDictionary &json); static BoneData *decodeBone(cs::JsonDictionary &json);
@ -124,8 +159,37 @@ public:
static ContourData *decodeContour(cs::JsonDictionary &json); static ContourData *decodeContour(cs::JsonDictionary &json);
static void decodeNode(BaseData *node, cs::JsonDictionary &json); static void decodeNode(BaseData *node, cs::JsonDictionary &json);
protected:
void loadData();
std::condition_variable _sleepCondition;
std::thread *_loadingThread;
std::mutex _sleepMutex;
std::mutex _asyncStructQueueMutex;
std::mutex _dataInfoMutex;
std::mutex _addDataMutex;
unsigned long _asyncRefCount;
unsigned long _asyncRefTotalCount;
bool need_quit;
std::queue<AsyncStruct *> *_asyncStructQueue;
std::queue<DataInfo *> *_dataQueue;
static DataReaderHelper *_dataReaderHelper;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCDATAREADERHELPER_H__*/ #endif /*__CCDATAREADERHELPER_H__*/

View File

@ -25,160 +25,51 @@ THE SOFTWARE.
#include "CCSpriteFrameCacheHelper.h" #include "CCSpriteFrameCacheHelper.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
SpriteFrameCacheHelper *SpriteFrameCacheHelper::s_SpriteFrameCacheHelper = NULL; SpriteFrameCacheHelper *SpriteFrameCacheHelper::_spriteFrameCacheHelper = NULL;
SpriteFrameCacheHelper *SpriteFrameCacheHelper::sharedSpriteFrameCacheHelper() SpriteFrameCacheHelper *SpriteFrameCacheHelper::getInstance()
{ {
if(!s_SpriteFrameCacheHelper) if(!_spriteFrameCacheHelper)
{ {
s_SpriteFrameCacheHelper = new SpriteFrameCacheHelper(); _spriteFrameCacheHelper = new SpriteFrameCacheHelper();
} }
return s_SpriteFrameCacheHelper; return _spriteFrameCacheHelper;
} }
void SpriteFrameCacheHelper::purgeSpriteFrameCacheHelper() void SpriteFrameCacheHelper::purge()
{ {
delete s_SpriteFrameCacheHelper; delete _spriteFrameCacheHelper;
s_SpriteFrameCacheHelper = NULL; _spriteFrameCacheHelper = NULL;
} }
void SpriteFrameCacheHelper::addSpriteFrameFromFile(const char *plistPath, const char *imagePath) void SpriteFrameCacheHelper::addSpriteFrameFromFile(const char *plistPath, const char *imagePath)
{ {
CCSpriteFrameCache::getInstance()->addSpriteFramesWithFile(plistPath, 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();
} }
void SpriteFrameCacheHelper::addSpriteFrameFromDict(Dictionary *dictionary, Texture2D *pobTexture, const char *imagePath) TextureAtlas *SpriteFrameCacheHelper::getTexureAtlasWithTexture(Texture2D *texture)
{ {
/* int key = texture->getName();
Supported Zwoptex Formats: TextureAtlas *atlas = (TextureAtlas *)_textureAtlasDic->objectForKey(key);
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);
if (atlas == NULL) if (atlas == NULL)
{ {
atlas = TextureAtlas::createWithTexture(TextureCache::getInstance()->addImage(textureName), 4); atlas = TextureAtlas::createWithTexture(texture, 4);
_display2TextureAtlas->setObject(atlas, textureName); _textureAtlasDic->setObject(atlas, key);
} }
return atlas; return atlas;
} }
SpriteFrameCacheHelper::SpriteFrameCacheHelper() SpriteFrameCacheHelper::SpriteFrameCacheHelper()
{ {
_display2TextureAtlas = new Dictionary(); _textureAtlasDic = new Dictionary();
_display2TextureAtlas->init();
} }
SpriteFrameCacheHelper::~SpriteFrameCacheHelper() SpriteFrameCacheHelper::~SpriteFrameCacheHelper()
{ {
CC_SAFE_RELEASE_NULL(_display2TextureAtlas); CC_SAFE_RELEASE_NULL(_textureAtlasDic);
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -29,32 +29,28 @@ THE SOFTWARE.
using namespace std; using namespace std;
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
class SpriteFrameCacheHelper class SpriteFrameCacheHelper
{ {
public: public:
static SpriteFrameCacheHelper *sharedSpriteFrameCacheHelper(); /** @deprecated Use getInstance() instead */
CC_DEPRECATED_ATTRIBUTE static SpriteFrameCacheHelper *sharedSpriteFrameCacheHelper(){ return SpriteFrameCacheHelper::getInstance(); }
static void purgeSpriteFrameCacheHelper(); static SpriteFrameCacheHelper *getInstance();
static void purge();
public: 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 addSpriteFrameFromFile(const char *plistPath, const char *imagePath);
void addSpriteFrameFromDict(Dictionary *dictionary, Texture2D *pobTexture, const char *imagePath); TextureAtlas *getTexureAtlasWithTexture(Texture2D *texture);
/**
* Get this display in which image
*/
const char *getDisplayImagePath(const char *displayName);
TextureAtlas *getTextureAtlas(const char *displayName);
private: private:
/** /**
* @js ctor * @js ctor
*/ */
SpriteFrameCacheHelper(); SpriteFrameCacheHelper();
@ -64,12 +60,11 @@ private:
*/ */
~SpriteFrameCacheHelper(); ~SpriteFrameCacheHelper();
std::map<std::string, std::string> _display2ImageMap; Dictionary *_textureAtlasDic;
Dictionary *_display2TextureAtlas;
static SpriteFrameCacheHelper *s_SpriteFrameCacheHelper; static SpriteFrameCacheHelper *_spriteFrameCacheHelper;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCSPRITEFRAMECACHEHELPER_H__*/ #endif /*__CCSPRITEFRAMECACHEHELPER_H__*/

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#include "CCTransformHelp.h" #include "CCTransformHelp.h"
#include "CCUtilMath.h" #include "CCUtilMath.h"
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
AffineTransform TransformHelp::helpMatrix1; AffineTransform TransformHelp::helpMatrix1;
AffineTransform TransformHelp::helpMatrix2; AffineTransform TransformHelp::helpMatrix2;
@ -139,4 +139,14 @@ void TransformHelp::nodeConcat(BaseData &target, BaseData &source)
target.scaleY += source.scaleY; target.scaleY += source.scaleY;
} }
}}} // namespace cocos2d { namespace extension { namespace armature { void TransformHelp::nodeSub(BaseData &target, BaseData &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

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "CCArmatureDefine.h" #include "CCArmatureDefine.h"
#include "../datas/CCDatas.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 * use to calculate the matrix of node from parent node
@ -48,6 +48,7 @@ public:
static void matrixToNode(const AffineTransform &_matrix, BaseData &_node); static void matrixToNode(const AffineTransform &_matrix, BaseData &_node);
static void nodeConcat(BaseData &target, BaseData &source); static void nodeConcat(BaseData &target, BaseData &source);
static void nodeSub(BaseData &target, BaseData &source);
public: public:
static AffineTransform helpMatrix1; static AffineTransform helpMatrix1;
static AffineTransform helpMatrix2; static AffineTransform helpMatrix2;
@ -56,6 +57,6 @@ public:
static Point helpPoint2; static Point helpPoint2;
}; };
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCTRANSFORMHELP_H__*/ #endif /*__CCTRANSFORMHELP_H__*/

View File

@ -25,9 +25,9 @@ THE SOFTWARE.
#include "CCTweenFunction.h" #include "CCTweenFunction.h"
#include "CCUtilMath.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 TweenFunction::tweenTo(float from, float change, float time, float duration, CCTweenType tweenType)
{ {
float delta = 0; float delta = 0;
@ -153,77 +153,77 @@ float TweenFunction::linear(float t, float b, float c, float d)
float TweenFunction::quadEaseIn(float t, float b, float c, float d) float TweenFunction::quadEaseIn(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return c * t * t + b; return c * t * t + b;
} }
float TweenFunction::quadEaseOut(float t, float b, float c, float d) float TweenFunction::quadEaseOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return -c * t * (t - 2) + b; return -c * t * (t - 2) + b;
} }
float TweenFunction::quadEaseInOut(float t, float b, float c, float d) float TweenFunction::quadEaseInOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if ((t / 2) < 1) if ((t / 2) < 1)
return c / 2 * t * t + b; return c / 2 * t * t + b;
--t; --t;
return -c / 2 * (t * (t - 2) - 1) + b; return -c / 2 * (t * (t - 2) - 1) + b;
} }
float TweenFunction::cubicEaseIn(float t, float b, float c, float d) float TweenFunction::cubicEaseIn(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return c * t * t * t + b; return c * t * t * t + b;
} }
float TweenFunction::cubicEaseOut(float t, float b, float c, float d) float TweenFunction::cubicEaseOut(float t, float b, float c, float d)
{ {
t = t / d - 1; t = t / d - 1;
return c * (t * t * t + 1) + b; return c * (t * t * t + 1) + b;
} }
float TweenFunction::cubicEaseInOut(float t, float b, float c, float d) float TweenFunction::cubicEaseInOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if ((t / 2) < 1) if ((t / 2) < 1)
return c / 2 * t * t * t + b; return c / 2 * t * t * t + b;
t -= 2; 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 TweenFunction::quartEaseIn(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return c * t * t * t * t + b; return c * t * t * t * t + b;
} }
float TweenFunction::quartEaseOut(float t, float b, float c, float d) float TweenFunction::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; return -c * (t * t * t * t - 1) + b;
} }
float TweenFunction::quartEaseInOut(float t, float b, float c, float d) float TweenFunction::quartEaseInOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if ((t / 2) < 1) if ((t / 2) < 1)
return c / 2 * t * t * t * t + b; return c / 2 * t * t * t * t + b;
t -= 2; 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 TweenFunction::quintEaseIn(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return c * t * t * t * t * t + b; return c * t * t * t * t * t + b;
} }
float TweenFunction::quintEaseOut(float t, float b, float c, float d) float TweenFunction::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; return c * (t * t * t * t * t + 1) + b;
} }
float TweenFunction::quintEaseInOut(float t, float b, float c, float d) float TweenFunction::quintEaseInOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if ((t / 2) < 1) if ((t / 2) < 1)
return c / 2 * t * t * t * t * t + b; return c / 2 * t * t * t * t * t + b;
t -= 2; t -= 2;
return c / 2 * (t * t * t * t * t + 2) + b; return c / 2 * (t * t * t * t * t + 2) + b;
} }
@ -256,26 +256,26 @@ float TweenFunction::expoEaseInOut(float t, float b, float c, float d)
return b + c; return b + c;
if ((t /= d / 2) < 1) if ((t /= d / 2) < 1)
return c / 2 * pow(2, 10 * (t - 1)) + b; return c / 2 * pow(2, 10 * (t - 1)) + b;
--t; --t;
return c / 2 * (-pow(2, -10 * t) + 2) + b; return c / 2 * (-pow(2, -10 * t) + 2) + b;
} }
float TweenFunction::circEaseIn(float t, float b, float c, float d) float TweenFunction::circEaseIn(float t, float b, float c, float d)
{ {
t /= d; t /= d;
return -c * (sqrt(1 - t * t) - 1) + b; return -c * (sqrt(1 - t * t) - 1) + b;
} }
float TweenFunction::circEaseOut(float t, float b, float c, float d) float TweenFunction::circEaseOut(float t, float b, float c, float d)
{ {
t = t / d - 1; t = t / d - 1;
return c * sqrt(1 - t * t) + b; return c * sqrt(1 - t * t) + b;
} }
float TweenFunction::circEaseInOut(float t, float b, float c, float d) float TweenFunction::circEaseInOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if ((t / 2) < 1) if ((t / 2) < 1)
return -c / 2 * (sqrt(1 - t * t) - 1) + b; return -c / 2 * (sqrt(1 - t * t) - 1) + b;
t -= 2; t -= 2;
return c / 2 * (sqrt(1 - t * t) + 1) + b; return c / 2 * (sqrt(1 - t * t) + 1) + b;
} }
@ -285,7 +285,7 @@ float TweenFunction::elasticEaseIn(float t, float b, float c, float d, float a,
if (t == 0) if (t == 0)
return b; return b;
t /= d; t /= d;
if (t == 1) if (t == 1)
return b + c; return b + c;
if (!p) if (!p)
p = d * .3; p = d * .3;
@ -296,7 +296,7 @@ float TweenFunction::elasticEaseIn(float t, float b, float c, float d, float a,
} }
else else
s = p / (2 * M_PI) * asin(c / a); 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; 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 TweenFunction::elasticEaseOut(float t, float b, float c, float d, float a, float p)
@ -304,7 +304,7 @@ float TweenFunction::elasticEaseOut(float t, float b, float c, float d, float a,
float s = 0; float s = 0;
if (t == 0) if (t == 0)
return b; return b;
t /= d; t /= d;
if (t == 1) if (t == 1)
return b + c; return b + c;
if (!p) if (!p)
@ -324,7 +324,7 @@ float TweenFunction::elasticEaseInOut(float t, float b, float c, float d, float
if (t == 0) if (t == 0)
return b; return b;
t /= d; t /= d;
if ((t / 2) == 2) if ((t / 2) == 2)
return b + c; return b + c;
if (!p) if (!p)
p = d * (.3 * 1.5); p = d * (.3 * 1.5);
@ -336,11 +336,11 @@ float TweenFunction::elasticEaseInOut(float t, float b, float c, float d, float
else else
s = p / (2 * M_PI) * asin(c / a); s = p / (2 * M_PI) * asin(c / a);
if (t < 1) if (t < 1)
{ {
t -= 1; t -= 1;
return -.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * M_PI) / p)) + b; return -.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * M_PI) / p)) + b;
} }
t -= 1; t -= 1;
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * M_PI) / p) * .5 + c + b; return a * pow(2, -10 * t) * sin((t * d - s) * (2 * M_PI) / p) * .5 + c + b;
} }
@ -349,13 +349,13 @@ float TweenFunction::backEaseIn(float t, float b, float c, float d, float s)
if (s == 0) if (s == 0)
s = 1.70158f; s = 1.70158f;
t /= d; 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 TweenFunction::backEaseOut(float t, float b, float c, float d, float s)
{ {
if (s == 0) if (s == 0)
s = 1.70158f; s = 1.70158f;
t = t / d - 1; t = t / d - 1;
return c * (t * t * ((s + 1) * t + s) + 1) + b; return c * (t * t * ((s + 1) * t + s) + 1) + b;
} }
float TweenFunction::backEaseInOut(float t, float b, float c, float d, float s) float TweenFunction::backEaseInOut(float t, float b, float c, float d, float s)
@ -363,13 +363,13 @@ float TweenFunction::backEaseInOut(float t, float b, float c, float d, float s)
if (s == 0) if (s == 0)
s = 1.70158f; s = 1.70158f;
if ((t /= d / 2) < 1) if ((t /= d / 2) < 1)
{ {
s *= (1.525f); s *= (1.525f);
return c / 2 * (t * t * ((s + 1) * t - s)) + b; return c / 2 * (t * t * ((s + 1) * t - s)) + b;
} }
t -= 2; t -= 2;
s *= (1.525f); s *= (1.525f);
return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b; return c / 2 * (t * t * ((s + 1) * t + s) + 2) + b;
} }
@ -380,24 +380,24 @@ float TweenFunction::bounceEaseIn(float t, float b, float c, float d)
float TweenFunction::bounceEaseOut(float t, float b, float c, float d) float TweenFunction::bounceEaseOut(float t, float b, float c, float d)
{ {
t /= d; t /= d;
if (t < (1 / 2.75f)) if (t < (1 / 2.75f))
{ {
return c * (7.5625f * t * t) + b; return c * (7.5625f * t * t) + b;
} }
else if (t < (2 / 2.75f)) else if (t < (2 / 2.75f))
{ {
t -= (1.5f / 2.75f); t -= (1.5f / 2.75f);
return c * (7.5625f * t * t + .75f) + b; return c * (7.5625f * t * t + .75f) + b;
} }
else if (t < (2.5f / 2.75f)) 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; return c * (7.5625f * t * t + .9375f) + b;
} }
else else
{ {
t -= (2.625f / 2.75f); t -= (2.625f / 2.75f);
return c * (7.5625f * t * t + .984375f) + b; return c * (7.5625f * t * t + .984375f) + 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

View File

@ -29,22 +29,23 @@ THE SOFTWARE.
#include "CCArmatureDefine.h" #include "CCArmatureDefine.h"
#include <math.h> #include <math.h>
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
enum TweenType{ enum CCTweenType
{
TWEEN_EASING_MIN = -1, TWEEN_EASING_MIN = -1,
Linear, Linear,
Sine_EaseIn, Sine_EaseIn,
Sine_EaseInOut, Sine_EaseInOut,
Sine_EaseOut, Sine_EaseOut,
Quad_EaseIn, Quad_EaseIn,
Quad_EaseOut, Quad_EaseOut,
Quad_EaseInOut, Quad_EaseInOut,
Cubic_EaseIn, Cubic_EaseIn,
Cubic_EaseOut, Cubic_EaseOut,
Cubic_EaseInOut, Cubic_EaseInOut,
@ -52,83 +53,84 @@ enum TweenType{
Quart_EaseIn, Quart_EaseIn,
Quart_EaseOut, Quart_EaseOut,
Quart_EaseInOut, Quart_EaseInOut,
Quint_EaseIn, Quint_EaseIn,
Quint_EaseOut, Quint_EaseOut,
Quint_EaseInOut, Quint_EaseInOut,
Expo_EaseIn, Expo_EaseIn,
Expo_EaseOut, Expo_EaseOut,
Expo_EaseInOut, Expo_EaseInOut,
Circ_EaseIn, Circ_EaseIn,
Circ_EaseOut, Circ_EaseOut,
Circ_EaseInOut, Circ_EaseInOut,
Elastic_EaseIn, Elastic_EaseIn,
Elastic_EaseOut, Elastic_EaseOut,
Elastic_EaseInOut, Elastic_EaseInOut,
Back_EaseIn, Back_EaseIn,
Back_EaseOut, Back_EaseOut,
Back_EaseInOut, Back_EaseInOut,
Bounce_EaseIn, Bounce_EaseIn,
Bounce_EaseOut, Bounce_EaseOut,
Bounce_EaseInOut, Bounce_EaseInOut,
TWEEN_EASING_MAX = 10000 TWEEN_EASING_MAX = 10000
}; };
class TweenFunction{ class TweenFunction
{
public: 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 linear(float t, float b, float c, float d);
static float sineEaseIn(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 sineEaseOut(float t, float b, float c, float d);
static float sineEaseInOut(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 quadEaseIn(float t, float b, float c, float d);
static float quadEaseOut(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 quadEaseInOut(float t, float b, float c, float d);
static float cubicEaseIn(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 cubicEaseOut(float t, float b, float c, float d);
static float cubicEaseInOut(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 quartEaseIn(float t, float b, float c, float d);
static float quartEaseOut(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 quartEaseInOut(float t, float b, float c, float d);
static float quintEaseIn(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 quintEaseOut(float t, float b, float c, float d);
static float quintEaseInOut(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 expoEaseIn(float t, float b, float c, float d);
static float expoEaseOut(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 expoEaseInOut(float t, float b, float c, float d);
static float circEaseIn(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 circEaseOut(float t, float b, float c, float d);
static float circEaseInOut(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 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 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 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 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 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 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 bounceEaseIn(float t, float b, float c, float d);
static float bounceEaseOut(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); 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__*/ #endif /*__CCTWEENFUNCTION_H__*/

View File

@ -25,22 +25,22 @@ THE SOFTWARE.
#include "CCUtilMath.h" #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(); Size s = sprite->getContentSize();
Rect _r(0, 0, _s.width, _s.height); 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); Point p = Point(0, 0);
return isSpriteContainPoint(_sprite, _point, _p); return isSpriteContainPoint(sprite, point, p);
} }
@ -75,4 +75,4 @@ Point circleTo(float t, Point &center, float radius, float fromRadian, float rad
return p; return p;
} }
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
#include "CCArmatureDefine.h" #include "CCArmatureDefine.h"
#include <math.h> #include <math.h>
namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_BEGIN
#define CC_DOUBLE_PI (M_PI*2) #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 &center, float radius, float fromRadian, float radianDif); Point circleTo(float t, Point &center, float radius, float fromRadian, float radianDif);
}}} // namespace cocos2d { namespace extension { namespace armature { NS_CC_EXT_ARMATURE_END
#endif /*__CCUTILMATH_H__*/ #endif /*__CCUTILMATH_H__*/

View File

@ -239,7 +239,7 @@ NS_CC_EXT_BEGIN
textupath += file_path; textupath += file_path;
textupath.append(textureFileName); textupath.append(textureFileName);
cocos2d::extension::armature::CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo(textupath.c_str(), plistpath.c_str(), pPath.c_str()); cocos2d::extension::armature::ArmatureDataManager::getInstance()->addArmatureFileInfo(textupath.c_str(), plistpath.c_str(), pPath.c_str());
} }

View File

@ -59,13 +59,10 @@
#include "CocoStudio/Armature/display/CCDisplayManager.h" #include "CocoStudio/Armature/display/CCDisplayManager.h"
#include "CocoStudio/Armature/display/CCSkin.h" #include "CocoStudio/Armature/display/CCSkin.h"
#include "CocoStudio/Armature/physics/CCColliderDetector.h" #include "CocoStudio/Armature/physics/CCColliderDetector.h"
#include "CocoStudio/Armature/physics/CCPhysicsWorld.h"
#include "CocoStudio/Armature/utils/CCArmatureDataManager.h" #include "CocoStudio/Armature/utils/CCArmatureDataManager.h"
#include "CocoStudio/Armature/utils/CCConstValue.h"
#include "CocoStudio/Armature/utils/CCDataReaderHelper.h" #include "CocoStudio/Armature/utils/CCDataReaderHelper.h"
#include "CocoStudio/Armature/utils/CCTweenFunction.h" #include "CocoStudio/Armature/utils/CCTweenFunction.h"
#include "CocoStudio/Armature/utils/CCArmatureDataManager.h" #include "CocoStudio/Armature/utils/CCArmatureDataManager.h"
#include "CocoStudio/Armature/external_tool/sigslot.h"
#include "CocoStudio/Components/CCComAttribute.h" #include "CocoStudio/Components/CCComAttribute.h"
#include "CocoStudio/Components/CCComAudio.h" #include "CocoStudio/Components/CCComAudio.h"

View File

@ -67,12 +67,9 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
../CocoStudio/Armature/display/CCDecorativeDisplay.cpp \ ../CocoStudio/Armature/display/CCDecorativeDisplay.cpp \
../CocoStudio/Armature/display/CCDisplayFactory.cpp \ ../CocoStudio/Armature/display/CCDisplayFactory.cpp \
../CocoStudio/Armature/display/CCDisplayManager.cpp \ ../CocoStudio/Armature/display/CCDisplayManager.cpp \
../CocoStudio/Armature/display/CCShaderNode.cpp \
../CocoStudio/Armature/display/CCSkin.cpp \ ../CocoStudio/Armature/display/CCSkin.cpp \
../CocoStudio/Armature/external_tool/CCTexture2DMutable.cpp \
../CocoStudio/Armature/external_tool/GLES-Render.cpp \
../CocoStudio/Armature/physics/CCColliderDetector.cpp \ ../CocoStudio/Armature/physics/CCColliderDetector.cpp \
../CocoStudio/Armature/physics/CCPhysicsWorld.cpp \ ../CocoStudio/Armature/utils/CCArmatureDefine.cpp \
../CocoStudio/Armature/utils/CCArmatureDataManager.cpp \ ../CocoStudio/Armature/utils/CCArmatureDataManager.cpp \
../CocoStudio/Armature/utils/CCDataReaderHelper.cpp \ ../CocoStudio/Armature/utils/CCDataReaderHelper.cpp \
../CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.cpp \ ../CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.cpp \

View File

@ -127,12 +127,10 @@
<ClCompile Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.cpp" /> <ClCompile Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.cpp" />
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayFactory.cpp" /> <ClCompile Include="..\CocoStudio\Armature\display\CCDisplayFactory.cpp" />
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayManager.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\display\CCSkin.cpp" />
<ClCompile Include="..\CocoStudio\Armature\external_tool\GLES-Render.cpp" />
<ClCompile Include="..\CocoStudio\Armature\physics\CCColliderDetector.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\CCArmatureDataManager.cpp" />
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDefine.cpp" />
<ClCompile Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.cpp" /> <ClCompile Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.cpp" />
<ClCompile Include="..\CocoStudio\Armature\utils\CCSpriteFrameCacheHelper.cpp" /> <ClCompile Include="..\CocoStudio\Armature\utils\CCSpriteFrameCacheHelper.cpp" />
<ClCompile Include="..\CocoStudio\Armature\utils\CCTransformHelp.cpp" /> <ClCompile Include="..\CocoStudio\Armature\utils\CCTransformHelp.cpp" />
@ -263,15 +261,10 @@
<ClInclude Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.h" /> <ClInclude Include="..\CocoStudio\Armature\display\CCDecorativeDisplay.h" />
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayFactory.h" /> <ClInclude Include="..\CocoStudio\Armature\display\CCDisplayFactory.h" />
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayManager.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\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\CCColliderDetector.h" />
<ClInclude Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h" /> <ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDefine.h" /> <ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDefine.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCConstValue.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.h" /> <ClInclude Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCSpriteFrameCacheHelper.h" /> <ClInclude Include="..\CocoStudio\Armature\utils\CCSpriteFrameCacheHelper.h" />
<ClInclude Include="..\CocoStudio\Armature\utils\CCTransformHelp.h" /> <ClInclude Include="..\CocoStudio\Armature\utils\CCTransformHelp.h" />

View File

@ -55,9 +55,6 @@
<Filter Include="CocoStudio\Armature\utils"> <Filter Include="CocoStudio\Armature\utils">
<UniqueIdentifier>{5e5b3d7d-62a7-493e-a130-ed72ee7c65f2}</UniqueIdentifier> <UniqueIdentifier>{5e5b3d7d-62a7-493e-a130-ed72ee7c65f2}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="CocoStudio\Armature\external_tool">
<UniqueIdentifier>{bd365bbb-6972-4073-b268-8360df428166}</UniqueIdentifier>
</Filter>
<Filter Include="CocoStudio\Json"> <Filter Include="CocoStudio\Json">
<UniqueIdentifier>{d797adcd-2e59-4486-944e-b3e7f3a954b8}</UniqueIdentifier> <UniqueIdentifier>{d797adcd-2e59-4486-944e-b3e7f3a954b8}</UniqueIdentifier>
</Filter> </Filter>
@ -337,18 +334,12 @@
<ClCompile Include="..\CocoStudio\Armature\display\CCDisplayManager.cpp"> <ClCompile Include="..\CocoStudio\Armature\display\CCDisplayManager.cpp">
<Filter>CocoStudio\Armature\display</Filter> <Filter>CocoStudio\Armature\display</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CocoStudio\Armature\display\CCShaderNode.cpp">
<Filter>CocoStudio\Armature\display</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Armature\display\CCSkin.cpp"> <ClCompile Include="..\CocoStudio\Armature\display\CCSkin.cpp">
<Filter>CocoStudio\Armature\display</Filter> <Filter>CocoStudio\Armature\display</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CocoStudio\Armature\physics\CCColliderDetector.cpp"> <ClCompile Include="..\CocoStudio\Armature\physics\CCColliderDetector.cpp">
<Filter>CocoStudio\Armature\physics</Filter> <Filter>CocoStudio\Armature\physics</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.cpp">
<Filter>CocoStudio\Armature\physics</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.cpp"> <ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.cpp">
<Filter>CocoStudio\Armature\utils</Filter> <Filter>CocoStudio\Armature\utils</Filter>
</ClCompile> </ClCompile>
@ -394,8 +385,92 @@
<ClCompile Include="..\CocoStudio\Components\CCComRender.cpp"> <ClCompile Include="..\CocoStudio\Components\CCComRender.cpp">
<Filter>CocoStudio\Components</Filter> <Filter>CocoStudio\Components</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CocoStudio\Armature\external_tool\GLES-Render.cpp"> <ClCompile Include="..\CocoStudio\Armature\utils\CCArmatureDefine.cpp">
<Filter>CocoStudio\Armature\external_tool</Filter> <Filter>CocoStudio\Armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIListView.cpp">
<Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIPageView.cpp">
<Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIScrollView.cpp">
<Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIDragPanel.cpp">
<Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UIImageView.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UILabel.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UILabelAtlas.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UILabelBMFont.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UILoadingBar.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UISlider.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UITextField.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UIButton.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\UICheckBox.cpp">
<Filter>CocoStudio\GUI\UIWidgets</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIAction.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionFrame.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionManager.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Action\UIActionNode.cpp">
<Filter>CocoStudio\GUI\Action</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIRootWidget.cpp">
<Filter>CocoStudio\GUI\BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\BaseClasses\UIWidget.cpp">
<Filter>CocoStudio\GUI\BaseClasses</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Layouts\Layout.cpp">
<Filter>CocoStudio\GUI\Layouts</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Layouts\LayoutExecutant.cpp">
<Filter>CocoStudio\GUI\Layouts</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Layouts\LayoutParameter.cpp">
<Filter>CocoStudio\GUI\Layouts</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\Layouts\UILayoutDefine.cpp">
<Filter>CocoStudio\GUI\Layouts</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\System\CocosGUI.cpp">
<Filter>CocoStudio\GUI\System</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\System\UIHelper.cpp">
<Filter>CocoStudio\GUI\System</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\System\UIInputManager.cpp">
<Filter>CocoStudio\GUI\System</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\GUI\System\UILayer.cpp">
<Filter>CocoStudio\GUI\System</Filter>
</ClCompile>
<ClCompile Include="..\CocoStudio\Reader\CCSGUIReader.cpp">
<Filter>CocoStudio\Reader</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIListView.cpp"> <ClCompile Include="..\CocoStudio\GUI\UIWidgets\ScrollWidget\UIListView.cpp">
<Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter> <Filter>CocoStudio\GUI\UIWidgets\ScrollWidget</Filter>
@ -758,30 +833,18 @@
<ClInclude Include="..\CocoStudio\Armature\display\CCDisplayManager.h"> <ClInclude Include="..\CocoStudio\Armature\display\CCDisplayManager.h">
<Filter>CocoStudio\Armature\display</Filter> <Filter>CocoStudio\Armature\display</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\display\CCShaderNode.h">
<Filter>CocoStudio\Armature\display</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Armature\display\CCSkin.h"> <ClInclude Include="..\CocoStudio\Armature\display\CCSkin.h">
<Filter>CocoStudio\Armature\display</Filter> <Filter>CocoStudio\Armature\display</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\external_tool\sigslot.h">
<Filter>CocoStudio\Armature\external_tool</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Armature\physics\CCColliderDetector.h"> <ClInclude Include="..\CocoStudio\Armature\physics\CCColliderDetector.h">
<Filter>CocoStudio\Armature\physics</Filter> <Filter>CocoStudio\Armature\physics</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\physics\CCPhysicsWorld.h">
<Filter>CocoStudio\Armature\physics</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h"> <ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDataManager.h">
<Filter>CocoStudio\Armature\utils</Filter> <Filter>CocoStudio\Armature\utils</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDefine.h"> <ClInclude Include="..\CocoStudio\Armature\utils\CCArmatureDefine.h">
<Filter>CocoStudio\Armature\utils</Filter> <Filter>CocoStudio\Armature\utils</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\utils\CCConstValue.h">
<Filter>CocoStudio\Armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.h"> <ClInclude Include="..\CocoStudio\Armature\utils\CCDataReaderHelper.h">
<Filter>CocoStudio\Armature\utils</Filter> <Filter>CocoStudio\Armature\utils</Filter>
</ClInclude> </ClInclude>
@ -803,6 +866,9 @@
<ClInclude Include="..\CocoStudio\Armature\CCBone.h"> <ClInclude Include="..\CocoStudio\Armature\CCBone.h">
<Filter>CocoStudio\Armature</Filter> <Filter>CocoStudio\Armature</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\external_tool\GLES-Render.h">
<Filter>CocoStudio\Armature\external_tool</Filter>
</ClInclude>
<ClInclude Include="..\CocoStudio\Json\CSContentJsonDictionary.h"> <ClInclude Include="..\CocoStudio\Json\CSContentJsonDictionary.h">
<Filter>CocoStudio\Json</Filter> <Filter>CocoStudio\Json</Filter>
</ClInclude> </ClInclude>
@ -932,9 +998,6 @@
<ClInclude Include="..\CocoStudio\Reader\CCSGUIReader.h"> <ClInclude Include="..\CocoStudio\Reader\CCSGUIReader.h">
<Filter>CocoStudio\Reader</Filter> <Filter>CocoStudio\Reader</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\CocoStudio\Armature\external_tool\GLES-Render.h">
<Filter>CocoStudio\Armature\external_tool</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\CocoStudio\Json\lib_json\json_internalarray.inl"> <None Include="..\CocoStudio\Json\lib_json\json_internalarray.inl">
@ -950,4 +1013,4 @@
<Filter>CocoStudio\Json\lib_json</Filter> <Filter>CocoStudio\Json\lib_json</Filter>
</None> </None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -59,7 +59,7 @@ void CCSkeleton::initialize () {
blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
setOpacityModifyRGB(true); setOpacityModifyRGB(true);
setShaderProgram(ShaderCache::getInstance()->programForKey(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR)); setShaderProgram(ShaderCache::getInstance()->getProgram(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
scheduleUpdate(); scheduleUpdate();
} }

View File

@ -15,7 +15,7 @@ AppDelegate::AppDelegate()
AppDelegate::~AppDelegate() AppDelegate::~AppDelegate()
{ {
// SimpleAudioEngine::end(); // SimpleAudioEngine::end();
cocos2d::extension::armature::ArmatureDataManager::purgeArmatureSystem(); cocos2d::extension::armature::ArmatureDataManager::purge();
} }
bool AppDelegate::applicationDidFinishLaunching() bool AppDelegate::applicationDidFinishLaunching()

View File

@ -0,0 +1,873 @@
#include "ArmatureScene.h"
#include "../../testResource.h"
using namespace cocos2d;
using namespace cocos2d::extension;
CCLayer* NextTest();
CCLayer* BackTest();
CCLayer* RestartTest();
static int s_nActionIdx = -1;
CCLayer *CreateLayer(int index)
{
CCLayer *pLayer = NULL;
switch(index)
{
case TEST_DRAGON_BONES_2_0:
pLayer = new TestDragonBones20(); break;
case TEST_COCOSTUDIO_WITH_SKELETON:
pLayer = new TestCSWithSkeleton(); break;
case TEST_COCOSTUDIO_WITHOUT_SKELETON:
pLayer = new TestCSWithoutSkeleton(); break;
case TEST_PERFORMANCE:
pLayer = new TestPerformance(); break;
case TEST_CHANGE_ZORDER:
pLayer = new TestChangeZorder(); break;
case TEST_ANIMATION_EVENT:
pLayer = new TestAnimationEvent(); break;
case TEST_PARTICLE_DISPLAY:
pLayer = new TestParticleDisplay(); break;
case TEST_USE_DIFFERENT_PICTURE:
pLayer = new TestUseMutiplePicture(); break;
case TEST_BCOLLIDER_DETECTOR:
pLayer = new TestColliderDetector(); break;
case TEST_BOUDINGBOX:
pLayer = new TestBoundingBox(); break;
case TEST_ANCHORPOINT:
pLayer = new TestAnchorPoint(); break;
case TEST_ARMATURE_NESTING:
pLayer = new TestArmatureNesting(); break;
default:
break;
}
return pLayer;
}
CCLayer* NextTest()
{
++s_nActionIdx;
s_nActionIdx = s_nActionIdx % TEST_LAYER_COUNT;
CCLayer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
return pLayer;
}
CCLayer* BackTest()
{
--s_nActionIdx;
if( s_nActionIdx < 0 )
s_nActionIdx += TEST_LAYER_COUNT;
CCLayer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
return pLayer;
}
CCLayer* RestartTest()
{
CCLayer* pLayer = CreateLayer(s_nActionIdx);
pLayer->autorelease();
return pLayer;
}
ArmatureTestScene::ArmatureTestScene(bool bPortrait)
{
TestScene::init();
CCSprite *bg = CCSprite::create("armature/bg.jpg");
bg->setPosition(VisibleRect::center());
float scaleX = VisibleRect::getVisibleRect().size.width / bg->getContentSize().width;
float scaleY = VisibleRect::getVisibleRect().size.height / bg->getContentSize().height;
bg->setScaleX(scaleX);
bg->setScaleY(scaleY);
addChild(bg);
}
void ArmatureTestScene::runThisTest()
{
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/TestBone0.png", "armature/TestBone0.plist", "armature/TestBone.json");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/Cowboy0.png", "armature/Cowboy0.plist", "armature/Cowboy.ExportJson");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/knight.png", "armature/knight.plist", "armature/knight.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/weapon.png", "armature/weapon.plist", "armature/weapon.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/robot.png", "armature/robot.plist", "armature/robot.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/cyborg.png", "armature/cyborg.plist", "armature/cyborg.xml");
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/Dragon.png", "armature/Dragon.plist", "armature/Dragon.xml");
s_nActionIdx = -1;
addChild(NextTest());
CCDirector::sharedDirector()->replaceScene(this);
}
void ArmatureTestScene::MainMenuCallback(CCObject* pSender)
{
TestScene::MainMenuCallback(pSender);
removeAllChildren();
CCArmatureDataManager::sharedArmatureDataManager()->purgeArmatureSystem();
}
void ArmatureTestLayer::onEnter()
{
CCLayer::onEnter();
// add title and subtitle
std::string str = title();
const char * pTitle = str.c_str();
CCLabelTTF* label = CCLabelTTF::create(pTitle, "Arial", 18);
label->setColor(ccc3(0, 0, 0));
addChild(label, 1, 10000);
label->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 30) );
std::string strSubtitle = subtitle();
if( ! strSubtitle.empty() )
{
CCLabelTTF* l = CCLabelTTF::create(strSubtitle.c_str(), "Arial", 18);
l->setColor(ccc3(0, 0, 0));
addChild(l, 1, 10001);
l->setPosition( ccp(VisibleRect::center().x, VisibleRect::top().y - 60) );
}
// add menu
CCMenuItemImage *item1 = CCMenuItemImage::create(s_pPathB1, s_pPathB2, this, menu_selector(ArmatureTestLayer::backCallback) );
CCMenuItemImage *item2 = CCMenuItemImage::create(s_pPathR1, s_pPathR2, this, menu_selector(ArmatureTestLayer::restartCallback) );
CCMenuItemImage *item3 = CCMenuItemImage::create(s_pPathF1, s_pPathF2, this, menu_selector(ArmatureTestLayer::nextCallback) );
CCMenu *menu = CCMenu::create(item1, item2, item3, NULL);
menu->setPosition(CCPointZero);
item1->setPosition(ccp(VisibleRect::center().x - item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
item2->setPosition(ccp(VisibleRect::center().x, VisibleRect::bottom().y+item2->getContentSize().height/2));
item3->setPosition(ccp(VisibleRect::center().x + item2->getContentSize().width*2, VisibleRect::bottom().y+item2->getContentSize().height/2));
addChild(menu, 100);
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
}
void ArmatureTestLayer::onExit()
{
}
std::string ArmatureTestLayer::title()
{
return "CSArmature Test Bed";
}
std::string ArmatureTestLayer::subtitle()
{
return "";
}
void ArmatureTestLayer::restartCallback(CCObject* pSender)
{
CCScene* s = new ArmatureTestScene();
s->addChild( RestartTest() );
CCDirector::sharedDirector()->replaceScene(s);
s->release();
}
void ArmatureTestLayer::nextCallback(CCObject* pSender)
{
CCScene* s = new ArmatureTestScene();
s->addChild( NextTest() );
CCDirector::sharedDirector()->replaceScene(s);
s->release();
}
void ArmatureTestLayer::backCallback(CCObject* pSender)
{
CCScene* s = new ArmatureTestScene();
s->addChild( BackTest() );
CCDirector::sharedDirector()->replaceScene(s);
s->release();
}
void ArmatureTestLayer::draw()
{
CCLayer::draw();
}
void TestDragonBones20::onEnter()
{
ArmatureTestLayer::onEnter();
cocos2d::extension::CCArmature *armature = NULL;
armature = cocos2d::extension::CCArmature::create("Dragon");
armature->getAnimation()->playByIndex(1);
armature->getAnimation()->setAnimationScale(0.4f);
armature->setPosition(VisibleRect::center().x, VisibleRect::center().y * 0.3f);
armature->setScale(0.6f);
addChild(armature);
}
std::string TestDragonBones20::title()
{
return "Test Export From DragonBones version 2.0";
}
void TestCSWithSkeleton::onEnter()
{
ArmatureTestLayer::onEnter();
cocos2d::extension::CCArmature *armature = NULL;
armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->playByIndex(0);
armature->setScale(0.2f);
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y/*-100*/));
addChild(armature);
}
std::string TestCSWithSkeleton::title()
{
return "Test Export From CocoStudio With Skeleton Effect";
}
void TestCSWithoutSkeleton::onEnter()
{
ArmatureTestLayer::onEnter();
cocos2d::extension::CCArmature *armature = NULL;
armature = cocos2d::extension::CCArmature::create("TestBone");
armature->getAnimation()->playByIndex(0);
armature->setAnchorPoint(ccp(0.5, -0.1));
armature->setScale(0.2f);
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
addChild(armature);
}
std::string TestCSWithoutSkeleton::title()
{
return "Test Export From CocoStudio Without Skeleton Effect";
}
TestPerformance::~TestPerformance()
{
}
void TestPerformance::onEnter()
{
ArmatureTestLayer::onEnter();
armatureCount = frames = times = lastTimes = 0;
generated = false;
scheduleUpdate();
}
std::string TestPerformance::title()
{
return "Test Performance";
}
std::string TestPerformance::subtitle()
{
return "Current CCArmature Count : ";
}
void TestPerformance::addArmature(cocos2d::extension::CCArmature *armature)
{
armatureCount++;
addChild(armature, armatureCount);
}
void TestPerformance::update(float delta)
{
frames ++;
times += delta;
if (frames/times > 58)
{
cocos2d::extension::CCArmature *armature = NULL;
armature = new cocos2d::extension::CCArmature();
armature->init("Knight_f/Knight");
armature->getAnimation()->playByIndex(0);
armature->setPosition(50 + armatureCount * 2, 150);
armature->setScale(0.6f);
addArmature(armature);
armature->release();
char pszCount[255];
sprintf(pszCount, "%s %i", subtitle().c_str(), armatureCount);
CCLabelTTF *label = (CCLabelTTF*)getChildByTag(10001);
label->setString(pszCount);
}
}
void TestChangeZorder::onEnter()
{
ArmatureTestLayer::onEnter();
cocos2d::extension::CCArmature *armature = NULL;
currentTag = -1;
armature = cocos2d::extension::CCArmature::create("Knight_f/Knight");
armature->getAnimation()->playByIndex(0);
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
++currentTag;
armature->setScale(0.6f);
addChild(armature, currentTag, currentTag);
armature = cocos2d::extension::CCArmature::create("TestBone");
armature->getAnimation()->playByIndex(0);
armature->setScale(0.24f);
armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y-100));
++currentTag;
addChild(armature, currentTag, currentTag);
armature = cocos2d::extension::CCArmature::create("Dragon");
armature->getAnimation()->playByIndex(0);
armature->setPosition(ccp(VisibleRect::center().x , VisibleRect::center().y-100));
++currentTag;
armature->setScale(0.6f);
addChild(armature, currentTag, currentTag);
schedule( schedule_selector(TestChangeZorder::changeZorder), 1);
currentTag = 0;
}
std::string TestChangeZorder::title()
{
return "Test Change ZOrder Of Different CCArmature";
}
void TestChangeZorder::changeZorder(float dt)
{
CCNode *node = getChildByTag(currentTag);
node->setZOrder(CCRANDOM_0_1() * 3);
currentTag ++;
currentTag = currentTag % 3;
}
void TestAnimationEvent::onEnter()
{
ArmatureTestLayer::onEnter();
armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->play("Fire");
armature->setScaleX(-0.24f);
armature->setScaleY(0.24f);
armature->setPosition(ccp(VisibleRect::left().x + 50, VisibleRect::left().y));
armature->getAnimation()->MovementEventSignal.connect(this, &TestAnimationEvent::animationEvent);
addChild(armature);
}
std::string TestAnimationEvent::title()
{
return "Test CCArmature Animation Event";
}
void TestAnimationEvent::animationEvent(cocos2d::extension::CCArmature *armature, MovementEventType movementType, const char *movementID)
{
std::string id = movementID;
if (movementType == LOOP_COMPLETE)
{
if (id.compare("Fire") == 0)
{
CCActionInterval *actionToRight = CCMoveTo::create(2, ccp(VisibleRect::right().x - 50, VisibleRect::right().y));
armature->stopAllActions();
armature->runAction(CCSequence::create(actionToRight, CCCallFunc::create(this, callfunc_selector(TestAnimationEvent::callback1)), NULL));
armature->getAnimation()->play("Walk");
}
else if (id.compare("FireMax") == 0)
{
CCActionInterval *actionToLeft = CCMoveTo::create(2, ccp(VisibleRect::left().x + 50, VisibleRect::left().y));
armature->stopAllActions();
armature->runAction(CCSequence::create(actionToLeft, CCCallFunc::create(this, callfunc_selector(TestAnimationEvent::callback2)), NULL));
armature->getAnimation()->play("Walk");
}
}
}
void TestAnimationEvent::callback1()
{
armature->runAction(CCScaleTo::create(0.3f, 0.3f, 0.3f));
armature->getAnimation()->play("FireMax", 10);
}
void TestAnimationEvent::callback2()
{
armature->runAction(CCScaleTo::create(0.3f, -0.3f, 0.3f));
armature->getAnimation()->play("Fire", 10);
}
void TestParticleDisplay::onEnter()
{
ArmatureTestLayer::onEnter();
setTouchEnabled(true);
animationID = 0;
armature = cocos2d::extension::CCArmature::create("robot");
armature->getAnimation()->playByIndex(0);
armature->setPosition(VisibleRect::center());
armature->setScale(0.48f);
armature->getAnimation()->setAnimationScale(0.5f);
addChild(armature);
CCParticleSystem *p1 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
CCParticleSystem *p2 = CCParticleSystemQuad::create("Particles/SmallSun.plist");
cocos2d::extension::CCBone *bone = cocos2d::extension::CCBone::create("p1");
bone->addDisplay(p1, 0);
bone->changeDisplayByIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
bone->setScale(1.2f);
armature->addBone(bone, "bady-a3");
bone = cocos2d::extension::CCBone::create("p2");
bone->addDisplay(p2, 0);
bone->changeDisplayByIndex(0, true);
bone->setIgnoreMovementBoneData(true);
bone->setZOrder(100);
bone->setScale(1.2f);
armature->addBone(bone, "bady-a30");
}
std::string TestParticleDisplay::title()
{
return "Test Particle Display";
}
std::string TestParticleDisplay::subtitle()
{
return "Touch to change animation";
}
bool TestParticleDisplay::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
++animationID;
animationID = animationID % armature->getAnimation()->getMovementCount();
armature->getAnimation()->playByIndex(animationID);
return false;
}
void TestParticleDisplay::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, INT_MIN+1, true);
}
void TestUseMutiplePicture::onEnter()
{
ArmatureTestLayer::onEnter();
setTouchEnabled(true);
displayIndex = 0;
armature = cocos2d::extension::CCArmature::create("Knight_f/Knight");
armature->getAnimation()->playByIndex(0);
armature->setPosition(ccp(VisibleRect::left().x+70, VisibleRect::left().y));
armature->setScale(1.2f);
addChild(armature);
std::string weapon[] = {"weapon_f-sword.png", "weapon_f-sword2.png", "weapon_f-sword3.png", "weapon_f-sword4.png", "weapon_f-sword5.png", "weapon_f-knife.png", "weapon_f-hammer.png"};
CCSpriteDisplayData displayData;
for (int i = 0; i < 7; i++)
{
displayData.setParam(weapon[i].c_str());
armature->getBone("weapon")->addDisplay(&displayData, i);
}
}
std::string TestUseMutiplePicture::title()
{
return "Test One CCArmature Use Different Picture";
}
std::string TestUseMutiplePicture::subtitle()
{
return "weapon and armature are in different picture";
}
bool TestUseMutiplePicture::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
++displayIndex;
displayIndex = (displayIndex) % 6;
armature->getBone("weapon")->changeDisplayByIndex(displayIndex, true);
return false;
}
void TestUseMutiplePicture::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, INT_MIN+1, true);
}
#if ENABLE_PHYSICS_BOX2D_DETECT
class Contact
{
public:
b2Fixture *fixtureA;
b2Fixture *fixtureB;
};
class ContactListener : public b2ContactListener
{
//! Callbacks for derived classes.
virtual void BeginContact(b2Contact *contact)
{
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)
{
contact_list.clear();
B2_NOT_USED(contact);
}
virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold)
{
B2_NOT_USED(contact);
B2_NOT_USED(oldManifold);
}
virtual void PostSolve(const b2Contact *contact, const b2ContactImpulse *impulse)
{
B2_NOT_USED(contact);
B2_NOT_USED(impulse);
}
public:
std::list<Contact> contact_list;
};
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
enum ColliderType
{
eBulletTag,
eEnemyTag
};
int TestColliderDetector::beginHit(cpArbiter *arb, cpSpace *space, void *unused)
{
CP_ARBITER_GET_SHAPES(arb, a, b);
CCBone *bone = (CCBone*)a->data;
bone->getArmature()->setVisible(false);
return 0;
}
void TestColliderDetector::endHit(cpArbiter *arb, cpSpace *space, void *unused)
{
CP_ARBITER_GET_SHAPES(arb, a, b);
CCBone *bone = (CCBone*)a->data;
bone->getArmature()->setVisible(true);
}
void TestColliderDetector::destroyCPBody(cpBody *body)
{
cpShape *shape = body->shapeList_private;
while(shape)
{
cpShape *temp = shape->next_private;
cpSpaceRemoveShape(space, shape);
cpShapeFree(shape);
shape = temp;
}
cpSpaceRemoveBody(space, body);
cpBodyFree(body);
}
#endif
TestColliderDetector::~TestColliderDetector()
{
#if ENABLE_PHYSICS_BOX2D_DETECT
CC_SAFE_DELETE(world);
CC_SAFE_DELETE(listener);
CC_SAFE_DELETE(debugDraw);
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
destroyCPBody(armature2->getCPBody());
destroyCPBody(bullet->getCPBody());
cpSpaceFree(space);
#endif
}
void TestColliderDetector::onEnter()
{
ArmatureTestLayer::onEnter();
scheduleUpdate();
armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->play("FireWithoutBullet");
armature->getAnimation()->setAnimationScale(0.2f);
armature->setScaleX(-0.2f);
armature->setScaleY(0.2f);
armature->setPosition(ccp(VisibleRect::left().x + 70, VisibleRect::left().y));
addChild(armature);
armature2 = cocos2d::extension::CCArmature::create("Cowboy");
armature2->getAnimation()->play("Walk");
armature2->setScaleX(-0.2f);
armature2->setScaleY(0.2f);
armature2->setPosition(ccp(VisibleRect::right().x - 30, VisibleRect::left().y));
addChild(armature2);
bullet = CCPhysicsSprite::createWithSpriteFrameName("25.png");
addChild(bullet);
initWorld();
}
std::string TestColliderDetector::title()
{
return "Test Collider Detector";
}
void TestColliderDetector::draw()
{
#if ENABLE_PHYSICS_BOX2D_DETECT
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
world->DrawDebugData();
kmGLPopMatrix();
#endif
}
void TestColliderDetector::update(float delta)
{
#if ENABLE_PHYSICS_BOX2D_DETECT
armature2->setVisible(true);
#endif
if (armature->getAnimation()->getCurrentFrameIndex() == 9)
{
CCPoint p = armature->getBone("Layer126")->getDisplayRenderNode()->convertToWorldSpaceAR(ccp(0, 0));
bullet->setPosition(ccp(p.x + 60, p.y));
bullet->stopAllActions();
bullet->runAction(CCMoveBy::create(1.5f, ccp(350, 0)));
}
#if ENABLE_PHYSICS_BOX2D_DETECT
world->Step(delta, 0, 0);
for (std::list<Contact>::iterator it = listener->contact_list.begin(); it != listener->contact_list.end(); ++it)
{
Contact &contact = *it;
b2Body *b2a = contact.fixtureA->GetBody();
b2Body *b2b = contact.fixtureB->GetBody();
CCBone *ba = (CCBone *)b2a->GetUserData();
CCBone *bb = (CCBone *)b2b->GetUserData();
bb->getArmature()->setVisible(false);
}
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
cpSpaceStep(space, delta);
#endif
}
void TestColliderDetector::initWorld()
{
#if ENABLE_PHYSICS_BOX2D_DETECT
b2Vec2 noGravity(0, 0);
world = new b2World(noGravity);
world->SetAllowSleeping(true);
listener = new ContactListener();
world->SetContactListener(listener);
debugDraw = new GLESDebugDraw( PT_RATIO );
world->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);
// Define the dynamic body.
//Set up a 1m squared box in the physics world
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
b2Body *body = world->CreateBody(&bodyDef);
// Define another box shape for our dynamic body.
b2PolygonShape dynamicBox;
dynamicBox.SetAsBox(.5f, .5f);//These are mid points for our 1m box
// Define the dynamic body fixture.
b2FixtureDef fixtureDef;
fixtureDef.shape = &dynamicBox;
fixtureDef.isSensor = true;
body->CreateFixture(&fixtureDef);
bullet->setB2Body(body);
bullet->setPTMRatio(PT_RATIO);
bullet->setPosition( ccp( -100, -100) );
body = world->CreateBody(&bodyDef);
armature2->setB2Body(body);
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
space = cpSpaceNew();
space->gravity = cpv(0, 0);
// Physics debug layer
CCPhysicsDebugNode *debugLayer = CCPhysicsDebugNode::create(space);
this->addChild(debugLayer, INT_MAX);
CCSize size = bullet->getContentSize();
int num = 4;
cpVect verts[] = {
cpv(-size.width/2,-size.height/2),
cpv(-size.width/2,size.height/2),
cpv(size.width/2,size.height/2),
cpv(size.width/2,-size.height/2),
};
cpBody *body = cpBodyNew(1.0f, cpMomentForPoly(1.0f, num, verts, cpvzero));
cpSpaceAddBody(space, body);
cpShape* shape = cpPolyShapeNew(body, num, verts, cpvzero);
shape->collision_type = eBulletTag;
cpSpaceAddShape(space, shape);
bullet->setCPBody(body);
body = cpBodyNew(INFINITY, INFINITY);
cpSpaceAddBody(space, body);
armature2->setCPBody(body);
shape = body->shapeList_private;
while(shape){
cpShape *next = shape->next_private;
shape->collision_type = eEnemyTag;
shape = next;
}
cpSpaceAddCollisionHandler(space, eEnemyTag, eBulletTag, beginHit, NULL, NULL, endHit, NULL);
#endif
}
void TestBoundingBox::onEnter()
{
ArmatureTestLayer::onEnter();
armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->playByIndex(0);
armature->setPosition(VisibleRect::center());
armature->setScale(0.2f);
addChild(armature);
}
std::string TestBoundingBox::title()
{
return "Test BoundingBox";
}
void TestBoundingBox::draw()
{
CC_NODE_DRAW_SETUP();
rect = CCRectApplyAffineTransform(armature->boundingBox(), armature->nodeToParentTransform());
ccDrawColor4B(100, 100, 100, 255);
ccDrawRect(rect.origin, ccp(rect.getMaxX(), rect.getMaxY()));
}
void TestAnchorPoint::onEnter()
{
ArmatureTestLayer::onEnter();
for (int i = 0; i<5; i++)
{
cocos2d::extension::CCArmature *armature = cocos2d::extension::CCArmature::create("Cowboy");
armature->getAnimation()->playByIndex(0);
armature->setPosition(VisibleRect::center());
armature->setScale(0.2f);
addChild(armature, 0, i);
}
getChildByTag(0)->setAnchorPoint(ccp(0,0));
getChildByTag(1)->setAnchorPoint(ccp(0,1));
getChildByTag(2)->setAnchorPoint(ccp(1,0));
getChildByTag(3)->setAnchorPoint(ccp(1,1));
getChildByTag(4)->setAnchorPoint(ccp(0.5,0.5));
}
std::string TestAnchorPoint::title()
{
return "Test Set AnchorPoint";
}
void TestArmatureNesting::onEnter()
{
ArmatureTestLayer::onEnter();
setTouchEnabled(true);
armature = cocos2d::extension::CCArmature::create("cyborg");
armature->getAnimation()->playByIndex(1);
armature->setPosition(VisibleRect::center());
armature->setScale(1.2f);
armature->getAnimation()->setAnimationScale(0.4f);
addChild(armature);
weaponIndex = 0;
}
std::string TestArmatureNesting::title()
{
return "Test CCArmature Nesting";
}
bool TestArmatureNesting::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
++weaponIndex;
weaponIndex = weaponIndex % 4;
armature->getBone("armInside")->getChildArmature()->getAnimation()->playByIndex(weaponIndex);
armature->getBone("armOutside")->getChildArmature()->getAnimation()->playByIndex(weaponIndex);
return false;
}
void TestArmatureNesting::registerWithTouchDispatcher()
{
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, INT_MIN+1, true);
}

View File

@ -0,0 +1,217 @@
#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "cocos-ext.h"
#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:
ArmatureTestScene(bool bPortrait = false);
virtual void runThisTest();
// The CallBack for back to the main menu scene
virtual void MainMenuCallback(CCObject* pSender);
};
enum {
TEST_COCOSTUDIO_WITH_SKELETON = 0,
TEST_COCOSTUDIO_WITHOUT_SKELETON,
TEST_DRAGON_BONES_2_0,
TEST_PERFORMANCE,
TEST_CHANGE_ZORDER,
TEST_ANIMATION_EVENT,
TEST_PARTICLE_DISPLAY,
TEST_USE_DIFFERENT_PICTURE,
TEST_BCOLLIDER_DETECTOR,
TEST_BOUDINGBOX,
TEST_ANCHORPOINT,
TEST_ARMATURE_NESTING,
TEST_LAYER_COUNT
};
class ArmatureTestLayer : public CCLayer
{
public:
virtual void onEnter();
virtual void onExit();
virtual std::string title();
virtual std::string subtitle();
void restartCallback(CCObject* pSender);
void nextCallback(CCObject* pSender);
void backCallback(CCObject* pSender);
virtual void draw();
};
class TestDragonBones20 : public ArmatureTestLayer
{
public:
virtual void onEnter();
virtual std::string title();
};
class TestCSWithSkeleton : public ArmatureTestLayer
{
virtual void onEnter();
virtual std::string title();
};
class TestCSWithoutSkeleton : public ArmatureTestLayer
{
virtual void onEnter();
virtual std::string title();
};
class TestPerformance : public ArmatureTestLayer
{
public:
~TestPerformance();
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
virtual void addArmature(cocos2d::extension::CCArmature *armature);
void update(float delta);
int armatureCount;
int frames;
float times;
float lastTimes;
bool generated;
};
class TestChangeZorder : public ArmatureTestLayer
{
virtual void onEnter();
virtual std::string title();
void changeZorder(float dt);
int currentTag;
};
class TestAnimationEvent : public ArmatureTestLayer, public sigslot::has_slots<>
{
public:
virtual void onEnter();
virtual std::string title();
void animationEvent(cocos2d::extension::CCArmature *armature, cocos2d::extension::MovementEventType movementType, const char *movementID);
void callback1();
void callback2();
cocos2d::extension::CCArmature *armature;
};
class TestUseMutiplePicture : public ArmatureTestLayer
{
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void registerWithTouchDispatcher();
int displayIndex;
cocos2d::extension::CCArmature *armature;
};
class TestParticleDisplay : public ArmatureTestLayer
{
virtual void onEnter();
virtual std::string title();
virtual std::string subtitle();
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void registerWithTouchDispatcher();
int animationID;
cocos2d::extension::CCArmature *armature;
};
#if ENABLE_PHYSICS_BOX2D_DETECT
class ContactListener;
#endif
class TestColliderDetector : public ArmatureTestLayer, public sigslot::has_slots<>
{
public:
~TestColliderDetector();
virtual void onEnter();
virtual std::string title();
virtual void draw();
virtual void update(float delta);
void initWorld();
cocos2d::extension::CCArmature *armature;
cocos2d::extension::CCArmature *armature2;
cocos2d::extension::CCPhysicsSprite *bullet;
#if ENABLE_PHYSICS_BOX2D_DETECT
b2World *world;
ContactListener *listener;
GLESDebugDraw *debugDraw;
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
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:
virtual void onEnter();
virtual std::string title();
virtual void draw();
cocos2d::extension::CCArmature *armature;
CCRect rect;
};
class TestAnchorPoint : public ArmatureTestLayer
{
public:
virtual void onEnter();
virtual std::string title();
};
class TestArmatureNesting : public ArmatureTestLayer
{
public:
virtual void onEnter();
virtual std::string title();
virtual bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
virtual void registerWithTouchDispatcher();
cocos2d::extension::CCArmature *armature;
int weaponIndex;
};
#endif // __HELLOWORLD_SCENE_H__

View File

@ -6,6 +6,13 @@
#include "../../VisibleRect.h" #include "../../VisibleRect.h"
#include "../../testBasic.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 class ArmatureTestScene : public TestScene
{ {
public: public:
@ -14,19 +21,19 @@ public:
virtual void runThisTest(); virtual void runThisTest();
// The CallBack for back to the main menu scene // The CallBack for back to the main menu scene
virtual void MainMenuCallback(Object* sender); virtual void MainMenuCallback(Object* pSender);
}; };
enum { enum {
TEST_COCOSTUDIO_WITH_SKELETON = 0, TEST_ASYNCHRONOUS_LOADING = 0,
TEST_COCOSTUDIO_WITHOUT_SKELETON, TEST_COCOSTUDIO_WITH_SKELETON,
TEST_DRAGON_BONES_2_0, TEST_DRAGON_BONES_2_0,
TEST_PERFORMANCE, TEST_PERFORMANCE,
TEST_CHANGE_ZORDER, TEST_CHANGE_ZORDER,
TEST_ANIMATION_EVENT, TEST_ANIMATION_EVENT,
TEST_PARTICLE_DISPLAY, TEST_PARTICLE_DISPLAY,
TEST_USE_DIFFERENT_PICTURE, TEST_USE_DIFFERENT_PICTURE,
TEST_BOX2D_DETECTOR, TEST_BCOLLIDER_DETECTOR,
TEST_BOUDINGBOX, TEST_BOUDINGBOX,
TEST_ANCHORPOINT, TEST_ANCHORPOINT,
TEST_ARMATURE_NESTING, TEST_ARMATURE_NESTING,
@ -43,32 +50,39 @@ public:
virtual std::string title(); virtual std::string title();
virtual std::string subtitle(); virtual std::string subtitle();
void restartCallback(Object* sender); virtual void restartCallback(Object* pSender);
void nextCallback(Object* sender); virtual void nextCallback(Object* pSender);
void backCallback(Object* sender); virtual void backCallback(Object* pSender);
virtual void draw(); virtual void draw();
protected:
MenuItemImage *restartItem;
MenuItemImage *nextItem;
MenuItemImage *backItem;
}; };
class TestAsynchronousLoading : public ArmatureTestLayer
class TestDragonBones20 : public ArmatureTestLayer
{ {
public: public:
virtual void onEnter(); virtual void onEnter();
virtual std::string title(); virtual std::string title();
virtual std::string subtitle();
void dataLoaded(float percent);
}; };
class TestCSWithSkeleton : public ArmatureTestLayer class TestCSWithSkeleton : public ArmatureTestLayer
{ {
virtual void onEnter(); virtual void onEnter();
virtual std::string title(); virtual std::string title();
}; };
class TestCSWithoutSkeleton : public ArmatureTestLayer
class TestDragonBones20 : public ArmatureTestLayer
{ {
public:
virtual void onEnter(); virtual void onEnter();
virtual std::string title(); virtual std::string title();
}; };
@ -104,7 +118,7 @@ class TestChangeZorder : public ArmatureTestLayer
}; };
class TestAnimationEvent : public ArmatureTestLayer, public sigslot::has_slots<> class TestAnimationEvent : public ArmatureTestLayer
{ {
public: public:
@ -120,10 +134,10 @@ public:
class TestUseMutiplePicture : public ArmatureTestLayer class TestUseMutiplePicture : public ArmatureTestLayer
{ {
virtual void onEnter(); virtual void onEnter();
virtual void onExit();
virtual std::string title(); virtual std::string title();
virtual std::string subtitle(); virtual std::string subtitle();
virtual bool onTouchBegan(Touch *touch, Event *event); virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event* event) override;
// virtual void registerWithTouchDispatcher();
int displayIndex; int displayIndex;
cocos2d::extension::armature::Armature *armature; cocos2d::extension::armature::Armature *armature;
@ -132,29 +146,86 @@ class TestUseMutiplePicture : public ArmatureTestLayer
class TestParticleDisplay : public ArmatureTestLayer class TestParticleDisplay : public ArmatureTestLayer
{ {
virtual void onEnter(); virtual void onEnter();
virtual void onExit();
virtual std::string title(); virtual std::string title();
virtual std::string subtitle(); virtual std::string subtitle();
virtual bool onTouchBegan(Touch *touch, Event *event); virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
// virtual void registerWithTouchDispatcher();
int animationID; int animationID;
cocos2d::extension::armature::Armature *armature; cocos2d::extension::armature::Armature *armature;
}; };
class TestBox2DDetector : public ArmatureTestLayer, public sigslot::has_slots<>
#if ENABLE_PHYSICS_BOX2D_DETECT
class ContactListener;
class TestColliderDetector : public ArmatureTestLayer
{ {
public: public:
~TestColliderDetector();
virtual void onEnter(); virtual void onEnter();
virtual void onExit();
virtual std::string title(); virtual std::string title();
virtual void draw(); virtual void draw();
virtual void update(float delta); virtual void update(float delta);
void onHit(cocos2d::extension::armature::Bone *bone, cocos2d::extension::armature::Bone *bone2); void onFrameEvent(cocos2d::extension::armature::Bone *bone, const char *evt, int originFrameIndex, int currentFrameIndex);
void initWorld();
cocos2d::extension::armature::Armature *armature; cocos2d::extension::armature::Armature *armature;
cocos2d::extension::armature::Armature *armature2; cocos2d::extension::armature::Armature *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::Bone *bone, const char *evt, int originFrameIndex, int currentFrameIndex);
void initWorld();
cocos2d::extension::armature::Armature *armature;
cocos2d::extension::armature::Armature *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 class TestBoundingBox : public ArmatureTestLayer
{ {
public: public:
@ -177,9 +248,9 @@ class TestArmatureNesting : public ArmatureTestLayer
{ {
public: public:
virtual void onEnter(); virtual void onEnter();
virtual void onExit();
virtual std::string title(); virtual std::string title();
virtual bool onTouchBegan(Touch *touch, Event *event); virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
// virtual void registerWithTouchDispatcher();
cocos2d::extension::armature::Armature *armature; cocos2d::extension::armature::Armature *armature;
int weaponIndex; int weaponIndex;

View File

@ -0,0 +1 @@
434a36b3e7fa9c849986cf6128b7d4402a382eb7

View File

@ -1 +1 @@
db891b84393bfe4b806f46bbf9c2879fa9438608 2b61d3b005b4076c5ff22a78a00822c0f0dc0875

View File

@ -1,347 +1,236 @@
<skeleton name="Dragon" frameRate="24" version="2.1"> <skeleton name="Dragon" frameRate="24" version="2.0">
<armatures> <armatures>
<armature name="Dragon"> <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"> <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" pX="0" pY="0"/> <d name="parts-tailTip"/>
</b> </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"> <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" pX="41" pY="16"/> <d name="parts-armUpperL"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-armL"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-handL"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-legL"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-body"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-hair"/>
</b> </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"> <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" pX="79.5" pY="160"/> <d name="parts-head"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-eyeL"/>
</b> </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"> <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" pX="8" pY="15"/> <d name="parts-eyeR"/>
</b> </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"> <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" pX="0" pY="-63.8"/> <d name="parts-tail"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-legR"/>
</b> </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"> <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" pX="12" pY="28"/> <d name="parts-armUpperR"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-armR"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-handR"/>
</b> </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"> <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" pX="54" pY="4"/> <d name="parts-beardL"/>
</b> </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"> <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" pX="0" pY="0"/> <d name="parts-beardR"/>
</b> </b>
</armature> </armature>
</armatures> </armatures>
<animations> <animations>
<animation name="Dragon"> <animation name="Dragon">
<mov name="stand" dr="7" to="6" drTW="30" lp="1" twE="0"> <mov name="stand" dr="7" to="6" drTW="30" lp="1" twE="0">
<b name="tailTip" sc="1" dl="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="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.2" pY="93.1" z="0" dI="0" dr="3"/> <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.25" pY="93.05" z="0" dI="0" dr="2"/> <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>
<b name="armUpperL" sc="1" dl="0"> <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"/> <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>
<b name="armL" sc="1" dl="0"> <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"/> <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>
<b name="handL" sc="1" dl="0"> <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"/> <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>
<b name="legL" sc="1" dl="0"> <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"/> <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>
<b name="body" sc="1" dl="0"> <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="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="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="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="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="59" pY="87" z="5" dI="0" dr="2"/>
</b> </b>
<b name="hair" sc="1" dl="0"> <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="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.3" z="6" dI="0" dr="2"/> <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.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" z="6" dI="0" dr="2"/>
</b> </b>
<b name="head" sc="1" dl="0"> <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"/> <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>
<b name="eyeL" sc="1" dl="0"> <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="-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="6.85" pY="11.3" z="8" dI="0" dr="3"/> <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="6.85" pY="11.3" z="8" dI="0" dr="2"/> <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>
<b name="eyeR" sc="1" dl="0"> <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="-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.1" pY="14.4" z="9" dI="0" dr="3"/> <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.1" pY="14.4" z="9" dI="0" dr="2"/> <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>
<b name="tail" sc="1" dl="0"> <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="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="11.55" pY="176.35" z="10" dI="0" dr="3"/> <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="11.5" pY="176.35" z="10" dI="0" dr="2"/> <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>
<b name="legR" sc="1" dl="0"> <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"/> <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>
<b name="armUpperR" sc="1" dl="0"> <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"/> <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>
<b name="armR" sc="1" dl="0"> <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"/> <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>
<b name="handR" sc="1" dl="0"> <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"/> <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>
<b name="beardL" sc="2" dl="0.3"> <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="-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="-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"/> <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>
<b name="beardR" sc="2" dl="0.3"> <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="-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.2" pY="8.95" z="16" dI="0" dr="3"/> <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.2" pY="8.9" z="16" dI="0" dr="2"/> <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> </b>
</mov> </mov>
<mov name="walk" dr="8" to="5" drTW="20" lp="1" twE="0"> <mov name="walk" dr="8" to="5" drTW="20" lp="1" twE="0">
<b name="tailTip" sc="1.5" dl="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="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.15" pY="93.15" 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"/>
</b> <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 name="armUpperL" sc="1" dl="0"> </b>
<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"/> <b name="armUpperL" sc="1" dl="0">
<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"/> <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"/>
</b> <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"/>
<b name="armL" 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="1"/>
<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"/> </b>
<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 name="armL" sc="1" dl="0">
</b> <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"/>
<b name="handL" sc="1" dl="0"> <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="-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="-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"/>
<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> <b name="handL" sc="1" dl="0">
<b name="legL" 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="-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="-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="-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"/> <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>
<b name="body" sc="1" dl="0"> <b name="legL" 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="-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="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"/> <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"/>
</b> <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 name="hair" sc="1" dl="0"> </b>
<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"/> <b name="body" sc="1" dl="0">
<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"/> <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"/>
</b> <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"/>
<b name="head" 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="1"/>
<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"/> </b>
<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 name="hair" sc="1" dl="0">
</b> <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"/>
<b name="eyeL" sc="1" dl="0"> <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="-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="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"/>
<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> <b name="head" sc="1" dl="0">
<b name="eyeR" 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.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.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="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="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>
<b name="tail" sc="1.1" dl="0"> <b name="eyeL" sc="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="-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="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"/> <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"/>
</b> <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 name="legR" sc="1" dl="0"> </b>
<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"/> <b name="eyeR" sc="1" dl="0">
<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"/> <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"/>
</b> <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"/>
<b name="armUpperR" 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="1"/>
<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"/> </b>
<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 name="tail" sc="1.1" dl="0">
</b> <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"/>
<b name="armR" sc="1" dl="0"> <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="-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="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"/>
<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> <b name="legR" sc="1" dl="0">
<b name="handR" 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="-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="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="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"/> <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>
<b name="beardL" sc="1" dl="0"> <b name="armUpperR" 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="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="-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"/> <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"/>
</b> <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 name="beardR" sc="1" dl="0"> </b>
<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"/> <b name="armR" sc="1" dl="0">
<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"/> <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"/>
</b> <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"/>
</mov> <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"/>
<mov name="jump" dr="5" to="3" drTW="5" lp="1" twE="NaN"> </b>
<b name="tailTip" sc="1" dl="0"> <b name="handR" 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="-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="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"/> <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"/>
</b> <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 name="armUpperL" sc="1" dl="0"> </b>
<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"/> <b name="beardL" sc="1" dl="0">
<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"/> <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"/>
</b> <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"/>
<b name="armL" 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="1"/>
<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> <b name="beardR" sc="1" dl="0">
<b name="handL" 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="-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"/> <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"/>
</b> <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 name="legL" sc="1" dl="0"> </b>
<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"/> </mov>
<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"/> </animation>
</b> </animations>
<b name="body" sc="1" dl="0"> <TextureAtlas name="Dragon" width="512" height="512">
<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"/> <SubTexture name="parts-beardR" width="68" height="18" cocos2d_pX="0" cocos2d_pY="0" x="291" y="233"/>
</b> <SubTexture name="parts-beardL" width="60" height="18" cocos2d_pX="54" cocos2d_pY="4" x="229" y="221"/>
<b name="hair" sc="1" dl="0"> <SubTexture name="parts-handR" width="49" height="29" cocos2d_pX="0" cocos2d_pY="0" x="82" y="240"/>
<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"/> <SubTexture name="parts-armR" width="23" height="39" cocos2d_pX="0" cocos2d_pY="0" x="465" y="160"/>
<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"/> <SubTexture name="parts-armUpperR" width="80" height="47" cocos2d_pX="12" cocos2d_pY="28" x="0" y="199"/>
</b> <SubTexture name="parts-legR" width="90" height="116" cocos2d_pX="0" cocos2d_pY="0" x="401" y="0"/>
<b name="head" sc="1" dl="0"> <SubTexture name="parts-tail" width="108" height="139" cocos2d_pX="0" cocos2d_pY="-63.8" x="291" y="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"/> <SubTexture name="parts-eyeR" width="19" height="29" cocos2d_pX="8" cocos2d_pY="15" x="491" y="118"/>
</b> <SubTexture name="parts-eyeL" width="14" height="23" cocos2d_pX="0" cocos2d_pY="0" x="493" y="0"/>
<b name="eyeL" sc="1" dl="0"> <SubTexture name="parts-head" width="169" height="197" cocos2d_pX="79.5" cocos2d_pY="160" x="0" y="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"/> <SubTexture name="parts-hair" width="62" height="141" cocos2d_pX="0" cocos2d_pY="0" x="401" y="118"/>
<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"/> <SubTexture name="parts-body" width="118" height="174" cocos2d_pX="0" cocos2d_pY="0" x="171" y="0"/>
</b> <SubTexture name="parts-legL" width="102" height="90" cocos2d_pX="0" cocos2d_pY="0" x="291" y="141"/>
<b name="eyeR" sc="1" dl="0"> <SubTexture name="parts-handL" width="48" height="39" cocos2d_pX="0" cocos2d_pY="0" x="82" y="199"/>
<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"/> <SubTexture name="parts-armL" width="24" height="40" cocos2d_pX="0" cocos2d_pY="0" x="465" y="118"/>
<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"/> <SubTexture name="parts-armUpperL" width="56" height="43" cocos2d_pX="41" cocos2d_pY="16" x="229" y="176"/>
</b> <SubTexture name="parts-tailTip" width="56" height="105" cocos2d_pX="0" cocos2d_pY="0" x="171" y="176"/>
<b name="tail" sc="1" dl="0"> </TextureAtlas>
<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> </skeleton>

View File

@ -1 +0,0 @@
9214ad04b05ad72fa41db4d989510b785b200f0b

View File

@ -167,281 +167,181 @@
</mov> </mov>
</animation> </animation>
<animation name="cyborg"> <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"> <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="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" 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" 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>
<b name="legL" sc="1" dl="0"> <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="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" 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" 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>
<b name="crusL" sc="1" dl="0"> <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="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" 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" 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>
<b name="body" sc="1" dl="0.05"> <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="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" 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" 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>
<b name="crotch" sc="1" dl="0"> <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="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" 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="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>
<b name="chest" sc="1" dl="0.1"> <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="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" 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" 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>
<b name="head" sc="1" dl="0.2"> <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="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" 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" 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>
<b name="legR" sc="1" dl="0"> <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="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" 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" 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>
<b name="crusR" sc="1" dl="0"> <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="-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" 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" 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>
<b name="armOutside" sc="1" dl="0"> <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="-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" 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" 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> </b>
</mov> </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"> <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="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" 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" 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>
<b name="legL" sc="1" dl="0"> <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="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" 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" 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>
<b name="crusL" sc="1" dl="-0.15"> <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="-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" 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" 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>
<b name="body" sc="0.5" dl="0"> <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="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" 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" 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>
<b name="crotch" sc="0.5" dl="0"> <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" 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" 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="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>
<b name="chest" sc="0.5" dl="0"> <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="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" 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" 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>
<b name="head" sc="0.5" dl="0"> <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="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" 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" 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>
<b name="legR" sc="1" dl="0"> <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="-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" 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" 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>
<b name="crusR" sc="1" dl="-0.15"> <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="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" 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" 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>
<b name="armOutside" sc="1" dl="0"> <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="-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" 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" 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> </b>
</mov> </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"> <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="-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>
<b name="legL" sc="1" dl="0"> <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="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>
<b name="crusL" sc="1" dl="-0.85"> <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="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>
<b name="body" sc="0.5" dl="0"> <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="-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>
<b name="crotch" sc="0.5" dl="0.5"> <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="-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>
<b name="chest" sc="0.5" dl="0"> <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="-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>
<b name="head" sc="0.5" dl="0"> <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="-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>
<b name="legR" sc="1" dl="0"> <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="-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>
<b name="crusR" sc="1" dl="-0.85"> <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="-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>
<b name="armOutside" sc="1" dl="0"> <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="-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> </b>
</mov> </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> </animation>
</animations> </animations>
<TextureAtlas name="Cyborg" width="128" height="128"> <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-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-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-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-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-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-RightThigh" width="14" height="28" cocos2d_pX="7" cocos2d_pY="5" x="93" y="64"/>
<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-Head" width="32" height="18" cocos2d_pX="20" cocos2d_pY="18" x="94" y="44"/> <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-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-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-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-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> </TextureAtlas>
</skeleton> </skeleton>

View File

@ -1,287 +1,194 @@
<skeleton name="Example03" frameRate="30" version="1.4"> <skeleton name="Example03" frameRate="30" version="2.0">
<armatures> <armatures>
<armature name="Knight_f/Knight"> <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"/> <d name="Knight_f-horse_leg"/>
</b> </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"/> <d name="Knight_f-horse_leg"/>
</b> </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"/> <d name="Knight_f-horse_leg"/>
</b> </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"/> <d name="Knight_f-horse_leg"/>
</b> </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"/> <d name="Knight_f-horse_body"/>
</b> </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"/> <d name="Knight_f-horse_tail"/>
</b> </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"/> <d name="Knight_f-horse_head"/>
</b> </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"/> <d name="Knight_f-hero_arm"/>
</b> </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"/> <d name="Knight_f-hero_body"/>
</b> </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"/> <d name="Knight_f-hero_leg"/>
</b> </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"/> <d name="Knight_f-hero_head"/>
</b> </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"/> <d name="Knight_f-hero_sword"/>
</b> </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"/> <d name="Knight_f-hero_arm"/>
</b> </b>
</armature> </armature>
</armatures> </armatures>
<animations> <animations>
<animation name="Knight_f/Knight"> <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"> <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" 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" 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="1"/>
</b> </b>
<b name="horseLegL1" sc="1" dl="0"> <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" 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" 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="1"/>
</b> </b>
<b name="horseLegR2" sc="1" dl="0"> <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" 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" 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="1"/>
</b> </b>
<b name="horseLegR1" sc="1" dl="0"> <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" 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" 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="1"/>
</b> </b>
<b name="horseBody" sc="1" dl="0"> <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="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" 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" 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>
<b name="horseTail" sc="1" dl="0"> <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" 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" 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.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>
<b name="horseHead" sc="1" dl="0"> <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" 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" 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.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>
<b name="armL" sc="1" dl="0"> <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.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" 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" 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>
<b name="body" sc="1" dl="0"> <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="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" 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" 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>
<b name="leg" sc="1" dl="0"> <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="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" 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" 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>
<b name="head" sc="1" dl="0"> <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="-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" 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="-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>
<b name="weapon" sc="1" dl="0"> <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="-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" 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="-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>
<b name="armR" sc="1" dl="0"> <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="-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" 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="-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> </b>
</mov> </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"> <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="-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" 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="-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>
<b name="horseLegL1" sc="1" dl="0.1"> <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="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" 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="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>
<b name="horseLegR2" sc="1" dl="0"> <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="-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" 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="-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>
<b name="horseLegR1" sc="1" dl="0"> <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="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" 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="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>
<b name="horseBody" sc="1" dl="0"> <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="-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" 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="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>
<b name="horseTail" sc="1" dl="0"> <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="-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" 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.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>
<b name="horseHead" sc="1" dl="0.15"> <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.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" 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.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>
<b name="armL" sc="1" dl="0"> <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="-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" 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="-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>
<b name="body" sc="1" dl="0"> <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="-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" 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="-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>
<b name="leg" sc="1" dl="0"> <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="-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" 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="-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>
<b name="head" sc="1" dl="0"> <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="-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" 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="-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>
<b name="weapon" sc="1" dl="0.4"> <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="-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" 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="-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>
<b name="armR" sc="1" dl="0"> <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="-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" 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"/> <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"/>
</b> <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"/>
</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"/>
</b> </b>
</mov> </mov>
</animation> </animation>
</animations> </animations>
<TextureAtlas name="Example03" width="512" height="64"> <TextureAtlas name="Example03" width="128" height="128">
<SubTexture name="Knight_f-hero_sword" pX="10" pY="15" width="90" height="30" x="0" y="0"/> <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" pX="22" pY="37.95" width="44" height="40" x="134" 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" pX="4" pY="0" width="8" height="16" x="260" y="0"/> <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" pX="7" pY="14" width="14" height="16" x="244" 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" pX="2" pY="4" width="20" height="10" x="222" y="0"/> <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" pX="2" pY="46" width="40" height="48" 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" pX="6" pY="2" width="8" height="12" x="280" y="0"/> <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" pX="20" pY="2" width="40" height="20" x="180" y="0"/> <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" pX="4" pY="0" width="8" height="14" x="270" y="0"/> <SubTexture name="Knight_f-horse_leg" width="8" height="14" cocos2d_pX="4" cocos2d_pY="0" x="108" y="18"/>
</TextureAtlas> </TextureAtlas>
</skeleton> </skeleton>

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
06fb5524ddc56e1aaa5872fae8b646a97345f6fe