Converted spine-cocos2dx from spine-cpp to spine-c.

This commit is contained in:
NathanSweet 2013-04-02 02:47:36 +02:00
parent ca163b5e52
commit e454021503
26 changed files with 776 additions and 1929 deletions

View File

@ -15,21 +15,22 @@ CCScene* ExampleLayer::scene () {
bool ExampleLayer::init () {
if (!CCLayer::init()) return false;
atlas = new Atlas("spineboy.txt");
SkeletonJson json(atlas);
json.scale = 0.5;
skeletonData = json.readSkeletonData("spineboy-skeleton.json");
animation = json.readAnimation("spineboy-walk.json", skeletonData);
atlas = Atlas_readAtlasFile("spineboy.atlas");
SkeletonJson* json = SkeletonJson_create(atlas);
json->scale = 0.75;
skeletonData = SkeletonJson_readSkeletonDataFile(json, "spineboy-skeleton.json");
animation = SkeletonJson_readAnimationFile(json, "spineboy-walk.json", skeletonData);
SkeletonJson_dispose(json);
CCSkeleton* skeletonNode = CCSkeleton::create(skeletonData);
skeletonNode->state->setAnimation(animation, true);
skeletonNode->debug = true;
CCAction* fade = CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1),
CCFadeIn::create(1),
CCDelayTime::create(5),
NULL));
skeletonNode->runAction(fade);
Skeleton_setToBindPose(skeletonNode->skeleton);
AnimationState_setAnimation(skeletonNode->state, animation, true);
skeletonNode->debugBones = true;
/*skeletonNode->runAction(CCRepeatForever::create(CCSequence::create(CCFadeOut::create(1),
CCFadeIn::create(1),
CCDelayTime::create(5),
NULL)));*/
CCSize windowSize = CCDirector::sharedDirector()->getWinSize();
skeletonNode->setPosition(ccp(windowSize.width / 2, 20));
@ -39,7 +40,7 @@ bool ExampleLayer::init () {
}
ExampleLayer::~ExampleLayer () {
delete atlas;
delete skeletonData;
delete animation;
SkeletonData_dispose(skeletonData);
Animation_dispose(animation);
Atlas_dispose(atlas);
}

View File

@ -2,7 +2,7 @@
#define _EXAMPLELAYER_H_
#include "cocos2d.h"
#include <spine-cocos2dx/spine.h>
#include <spine/spine-cocos2dx.h>
class ExampleLayer: public cocos2d::CCLayer {
private:

View File

@ -1,204 +0,0 @@
{
"bones": {
"torso": {
"rotate": [
{
"time": 0,
"angle": -16.96,
"curve": [ 0.356, 0.01, 0.827, 0.82 ]
},
{
"time": 0.7333,
"angle": -33.3,
"curve": [ 0.137, 0.2, 0.652, 0.86 ]
},
{ "time": 1.6, "angle": -8.18 },
{ "time": 2.3333, "angle": 1.82 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"neck": {
"rotate": [
{ "time": 0, "angle": 10.71 },
{
"time": 0.7333,
"angle": -12.37,
"curve": [ 0.137, 0.2, 0.652, 0.86 ]
},
{ "time": 2.3333, "angle": 12.74 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{
"time": 0.7333,
"x": -1.67,
"y": -3.3,
"curve": [ 0.137, 0.2, 0.652, 0.86 ]
},
{ "time": 2.3333, "x": -1.04, "y": -0.38 }
]
},
"head": {
"rotate": [
{ "time": 0, "angle": 12.63 },
{
"time": 0.7333,
"angle": 10.39,
"curve": [ 0.137, 0.2, 0.652, 0.86 ]
},
{ "time": 2.3333, "angle": -11.41 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.7333, "x": -0.85, "y": -5.38 },
{ "time": 2.3333, "x": 1.02, "y": 4.99 }
]
},
"right shoulder": {
"rotate": [
{ "time": 0, "angle": -7.36 },
{ "time": 0.7333, "angle": -229.15 },
{ "time": 1.9666, "angle": -12.04 },
{ "time": 2.5666, "angle": -39.4 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.7333, "x": -3.78, "y": -8.32 },
{
"time": 1.2666,
"x": -2.26,
"y": 1.26,
"curve": [ 0.08, 0.08, 0.75, 1 ]
},
{ "time": 1.9666, "x": -5.25, "y": 7.6 },
{ "time": 2.5666, "x": -5.58, "y": 13.32 }
]
},
"right arm": {
"rotate": [
{ "time": 0, "angle": 6.19 },
{ "time": 0.7333, "angle": 19.54 },
{
"time": 1.2666,
"angle": 90.5,
"curve": [ 0.08, 0.08, 0.75, 1 ]
},
{ "time": 1.9666, "angle": 124.15 },
{ "time": 2.5666, "angle": 133.59 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"left shoulder": {
"rotate": [
{ "time": 0, "angle": -21.47 },
{ "time": 0.7333, "angle": 94.34 },
{
"time": 1.4333,
"angle": 60.17,
"curve": [ 0.08, 0.08, 0.75, 1 ]
},
{ "time": 1.8666, "angle": 78.57 },
{ "time": 2.3333, "angle": 68.5 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.7333, "x": -8.29, "y": 5.93 },
{ "time": 1.8666, "x": -4.3, "y": -5.12 }
]
},
"left arm": {
"rotate": [
{ "time": 0, "angle": 56.2 },
{ "time": 0.7333, "angle": -28.44 },
{
"time": 1.2666,
"angle": -10.8,
"curve": [ 0.08, 0.08, 0.75, 1 ]
},
{ "time": 1.8666, "angle": -43.07 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 1.8666, "x": 2.71, "y": 0.13 }
]
},
"right hand": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.7333, "angle": -18.22 },
{
"time": 1.2666,
"angle": -33.49,
"curve": [ 0.08, 0.08, 0.75, 1 ]
},
{ "time": 1.9666, "angle": -3.98 },
{ "time": 2.5666, "angle": 1.45 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"left hand": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.7333, "angle": -30.39 },
{ "time": 1.9666, "angle": -11.61 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 1.8666, "x": 2.71, "y": -0.04 }
]
},
"hip": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"left upper leg": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"left lower leg": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"left foot": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"right upper leg": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"right lower leg": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
},
"right foot": {
"translate": [
{ "time": 0, "x": 0, "y": 0 }
]
}
},
"slots": {
"left hand item": {
"attachment": [
{ "time": 0, "name": "bow" }
]
},
"left hand": {
"attachment": [
{ "time": 0, "name": null }
]
}
}
}

View File

@ -1,372 +0,0 @@
{
"bones": {
"hip": {
"rotate": [
{ "time": 0, "angle": 0, "curve": "stepped" },
{ "time": 0.9333, "angle": 0, "curve": "stepped" },
{ "time": 1.3666, "angle": 0 }
],
"translate": [
{ "time": 0, "x": -11.57, "y": -3 },
{ "time": 0.2333, "x": -16.2, "y": -19.43 },
{ "time": 0.3333, "x": 7.66, "y": -8.47 },
{ "time": 0.3666, "x": 15.38, "y": 5.01 },
{ "time": 0.4666, "x": -7.84, "y": 57.22 },
{ "time": 0.6, "x": -10.81, "y": 96.34 },
{ "time": 0.7332, "x": -7.01, "y": 54.7 },
{ "time": 0.8, "x": -10.58, "y": 32.2 },
{ "time": 0.9333, "x": -31.99, "y": 0.45 },
{ "time": 1.0666, "x": -12.48, "y": -29.47 },
{ "time": 1.3666, "x": -11.57, "y": -3 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left upper leg": {
"rotate": [
{ "time": 0, "angle": 17.12 },
{ "time": 0.2333, "angle": 44.35 },
{ "time": 0.3333, "angle": 16.45 },
{ "time": 0.4, "angle": -9.88 },
{ "time": 0.4666, "angle": -11.42 },
{ "time": 0.5666, "angle": 23.46 },
{ "time": 0.7666, "angle": 71.82 },
{ "time": 0.9333, "angle": 65.53 },
{ "time": 1.0666, "angle": 51.01 },
{ "time": 1.3666, "angle": 17.12 }
],
"translate": [
{ "time": 0, "x": -3, "y": -2.25, "curve": "stepped" },
{ "time": 0.9333, "x": -3, "y": -2.25, "curve": "stepped" },
{ "time": 1.3666, "x": -3, "y": -2.25 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left lower leg": {
"rotate": [
{ "time": 0, "angle": -16.25 },
{ "time": 0.2333, "angle": -52.21 },
{ "time": 0.4, "angle": 15.04 },
{ "time": 0.4666, "angle": -8.95 },
{ "time": 0.5666, "angle": -39.53 },
{ "time": 0.7666, "angle": -27.27 },
{ "time": 0.9333, "angle": -3.52 },
{ "time": 1.0666, "angle": -61.92 },
{ "time": 1.3666, "angle": -16.25 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left foot": {
"rotate": [
{ "time": 0, "angle": 0.33 },
{ "time": 0.2333, "angle": 6.2 },
{ "time": 0.3333, "angle": 14.73 },
{ "time": 0.4, "angle": -15.54 },
{ "time": 0.4333, "angle": -21.2 },
{ "time": 0.5666, "angle": -7.55 },
{ "time": 0.7666, "angle": -0.67 },
{ "time": 0.9333, "angle": -0.58 },
{ "time": 1.0666, "angle": 14.64 },
{ "time": 1.3666, "angle": 0.33 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right upper leg": {
"rotate": [
{ "time": 0, "angle": 25.97 },
{ "time": 0.2333, "angle": 46.43 },
{ "time": 0.3333, "angle": 22.61 },
{ "time": 0.4, "angle": 2.13 },
{ "time": 0.4666, "angle": 0.04 },
{ "time": 0.6, "angle": 65.55 },
{ "time": 0.7666, "angle": 64.93 },
{ "time": 0.9333, "angle": 41.08 },
{ "time": 1.0666, "angle": 66.25 },
{ "time": 1.3666, "angle": 25.97 }
],
"translate": [
{ "time": 0, "x": 5.74, "y": 0.61 },
{ "time": 0.2333, "x": 4.79, "y": 1.79 },
{ "time": 0.3333, "x": 6.05, "y": -4.55 },
{ "time": 0.9333, "x": 4.79, "y": 1.79, "curve": "stepped" },
{ "time": 1.0666, "x": 4.79, "y": 1.79 },
{ "time": 1.3666, "x": 5.74, "y": 0.61 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right lower leg": {
"rotate": [
{ "time": 0, "angle": -27.46 },
{ "time": 0.2333, "angle": -64.03 },
{ "time": 0.4, "angle": -48.36 },
{ "time": 0.5666, "angle": -76.86 },
{ "time": 0.7666, "angle": -26.89 },
{ "time": 0.9, "angle": -18.96 },
{ "time": 0.9333, "angle": -14.18 },
{ "time": 1.0666, "angle": -80.44 },
{ "time": 1.3666, "angle": -27.46 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right foot": {
"rotate": [
{ "time": 0, "angle": 1.08 },
{ "time": 0.2333, "angle": 16.02 },
{ "time": 0.3, "angle": 12.94 },
{ "time": 0.3333, "angle": 15.16 },
{ "time": 0.4, "angle": -14.7 },
{ "time": 0.4333, "angle": -12.85 },
{ "time": 0.4666, "angle": -19.18 },
{ "time": 0.5666, "angle": -15.82 },
{ "time": 0.6, "angle": -3.59 },
{ "time": 0.7666, "angle": -3.56 },
{ "time": 0.9333, "angle": 1.86 },
{ "time": 1.0666, "angle": 16.02 },
{ "time": 1.3666, "angle": 1.08 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"torso": {
"rotate": [
{ "time": 0, "angle": -13.35 },
{ "time": 0.2333, "angle": -48.95 },
{ "time": 0.4333, "angle": -35.77 },
{ "time": 0.6, "angle": -4.59 },
{ "time": 0.7666, "angle": 14.61 },
{ "time": 0.9333, "angle": 15.74 },
{ "time": 1.0666, "angle": -32.43 },
{ "time": 1.3666, "angle": -13.35 }
],
"translate": [
{ "time": 0, "x": -3.67, "y": 1.68, "curve": "stepped" },
{ "time": 0.9333, "x": -3.67, "y": 1.68, "curve": "stepped" },
{ "time": 1.3666, "x": -3.67, "y": 1.68 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"neck": {
"rotate": [
{ "time": 0, "angle": 12.78 },
{ "time": 0.2333, "angle": 16.45 },
{ "time": 0.4, "angle": 26.49 },
{ "time": 0.6, "angle": 15.51 },
{ "time": 0.7666, "angle": 1.34 },
{ "time": 0.9333, "angle": 2.34 },
{ "time": 1.0666, "angle": 6.08 },
{ "time": 1.3, "angle": 21.23 },
{ "time": 1.3666, "angle": 12.78 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"head": {
"rotate": [
{ "time": 0, "angle": 5.19 },
{ "time": 0.2333, "angle": 20.27 },
{ "time": 0.4, "angle": 15.27 },
{ "time": 0.6, "angle": -24.69 },
{ "time": 0.7666, "angle": -11.02 },
{ "time": 0.9333, "angle": -24.38 },
{ "time": 1.0666, "angle": 11.99 },
{ "time": 1.3, "angle": 4.86 },
{ "time": 1.3666, "angle": 5.19 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left shoulder": {
"rotate": [
{ "time": 0, "angle": 0.05 },
{ "time": 0.2333, "angle": 279.66 },
{ "time": 0.5, "angle": 62.27 },
{ "time": 0.9333, "angle": 28.91 },
{ "time": 1.0666, "angle": -8.62 },
{ "time": 1.1666, "angle": -18.43 },
{ "time": 1.3666, "angle": 0.05 }
],
"translate": [
{ "time": 0, "x": -1.76, "y": 0.56, "curve": "stepped" },
{ "time": 0.9333, "x": -1.76, "y": 0.56, "curve": "stepped" },
{ "time": 1.3666, "x": -1.76, "y": 0.56 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left hand": {
"rotate": [
{ "time": 0, "angle": 11.58, "curve": "stepped" },
{ "time": 0.9333, "angle": 11.58, "curve": "stepped" },
{ "time": 1.3666, "angle": 11.58 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left arm": {
"rotate": [
{ "time": 0, "angle": 0.51 },
{ "time": 0.4333, "angle": 12.82 },
{ "time": 0.6, "angle": 47.55 },
{ "time": 0.9333, "angle": 12.82 },
{ "time": 1.1666, "angle": -6.5 },
{ "time": 1.3666, "angle": 0.51 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right shoulder": {
"rotate": [
{ "time": 0, "angle": 43.82 },
{ "time": 0.2333, "angle": -8.74 },
{ "time": 0.5333, "angle": -208.02 },
{ "time": 0.9333, "angle": -246.72 },
{ "time": 1.0666, "angle": -307.13 },
{ "time": 1.1666, "angle": 37.15 },
{ "time": 1.3666, "angle": 43.82 }
],
"translate": [
{ "time": 0, "x": -7.84, "y": 7.19, "curve": "stepped" },
{ "time": 0.9333, "x": -7.84, "y": 7.19, "curve": "stepped" },
{ "time": 1.3666, "x": -7.84, "y": 7.19 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right arm": {
"rotate": [
{ "time": 0, "angle": -4.02 },
{ "time": 0.6, "angle": 17.5 },
{ "time": 0.9333, "angle": -4.02 },
{ "time": 1.1666, "angle": -16.71 },
{ "time": 1.3666, "angle": -4.02 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right hand": {
"rotate": [
{ "time": 0, "angle": 22.92, "curve": "stepped" },
{ "time": 0.9333, "angle": 22.92, "curve": "stepped" },
{ "time": 1.3666, "angle": 22.92 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"root": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.4333, "angle": -14.52 },
{ "time": 0.8, "angle": 9.85 },
{ "time": 1.3666, "angle": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
}
}
}

View File

@ -1,7 +1,7 @@
{
"bones": [
{ "name": "root" },
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
{ "name": "root", "length": 0 },
{ "name": "hip", "parent": "root", "length": 0, "x": 0.64, "y": 114.41 },
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
{ "name": "left lower leg", "parent": "left upper leg", "length": 56.45, "x": 51.78, "y": 3.46, "rotation": -16.65 },
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 64.02, "y": -8.67, "rotation": 102.43 },
@ -15,15 +15,16 @@
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 49.95, "y": -0.12, "rotation": 40.12 },
{ "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
{ "name": "left shoulder", "parent": "torso", "length": 44.19, "x": 78.96, "y": -15.75, "rotation": -156.96 },
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 44.19, "y": -0.01, "rotation": 44.77 },
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 44.19, "y": -0.01, "rotation": 28.16 },
{ "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
{ "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 }
{ "name": "pelvis", "parent": "hip", "length": 0, "x": 1.41, "y": -6.57 }
],
"slots": [
{ "name": "template", "bone": "root", "color": "ff898c86" },
{ "name": "left shoulder", "bone": "left shoulder", "attachment": "left-shoulder" },
{ "name": "left arm", "bone": "left arm", "attachment": "left-arm" },
{ "name": "left foot", "bone": "left foot", "attachment": "left-foot" },
{ "name": "left hand", "bone": "left hand", "attachment": "left-hand" },
{ "name": "left foot", "bone": "left foot", "attachment": "left-foot" },
{ "name": "left lower leg", "bone": "left lower leg", "attachment": "left-lower-leg" },
{ "name": "left upper leg", "bone": "left upper leg", "attachment": "left-upper-leg" },
{ "name": "pelvis", "bone": "pelvis", "attachment": "pelvis" },
@ -36,8 +37,7 @@
{ "name": "eyes", "bone": "head", "attachment": "eyes" },
{ "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder" },
{ "name": "right arm", "bone": "right arm", "attachment": "right-arm" },
{ "name": "right hand", "bone": "right hand", "attachment": "right-hand" },
{ "name": "left hand item", "bone": "left hand" }
{ "name": "right hand", "bone": "right hand", "attachment": "right-hand" }
],
"skins": {
"default": {
@ -47,12 +47,12 @@
"left arm": {
"left-arm": { "x": 15.11, "y": -0.44, "rotation": 33.84, "width": 35, "height": 29 }
},
"left foot": {
"left-foot": { "x": 24.35, "y": 8.88, "rotation": 3.32, "width": 65, "height": 30 }
},
"left hand": {
"left-hand": { "x": 0.75, "y": 1.86, "rotation": 31.14, "width": 35, "height": 38 }
},
"left foot": {
"left-foot": { "x": 24.35, "y": 8.88, "rotation": 3.32, "width": 65, "height": 30 }
},
"left lower leg": {
"left-lower-leg": { "x": 24.55, "y": -1.92, "rotation": 105.75, "width": 49, "height": 64 }
},
@ -92,9 +92,6 @@
},
"right hand": {
"right-hand": { "x": 6.82, "y": 1.25, "rotation": 91.96, "width": 32, "height": 32 }
},
"left hand item": {
"bow": { "x": -20.35, "y": 9.68, "rotation": 4.85, "width": 65, "height": 261 }
}
}
}

View File

@ -1,171 +1,165 @@
spineboy.png
format: RGBA8888
filter: Linear,Linear
filter: Nearest,Nearest
repeat: none
left-ankle
rotate: false
xy: 67, 644
size: 25, 32
orig: 25, 32
offset: 0, 0
index: -1
left-lower-leg
rotate: false
xy: 74, 208
size: 49, 64
orig: 49, 64
offset: 0, 0
index: -1
left-pant-bottom
rotate: false
xy: 69, 567
size: 44, 22
orig: 44, 22
offset: 0, 0
index: -1
right-shoulder
rotate: false
xy: 71, 274
size: 52, 51
orig: 52, 51
offset: 0, 0
index: -1
right-ankle
rotate: false
xy: 94, 628
size: 25, 30
orig: 25, 30
offset: 0, 0
index: -1
right-pant-bottom
rotate: false
xy: 69, 524
size: 46, 18
orig: 46, 18
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 2
xy: 1, 122
size: 121, 132
orig: 121, 132
offset: 0, 0
index: -1
eyes
rotate: true
xy: 96, 136
size: 27, 34
orig: 34, 27
offset: 0, 0
index: -1
eyes-closed
rotate: true
xy: 96, 172
size: 27, 34
orig: 34, 27
offset: 0, 0
index: -1
torso
rotate: true
xy: 2, 136
size: 92, 68
rotate: false
xy: 1, 28
size: 68, 92
orig: 68, 92
offset: 0, 0
index: -1
left-pant-bottom
rotate: false
xy: 1, 4
size: 44, 22
orig: 44, 22
offset: 0, 0
index: -1
right-pant-bottom
rotate: false
xy: 47, 8
size: 46, 18
orig: 46, 18
offset: 0, 0
index: -1
right-upper-leg
rotate: false
xy: 71, 50
size: 44, 70
orig: 44, 70
offset: 0, 0
index: -1
pelvis
rotate: false
xy: 95, 1
size: 63, 47
orig: 63, 47
offset: 0, 0
index: -1
left-upper-leg
rotate: false
xy: 117, 53
size: 33, 67
orig: 33, 67
offset: 0, 0
index: -1
right-foot
rotate: false
xy: 160, 224
size: 67, 30
orig: 67, 30
offset: 0, 0
index: -1
left-shoulder
rotate: false
xy: 124, 201
size: 34, 53
orig: 34, 53
offset: 0, 0
index: -1
left-ankle
rotate: false
xy: 229, 222
size: 25, 32
orig: 25, 32
offset: 0, 0
index: -1
left-foot
rotate: false
xy: 2, 582
xy: 160, 192
size: 65, 30
orig: 65, 30
offset: 0, 0
index: -1
neck
rotate: false
xy: 33, 614
xy: 124, 171
size: 34, 28
orig: 34, 28
offset: 0, 0
index: -1
right-foot
rotate: false
xy: 2, 287
size: 67, 30
orig: 67, 30
offset: 0, 0
index: -1
left-shoulder
rotate: true
xy: 69, 327
size: 53, 34
orig: 34, 53
offset: 0, 0
index: -1
right-upper-leg
rotate: true
xy: 2, 206
size: 70, 44
orig: 44, 70
offset: 0, 0
index: -1
left-arm
rotate: true
xy: 2, 628
size: 29, 35
orig: 35, 29
offset: 0, 0
index: -1
left-hand
rotate: true
xy: 69, 591
size: 38, 35
orig: 35, 38
offset: 0, 0
index: -1
bow
rotate: false
xy: 2, 319
size: 65, 261
orig: 65, 261
offset: 0, 0
index: -1
right-arm
rotate: true
xy: 69, 544
size: 45, 21
rotate: false
xy: 124, 124
size: 21, 45
orig: 21, 45
offset: 0, 0
index: -1
right-foot-idle
right-ankle
rotate: false
xy: 69, 363
size: 53, 28
orig: 53, 28
xy: 227, 190
size: 25, 30
orig: 25, 30
offset: 0, 0
index: -1
left-hand
rotate: false
xy: 147, 131
size: 35, 38
orig: 35, 38
offset: 0, 0
index: -1
left-arm
rotate: false
xy: 184, 161
size: 35, 29
orig: 35, 29
offset: 0, 0
index: -1
eyes-closed
rotate: false
xy: 221, 161
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-lower-leg
rotate: false
xy: 69, 393
xy: 152, 65
size: 51, 64
orig: 51, 64
offset: 0, 0
index: -1
pelvis
rotate: true
xy: 69, 459
size: 47, 63
orig: 63, 47
right-foot-idle
rotate: false
xy: 184, 131
size: 53, 28
orig: 53, 28
offset: 0, 0
index: -1
left-upper-leg
rotate: true
xy: 2, 252
size: 67, 33
orig: 33, 67
left-lower-leg
rotate: false
xy: 205, 65
size: 49, 64
orig: 49, 64
offset: 0, 0
index: -1
right-shoulder
rotate: false
xy: 160, 12
size: 52, 51
orig: 52, 51
offset: 0, 0
index: -1
eyes
rotate: false
xy: 214, 36
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-hand
rotate: false
xy: 33, 644
xy: 214, 2
size: 32, 32
orig: 32, 32
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,166 @@
spineboy.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
head
rotate: false
xy: 1, 122
size: 121, 132
orig: 121, 132
offset: 0, 0
index: -1
torso
rotate: false
xy: 1, 28
size: 68, 92
orig: 68, 92
offset: 0, 0
index: -1
left-pant-bottom
rotate: false
xy: 1, 4
size: 44, 22
orig: 44, 22
offset: 0, 0
index: -1
right-pant-bottom
rotate: false
xy: 47, 8
size: 46, 18
orig: 46, 18
offset: 0, 0
index: -1
right-upper-leg
rotate: false
xy: 71, 50
size: 44, 70
orig: 44, 70
offset: 0, 0
index: -1
pelvis
rotate: false
xy: 95, 1
size: 63, 47
orig: 63, 47
offset: 0, 0
index: -1
left-upper-leg
rotate: false
xy: 117, 53
size: 33, 67
orig: 33, 67
offset: 0, 0
index: -1
right-foot
rotate: false
xy: 160, 224
size: 67, 30
orig: 67, 30
offset: 0, 0
index: -1
left-shoulder
rotate: false
xy: 124, 201
size: 34, 53
orig: 34, 53
offset: 0, 0
index: -1
left-ankle
rotate: false
xy: 229, 222
size: 25, 32
orig: 25, 32
offset: 0, 0
index: -1
left-foot
rotate: false
xy: 160, 192
size: 65, 30
orig: 65, 30
offset: 0, 0
index: -1
neck
rotate: false
xy: 124, 171
size: 34, 28
orig: 34, 28
offset: 0, 0
index: -1
right-arm
rotate: false
xy: 124, 124
size: 21, 45
orig: 21, 45
offset: 0, 0
index: -1
right-ankle
rotate: false
xy: 227, 190
size: 25, 30
orig: 25, 30
offset: 0, 0
index: -1
left-hand
rotate: false
xy: 147, 131
size: 35, 38
orig: 35, 38
offset: 0, 0
index: -1
left-arm
rotate: false
xy: 184, 161
size: 35, 29
orig: 35, 29
offset: 0, 0
index: -1
eyes-closed
rotate: false
xy: 221, 161
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-lower-leg
rotate: false
xy: 152, 65
size: 51, 64
orig: 51, 64
offset: 0, 0
index: -1
right-foot-idle
rotate: false
xy: 184, 131
size: 53, 28
orig: 53, 28
offset: 0, 0
index: -1
left-lower-leg
rotate: false
xy: 205, 65
size: 49, 64
orig: 49, 64
offset: 0, 0
index: -1
right-shoulder
rotate: false
xy: 160, 12
size: 52, 51
orig: 52, 51
offset: 0, 0
index: -1
eyes
rotate: false
xy: 214, 36
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-hand
rotate: false
xy: 214, 2
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -1,172 +0,0 @@
spineboy.png
format: RGBA8888
filter: Linear,Linear
repeat: none
left-ankle
rotate: true
xy: 168, 92
size: 16, 13
orig: 13, 16
offset: 0, 0
index: -1
left-lower-leg
rotate: false
xy: 101, 37
size: 25, 32
orig: 25, 32
offset: 0, 0
index: -1
left-pant-bottom
rotate: false
xy: 152, 61
size: 22, 11
orig: 22, 11
offset: 0, 0
index: -1
right-shoulder
rotate: false
xy: 127, 74
size: 26, 26
orig: 26, 26
offset: 0, 0
index: -1
right-ankle
rotate: false
xy: 148, 107
size: 13, 15
orig: 13, 15
offset: 0, 0
index: -1
right-pant-bottom
rotate: true
xy: 152, 36
size: 9, 23
orig: 23, 9
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 37
size: 61, 66
orig: 61, 66
offset: 0, 0
index: -1
eyes
rotate: true
xy: 112, 105
size: 14, 17
orig: 17, 14
offset: 0, 0
index: -1
eyes-closed
rotate: false
xy: 163, 107
size: 17, 14
orig: 17, 14
offset: 0, 0
index: -1
torso
rotate: false
xy: 65, 37
size: 34, 46
orig: 34, 46
offset: 0, 0
index: -1
left-foot
rotate: true
xy: 163, 2
size: 15, 33
orig: 33, 15
offset: 0, 0
index: -1
neck
rotate: true
xy: 96, 105
size: 14, 17
orig: 17, 14
offset: 0, 0
index: -1
right-foot
rotate: false
xy: 65, 85
size: 34, 15
orig: 34, 15
offset: 0, 0
index: -1
left-shoulder
rotate: true
xy: 38, 105
size: 27, 17
orig: 17, 27
offset: 0, 0
index: -1
right-upper-leg
rotate: false
xy: 128, 37
size: 22, 35
orig: 22, 35
offset: 0, 0
index: -1
left-arm
rotate: true
xy: 163, 37
size: 15, 18
orig: 18, 15
offset: 0, 0
index: -1
left-hand
rotate: false
xy: 128, 102
size: 18, 19
orig: 18, 19
offset: 0, 0
index: -1
bow
rotate: true
xy: 2, 2
size: 131, 33
orig: 33, 131
offset: 0, 0
index: -1
right-arm
rotate: false
xy: 155, 74
size: 11, 23
orig: 11, 23
offset: 0, 0
index: -1
right-foot-idle
rotate: false
xy: 67, 102
size: 27, 14
orig: 27, 14
offset: 0, 0
index: -1
right-lower-leg
rotate: false
xy: 135, 2
size: 26, 32
orig: 26, 32
offset: 0, 0
index: -1
pelvis
rotate: true
xy: 101, 71
size: 24, 32
orig: 32, 24
offset: 0, 0
index: -1
left-upper-leg
rotate: true
xy: 2, 105
size: 34, 17
orig: 17, 34
offset: 0, 0
index: -1
right-hand
rotate: false
xy: 168, 74
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1

View File

@ -66,7 +66,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\cocos2dx;$(ProjectDir)..\..\cocos2dx\include;$(ProjectDir)..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\Classes;$(ProjectDir)..\..\include;$(ProjectDir)..\..\..\spine-cpp\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\cocos2dx;$(ProjectDir)..\..\cocos2dx\include;$(ProjectDir)..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\Classes;$(ProjectDir)..\..\src;$(ProjectDir)..\..\..\spine-c\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@ -76,6 +76,7 @@
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glew32.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
@ -123,65 +124,51 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\..\spine-cpp\include\json\autolink.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\config.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\features.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\forwards.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\json.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\reader.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\value.h" />
<ClInclude Include="..\..\..\spine-cpp\include\json\writer.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\Animation.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\AnimationState.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\AnimationStateData.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\Attachment.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseAtlas.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseAttachmentLoader.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseRegionAttachment.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseSkeleton.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseSkeletonJson.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\Bone.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\BoneData.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\SkeletonData.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\Skin.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\Slot.h" />
<ClInclude Include="..\..\..\spine-cpp\include\spine\SlotData.h" />
<ClInclude Include="..\..\..\spine-cpp\src\json\json_batchallocator.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\Atlas.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\AtlasAttachmentLoader.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\CCSkeleton.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\RegionAttachment.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\Skeleton.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\SkeletonJson.h" />
<ClInclude Include="..\..\include\spine-cocos2dx\spine.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Animation.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\AnimationState.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\AnimationStateData.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Atlas.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\AtlasAttachmentLoader.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Attachment.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\AttachmentLoader.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Bone.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\BoneData.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\extension.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\RegionAttachment.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Skeleton.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\SkeletonData.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\SkeletonJson.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Skin.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\Slot.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\SlotData.h" />
<ClInclude Include="..\..\..\spine-c\include\spine\spine.h" />
<ClInclude Include="..\..\..\spine-c\src\spine\Json.h" />
<ClInclude Include="..\..\src\spine\spine-cocos2dx.h" />
<ClInclude Include="..\Classes\AppDelegate.h" />
<ClInclude Include="..\Classes\AppMacros.h" />
<ClInclude Include="..\Classes\ExampleLayer.h" />
<ClInclude Include="main.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\spine-cpp\src\json\json_reader.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\json\json_value.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\json\json_writer.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\Animation.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\AnimationState.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\AnimationStateData.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseAtlas.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseRegionAttachment.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseSkeleton.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseSkeletonJson.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\Bone.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\BoneData.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\SkeletonData.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\Skin.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\Slot.cpp" />
<ClCompile Include="..\..\..\spine-cpp\src\spine\SlotData.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\Atlas.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\AtlasAttachmentLoader.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\CCSkeleton.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\RegionAttachment.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\Skeleton.cpp" />
<ClCompile Include="..\..\src\spine-cocos2dx\SkeletonJson.cpp" />
<ClCompile Include="..\..\..\spine-c\src\spine\Animation.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\AnimationState.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\AnimationStateData.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Atlas.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\AtlasAttachmentLoader.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Attachment.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\AttachmentLoader.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Bone.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\BoneData.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\extension.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Json.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\RegionAttachment.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Skeleton.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\SkeletonData.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\SkeletonJson.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Skin.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\Slot.c" />
<ClCompile Include="..\..\..\spine-c\src\spine\SlotData.c" />
<ClCompile Include="..\..\src\spine\spine-cocos2dx.cpp" />
<ClCompile Include="..\Classes\AppDelegate.cpp" />
<ClCompile Include="..\Classes\ExampleLayer.cpp" />
<ClCompile Include="main.cpp" />
@ -191,11 +178,6 @@
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\spine-cpp\src\json\json_internalarray.inl" />
<None Include="..\..\..\spine-cpp\src\json\json_internalmap.inl" />
<None Include="..\..\..\spine-cpp\src\json\json_valueiterator.inl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -7,18 +7,12 @@
<Filter Include="Classes">
<UniqueIdentifier>{0dcd52ca-d521-4ba1-a1fa-c0d58a2df402}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\spine-cpp">
<UniqueIdentifier>{bce9df76-2682-4d32-a178-779e330d0ff1}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\spine-cpp\json">
<UniqueIdentifier>{b04a4c76-3e5e-4539-8872-da087cfb695b}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\spine-cpp\spine">
<UniqueIdentifier>{35486b88-a772-4ecb-9c30-e6c2a21a4734}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\spine-cocos2dx">
<UniqueIdentifier>{7c460e6e-d4fb-452e-b75f-7a110b9dd9f6}</UniqueIdentifier>
</Filter>
<Filter Include="Classes\spine-c">
<UniqueIdentifier>{bce9df76-2682-4d32-a178-779e330d0ff1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h">
@ -30,102 +24,69 @@
<ClInclude Include="..\Classes\AppMacros.h">
<Filter>Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\reader.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\value.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\writer.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\autolink.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\config.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\features.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\forwards.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\json\json.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseSkeleton.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseSkeletonJson.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\Bone.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BoneData.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\SkeletonData.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\Skin.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\Slot.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\SlotData.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\Animation.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\AnimationState.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\AnimationStateData.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\Attachment.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseAtlas.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseAttachmentLoader.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\include\spine\BaseRegionAttachment.h">
<Filter>Classes\spine-cpp\spine</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-cpp\src\json\json_batchallocator.h">
<Filter>Classes\spine-cpp\json</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\Skeleton.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\SkeletonJson.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\spine.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\Atlas.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\AtlasAttachmentLoader.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\CCSkeleton.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\include\spine-cocos2dx\RegionAttachment.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\Classes\ExampleLayer.h">
<Filter>Classes</Filter>
</ClInclude>
<ClInclude Include="..\..\src\spine\spine-cocos2dx.h">
<Filter>Classes\spine-cocos2dx</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Animation.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Atlas.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\AtlasAttachmentLoader.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Attachment.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\AttachmentLoader.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Bone.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\BoneData.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\extension.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\RegionAttachment.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Skeleton.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\SkeletonData.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\SkeletonJson.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Skin.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\Slot.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\SlotData.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\spine.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\src\spine\Json.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\AnimationState.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
<ClInclude Include="..\..\..\spine-c\include\spine\AnimationStateData.h">
<Filter>Classes\spine-c</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
@ -134,85 +95,65 @@
<ClCompile Include="..\Classes\AppDelegate.cpp">
<Filter>Classes</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\Bone.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\BoneData.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\SkeletonData.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\Skin.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\Slot.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\SlotData.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\Animation.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\AnimationState.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\AnimationStateData.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseAtlas.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseRegionAttachment.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseSkeleton.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\spine\BaseSkeletonJson.cpp">
<Filter>Classes\spine-cpp\spine</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\json\json_reader.cpp">
<Filter>Classes\spine-cpp\json</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\json\json_value.cpp">
<Filter>Classes\spine-cpp\json</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-cpp\src\json\json_writer.cpp">
<Filter>Classes\spine-cpp\json</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\RegionAttachment.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\Skeleton.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\SkeletonJson.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\Atlas.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\AtlasAttachmentLoader.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\src\spine-cocos2dx\CCSkeleton.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\Classes\ExampleLayer.cpp">
<Filter>Classes</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\spine-cpp\src\json\json_valueiterator.inl">
<Filter>Classes\spine-cpp\json</Filter>
</None>
<None Include="..\..\..\spine-cpp\src\json\json_internalarray.inl">
<Filter>Classes\spine-cpp\json</Filter>
</None>
<None Include="..\..\..\spine-cpp\src\json\json_internalmap.inl">
<Filter>Classes\spine-cpp\json</Filter>
</None>
<ClCompile Include="..\..\src\spine\spine-cocos2dx.cpp">
<Filter>Classes\spine-cocos2dx</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Animation.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Atlas.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\AtlasAttachmentLoader.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Attachment.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\AttachmentLoader.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Bone.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\BoneData.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\extension.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Json.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\RegionAttachment.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Skeleton.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\SkeletonData.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\SkeletonJson.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Skin.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\Slot.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\SlotData.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\AnimationStateData.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
<ClCompile Include="..\..\..\spine-c\src\spine\AnimationState.c">
<Filter>Classes\spine-c</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,65 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_ATLAS_H_
#define SPINE_ATLAS_H_
#include "cocos2d.h"
#include <spine/BaseAtlas.h>
namespace spine {
class AtlasPage: public BaseAtlasPage {
public:
~AtlasPage ();
cocos2d::CCTexture2D *texture;
cocos2d::CCTextureAtlas *atlas;
};
//
class AtlasRegion: public BaseAtlasRegion {
public:
AtlasPage *page;
};
//
class Atlas: public BaseAtlas {
public:
Atlas (const std::string &path);
Atlas (std::istream &input);
Atlas (const char *begin, const char *end);
AtlasRegion* findRegion (const std::string &name);
private:
virtual BaseAtlasPage* newAtlasPage (const std::string &name);
virtual BaseAtlasRegion* newAtlasRegion (BaseAtlasPage* page);
};
} /* namespace spine */
#endif /* SPINE_ATLAS_H_ */

View File

@ -1,45 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_ATLASATTACHMENTLOADER_H_
#define SPINE_ATLASATTACHMENTLOADER_H_
#include <spine/BaseAttachmentLoader.h>
namespace spine {
class Atlas;
class AtlasAttachmentLoader: public BaseAttachmentLoader {
public:
Atlas *atlas;
AtlasAttachmentLoader (Atlas *atlas);
virtual Attachment* newAttachment (AttachmentType type, const std::string &name);
};
} /* namespace spine */
#endif /* SPINE_ATLASATTACHMENTLOADER_H_ */

View File

@ -1,49 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_REGIONATTACHMENT_H_
#define SPINE_REGIONATTACHMENT_H_
#include "cocos2d.h"
#include <spine/BaseRegionAttachment.h>
namespace spine {
class Bone;
class AtlasRegion;
class RegionAttachment: public BaseRegionAttachment {
public:
cocos2d::ccV3F_C4B_T2F_Quad quad;
cocos2d::CCTextureAtlas *atlas;
RegionAttachment (AtlasRegion *region);
virtual void updateWorldVertices (Bone *bone);
virtual void draw (Slot *slot);
};
} /* namespace spine */
#endif /* SPINE_REGIONATTACHMENT_H_ */

View File

@ -1,48 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_SKELETON_H_
#define SPINE_SKELETON_H_
#include "cocos2d.h"
#include <spine/BaseSkeleton.h>
namespace spine {
class Skeleton: public BaseSkeleton {
private:
unsigned int quadCount;
public:
cocos2d::CCTextureAtlas *atlas; // All region attachments must use the same texture.
Skeleton (SkeletonData *skeletonData);
void addQuad (cocos2d::CCTextureAtlas *atlas, cocos2d::ccV3F_C4B_T2F_Quad &quad);
virtual void draw ();
};
} /* namespace spine */
#endif /* SPINE_SKELETON_H_ */

View File

@ -1,46 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_SKELETONJSON_H_
#define SPINE_SKELETONJSON_H_
#include <spine/BaseSkeletonJson.h>
namespace spine {
class Atlas;
class SkeletonJson: public BaseSkeletonJson {
public:
SkeletonJson (Atlas *atlas);
/** The SkeletonJson owns the attachmentLoader. */
SkeletonJson (BaseAttachmentLoader *attachmentLoader);
SkeletonData* readSkeletonData (const std::string &path) const;
Animation* readAnimation (const std::string &path, const SkeletonData *skeletonData) const;
};
} /* namespace spine */
#endif /* SPINE_SKELETONJSON_H_ */

View File

@ -1,47 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_SPINE_H_
#define SPINE_SPINE_H_
#include <spine/SkeletonData.h>
#include <spine/BoneData.h>
#include <spine/SlotData.h>
#include <spine/Skin.h>
#include <spine/Attachment.h>
#include <spine/Animation.h>
#include <spine/AnimationStateData.h>
#include <spine/AnimationState.h>
#include <spine/Slot.h>
#include <spine/Bone.h>
#include <spine-cocos2dx/RegionAttachment.h>
#include <spine-cocos2dx/Atlas.h>
#include <spine-cocos2dx/AtlasAttachmentLoader.h>
#include <spine-cocos2dx/SkeletonJson.h>
#include <spine-cocos2dx/Skeleton.h>
#include <spine-cocos2dx/CCSkeleton.h>
#endif /* SF_SPINE_H_ */

View File

@ -1,75 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <spine-cocos2dx/Atlas.h>
#include <stdexcept>
USING_NS_CC;
namespace spine {
AtlasPage::~AtlasPage () {
CC_SAFE_RELEASE_NULL(texture);
CC_SAFE_RELEASE_NULL(atlas);
}
//
Atlas::Atlas (const std::string &path) {
unsigned long size;
char *data = reinterpret_cast<char*>(CCFileUtils::sharedFileUtils()->getFileData(
CCFileUtils::sharedFileUtils()->fullPathForFilename(path.c_str()).c_str(), "r", &size));
if (!data) throw std::runtime_error("Error reading atlas file: " + path);
load(data, data + size);
}
Atlas::Atlas (std::istream &input) {
load(input);
}
Atlas::Atlas (const char *begin, const char *end) {
load(begin, end);
}
BaseAtlasPage* Atlas::newAtlasPage (const std::string &name) {
AtlasPage *page = new AtlasPage();
page->texture = CCTextureCache::sharedTextureCache()->addImage(name.c_str());
page->texture->retain();
page->atlas = CCTextureAtlas::createWithTexture(page->texture, 4);
page->atlas->retain();
return page;
}
BaseAtlasRegion* Atlas::newAtlasRegion (BaseAtlasPage* page) {
AtlasRegion *region = new AtlasRegion();
region->page = reinterpret_cast<AtlasPage*>(page);
return region;
}
AtlasRegion* Atlas::findRegion (const std::string &name) {
return reinterpret_cast<AtlasRegion*>(BaseAtlas::findRegion(name));
}
} /* namespace spine */

View File

@ -1,49 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <stdexcept>
#include <spine-cocos2dx/AtlasAttachmentLoader.h>
#include <spine-cocos2dx/Atlas.h>
#include <spine-cocos2dx/RegionAttachment.h>
namespace spine {
AtlasAttachmentLoader::AtlasAttachmentLoader (Atlas *atlas) :
atlas(atlas) {
}
Attachment* AtlasAttachmentLoader::newAttachment (AttachmentType type, const std::string &name) {
switch (type) {
case region: {
AtlasRegion *region = atlas->findRegion(name);
if (!region) throw std::runtime_error("Atlas region not found: " + name);
return new RegionAttachment(region);
}
default:
throw std::runtime_error("Unknown attachment type: " + type);
}
}
} /* namespace spine */

View File

@ -1,124 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <spine-cocos2dx/CCSkeleton.h>
#include <stdexcept>
#include <spine-cocos2dx/Skeleton.h>
#include <spine-cocos2dx/RegionAttachment.h>
#include <spine/SkeletonData.h>
#include <spine/AnimationState.h>
#include <spine/AnimationStateData.h>
#include <spine/Slot.h>
#include <spine/BoneData.h>
#include <spine/Bone.h>
using namespace spine;
USING_NS_CC;
CCSkeleton* CCSkeleton::create (SkeletonData* skeletonData) {
CCSkeleton* skeleton = new CCSkeleton(skeletonData);
skeleton->autorelease();
return skeleton;
}
CCSkeleton::CCSkeleton (SkeletonData *skeletonData, AnimationStateData *stateData) :
debug(false) {
if (!skeletonData) throw std::invalid_argument("skeletonData cannot be null.");
skeleton = new Skeleton(skeletonData);
state = new AnimationState(stateData);
blendFunc.src = GL_SRC_ALPHA;
blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
scheduleUpdate();
}
CCSkeleton::~CCSkeleton () {
delete skeleton;
delete state;
}
void CCSkeleton::update (float deltaTime) {
skeleton->update(deltaTime);
state->update(deltaTime);
state->apply(skeleton);
skeleton->updateWorldTransform();
}
void CCSkeleton::draw () {
CC_NODE_DRAW_SETUP();
ccGLBlendFunc(blendFunc.src, blendFunc.dst);
ccColor3B color = getColor();
skeleton->r = color.r / (float)255;
skeleton->g = color.g / (float)255;
skeleton->b = color.b / (float)255;
skeleton->a = getOpacity() / (float)255;
skeleton->draw();
if (debug) {
// Slots.
ccDrawColor4B(0, 0, 255, 10);
glLineWidth(1);
CCPoint points[4];
for (int i = 0, n = skeleton->slots.size(); i < n; i++) {
if (!skeleton->slots[i]->attachment) continue;
ccV3F_C4B_T2F_Quad quad = ((RegionAttachment*)skeleton->slots[i]->attachment)->quad;
points[0] = ccp(quad.bl.vertices.x, quad.bl.vertices.y);
points[1] = ccp(quad.br.vertices.x, quad.br.vertices.y);
points[2] = ccp(quad.tr.vertices.x, quad.tr.vertices.y);
points[3] = ccp(quad.tl.vertices.x, quad.tl.vertices.y);
ccDrawPoly(points, 4, true);
}
// Bone lengths.
glLineWidth(2);
ccDrawColor4B(255, 0, 0, 255);
for (int i = 0, n = skeleton->bones.size(); i < n; i++) {
Bone *bone = skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY;
ccDrawLine(ccp(bone->worldX, bone->worldY), ccp(x, y));
}
// Bone origins.
ccPointSize(4);
ccDrawColor4B(0, 0, 255, 255); // Root bone is blue.
for (int i = 0, n = skeleton->bones.size(); i < n; i++) {
Bone *bone = skeleton->bones[i];
ccDrawPoint(ccp(bone->worldX, bone->worldY));
if (i == 0) ccDrawColor4B(0, 255, 0, 255);
}
}
}
// CCBlendProtocol
ccBlendFunc CCSkeleton::getBlendFunc () {
return blendFunc;
}
void CCSkeleton::setBlendFunc (ccBlendFunc blendFunc) {
this->blendFunc = blendFunc;
}

View File

@ -1,111 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <iostream>
#include <spine-cocos2dx/RegionAttachment.h>
#include <spine-cocos2dx/Atlas.h>
#include <spine-cocos2dx/Skeleton.h>
#include <spine/Bone.h>
#include <spine/Slot.h>
USING_NS_CC;
namespace spine {
RegionAttachment::RegionAttachment (AtlasRegion *region) {
atlas = region->page->atlas;
const CCSize &size = region->page->texture->getContentSizeInPixels();
float u = region->x / size.width;
float u2 = (region->x + region->width) / size.width;
float v = region->y / size.height;
float v2 = (region->y + region->height) / size.height;
if (region->rotate) {
quad.tl.texCoords.u = u;
quad.tl.texCoords.v = v2;
quad.tr.texCoords.u = u;
quad.tr.texCoords.v = v;
quad.br.texCoords.u = u2;
quad.br.texCoords.v = v;
quad.bl.texCoords.u = u2;
quad.bl.texCoords.v = v2;
} else {
quad.bl.texCoords.u = u;
quad.bl.texCoords.v = v2;
quad.tl.texCoords.u = u;
quad.tl.texCoords.v = v;
quad.tr.texCoords.u = u2;
quad.tr.texCoords.v = v;
quad.br.texCoords.u = u2;
quad.br.texCoords.v = v2;
}
quad.bl.vertices.z = 0;
quad.tl.vertices.z = 0;
quad.tr.vertices.z = 0;
quad.br.vertices.z = 0;
}
void RegionAttachment::draw (Slot *slot) {
Skeleton* skeleton = (Skeleton*)slot->skeleton;
GLubyte r = skeleton->r * slot->r * 255;
GLubyte g = skeleton->g * slot->g * 255;
GLubyte b = skeleton->b * slot->b * 255;
GLubyte a = skeleton->a * slot->a * 255;
quad.bl.colors.r = r;
quad.bl.colors.g = g;
quad.bl.colors.b = b;
quad.bl.colors.a = a;
quad.tl.colors.r = r;
quad.tl.colors.g = g;
quad.tl.colors.b = b;
quad.tl.colors.a = a;
quad.tr.colors.r = r;
quad.tr.colors.g = g;
quad.tr.colors.b = b;
quad.tr.colors.a = a;
quad.br.colors.r = r;
quad.br.colors.g = g;
quad.br.colors.b = b;
quad.br.colors.a = a;
updateWorldVertices(slot->bone);
// cocos2dx doesn't handle batching for us, so we'll just force a single texture per skeleton.
skeleton->addQuad(atlas, quad);
}
void RegionAttachment::updateWorldVertices (spine::Bone *bone) {
quad.bl.vertices.x = offset[0] * bone->m00 + offset[1] * bone->m01 + bone->worldX;
quad.bl.vertices.y = offset[0] * bone->m10 + offset[1] * bone->m11 + bone->worldY;
quad.tl.vertices.x = offset[2] * bone->m00 + offset[3] * bone->m01 + bone->worldX;
quad.tl.vertices.y = offset[2] * bone->m10 + offset[3] * bone->m11 + bone->worldY;
quad.tr.vertices.x = offset[4] * bone->m00 + offset[5] * bone->m01 + bone->worldX;
quad.tr.vertices.y = offset[4] * bone->m10 + offset[5] * bone->m11 + bone->worldY;
quad.br.vertices.x = offset[6] * bone->m00 + offset[7] * bone->m01 + bone->worldX;
quad.br.vertices.y = offset[6] * bone->m10 + offset[7] * bone->m11 + bone->worldY;
}
} /* namespace spine */

View File

@ -1,57 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <iostream>
#include <spine-cocos2dx/Skeleton.h>
#include <spine/SkeletonData.h>
#include <spine/Slot.h>
#include <spine/Attachment.h>
USING_NS_CC;
namespace spine {
Skeleton::Skeleton (SkeletonData *skeletonData) :
BaseSkeleton(skeletonData),
quadCount(0),
atlas(0) {
}
void Skeleton::addQuad (cocos2d::CCTextureAtlas *atlas, cocos2d::ccV3F_C4B_T2F_Quad &quad) {
this->atlas = atlas;
if (atlas->getCapacity() <= quadCount) {
if (!atlas->resizeCapacity(atlas->getCapacity() * 2)) return;
}
atlas->updateQuad(&quad, quadCount++);
}
void Skeleton::draw () {
quadCount = 0;
for (int i = 0, n = slots.size(); i < n; i++)
if (slots[i]->attachment) slots[i]->attachment->draw(slots[i]);
if (atlas) atlas->drawNumberOfQuads(quadCount);
}
} /* namespace spine */

View File

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <spine-cocos2dx/SkeletonJson.h>
#include <stdexcept>
#include <spine-cocos2dx/AtlasAttachmentLoader.h>
#include "platform/CCFileUtils.h"
using cocos2d::CCFileUtils;
using std::runtime_error;
namespace spine {
SkeletonJson::SkeletonJson (BaseAttachmentLoader *attachmentLoader) :
BaseSkeletonJson(attachmentLoader) {
}
SkeletonJson::SkeletonJson (Atlas *atlas) :
BaseSkeletonJson(new AtlasAttachmentLoader(atlas)) {
}
SkeletonData* SkeletonJson::readSkeletonData (const std::string &path) const {
unsigned long size;
char *data = reinterpret_cast<char*>(CCFileUtils::sharedFileUtils()->getFileData(
CCFileUtils::sharedFileUtils()->fullPathForFilename(path.c_str()).c_str(), "r", &size));
if (!data) throw runtime_error("Error reading skeleton file: " + path);
return BaseSkeletonJson::readSkeletonData(data, data + size);
}
Animation* SkeletonJson::readAnimation (const std::string &path, const SkeletonData *skeletonData) const {
unsigned long size;
char *data = reinterpret_cast<char*>(CCFileUtils::sharedFileUtils()->getFileData(
CCFileUtils::sharedFileUtils()->fullPathForFilename(path.c_str()).c_str(), "r", &size));
if (!data) throw runtime_error("Error reading animation file: " + path);
return BaseSkeletonJson::readAnimation(data, data + size, skeletonData);
}
} /* namespace spine */

View File

@ -0,0 +1,272 @@
/*******************************************************************************
* Copyright (c) 2013, Esoteric Software
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include <spine/spine-cocos2dx.h>
#include <spine/spine.h>
#include <spine/extension.h>
#include "cocos2d.h"
USING_NS_CC;
namespace spine {
void _Cocos2dxAtlasPage_dispose (AtlasPage* page) {
Cocos2dxAtlasPage* self = SUB_CAST(Cocos2dxAtlasPage, page);
_AtlasPage_deinit(SUPER(self));
CC_SAFE_RELEASE_NULL(self->texture);
CC_SAFE_RELEASE_NULL(self->atlas);
FREE(page);
}
AtlasPage* AtlasPage_create (const char* name) {
Cocos2dxAtlasPage* self = NEW(Cocos2dxAtlasPage);
_AtlasPage_init(SUPER(self), name);
VTABLE(AtlasPage, self) ->dispose = _Cocos2dxAtlasPage_dispose;
self->texture = CCTextureCache::sharedTextureCache()->addImage(name);
self->texture->retain();
self->atlas = CCTextureAtlas::createWithTexture(self->texture, 4);
self->atlas->retain();
return SUPER(self);
}
/**/
void _Cocos2dxSkeleton_dispose (Skeleton* self) {
_Skeleton_deinit(self);
FREE(self);
}
class CCSkeleton;
Skeleton* _Cocos2dxSkeleton_create (SkeletonData* data, CCSkeleton* node) {
Cocos2dxSkeleton* self = NEW(Cocos2dxSkeleton);
_Skeleton_init(SUPER(self), data);
VTABLE(Skeleton, self) ->dispose = _Cocos2dxSkeleton_dispose;
self->node = node;
return SUPER(self);
}
CCSkeleton* CCSkeleton::create (SkeletonData* skeletonData) {
CCSkeleton* node = new CCSkeleton(skeletonData);
node->autorelease();
return node;
}
CCSkeleton::CCSkeleton (SkeletonData *skeletonData, AnimationStateData *stateData) :
debugSlots(false), debugBones(false) {
skeleton = _Cocos2dxSkeleton_create(skeletonData, this);
state = AnimationState_create(stateData);
blendFunc.src = GL_ONE;
blendFunc.dst = GL_ONE_MINUS_SRC_ALPHA;
setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));
scheduleUpdate();
}
CCSkeleton::~CCSkeleton () {
Skeleton_dispose(skeleton);
AnimationState_dispose(state);
}
void CCSkeleton::update (float deltaTime) {
Skeleton_update(skeleton, deltaTime);
AnimationState_update(state, deltaTime);
AnimationState_apply(state, skeleton);
Skeleton_updateWorldTransform(skeleton);
}
#include <stdio.h>
void CCSkeleton::draw () {
CC_NODE_DRAW_SETUP();
ccGLBlendFunc(blendFunc.src, blendFunc.dst);
ccColor3B color = getColor();
skeleton->r = color.r / (float)255;
skeleton->g = color.g / (float)255;
skeleton->b = color.b / (float)255;
skeleton->a = getOpacity() / (float)255;
quadCount = 0;
for (int i = 0, n = skeleton->slotCount; i < n; i++)
if (skeleton->slots[i]->attachment) Attachment_draw(skeleton->slots[i]->attachment, skeleton->slots[i]);
if (atlas) atlas->drawNumberOfQuads(quadCount);
if (debugSlots) {
// Slots.
ccDrawColor4B(0, 0, 255, 255);
glLineWidth(1);
CCPoint points[4];
for (int i = 0, n = skeleton->slotCount; i < n; i++) {
if (!skeleton->slots[i]->attachment) continue;
ccV3F_C4B_T2F_Quad* quad = &((Cocos2dxRegionAttachment*)skeleton->slots[i]->attachment)->quad;
points[0] = ccp(quad->bl.vertices.x, quad->bl.vertices.y);
points[1] = ccp(quad->br.vertices.x, quad->br.vertices.y);
points[2] = ccp(quad->tr.vertices.x, quad->tr.vertices.y);
points[3] = ccp(quad->tl.vertices.x, quad->tl.vertices.y);
ccDrawPoly(points, 4, true);
}
}
if (debugBones) {
// Bone lengths.
glLineWidth(2);
ccDrawColor4B(255, 0, 0, 255);
for (int i = 0, n = skeleton->boneCount; i < n; i++) {
Bone *bone = skeleton->bones[i];
float x = bone->data->length * bone->m00 + bone->worldX;
float y = bone->data->length * bone->m10 + bone->worldY;
ccDrawLine(ccp(bone->worldX, bone->worldY), ccp(x, y));
}
// Bone origins.
ccPointSize(4);
ccDrawColor4B(0, 0, 255, 255); // Root bone is blue.
for (int i = 0, n = skeleton->boneCount; i < n; i++) {
Bone *bone = skeleton->bones[i];
ccDrawPoint(ccp(bone->worldX, bone->worldY));
if (i == 0) ccDrawColor4B(0, 255, 0, 255);
}
}
}
// CCBlendProtocol
ccBlendFunc CCSkeleton::getBlendFunc () {
return blendFunc;
}
void CCSkeleton::setBlendFunc (ccBlendFunc blendFunc) {
this->blendFunc = blendFunc;
}
/**/
void _Cocos2dxRegionAttachment_dispose (Attachment* self) {
_RegionAttachment_deinit(SUB_CAST(RegionAttachment, self) );
FREE(self);
}
void _Cocos2dxRegionAttachment_draw (Attachment* attachment, Slot* slot) {
Cocos2dxRegionAttachment* self = SUB_CAST(Cocos2dxRegionAttachment, attachment);
Cocos2dxSkeleton* skeleton = SUB_CAST(Cocos2dxSkeleton, slot->skeleton);
GLubyte r = SUPER(skeleton)->r * slot->r * 255;
GLubyte g = SUPER(skeleton)->g * slot->g * 255;
GLubyte b = SUPER(skeleton)->b * slot->b * 255;
GLubyte a = SUPER(skeleton)->a * slot->a * 255;
ccV3F_C4B_T2F_Quad* quad = &self->quad;
quad->bl.colors.r = r;
quad->bl.colors.g = g;
quad->bl.colors.b = b;
quad->bl.colors.a = a;
quad->tl.colors.r = r;
quad->tl.colors.g = g;
quad->tl.colors.b = b;
quad->tl.colors.a = a;
quad->tr.colors.r = r;
quad->tr.colors.g = g;
quad->tr.colors.b = b;
quad->tr.colors.a = a;
quad->br.colors.r = r;
quad->br.colors.g = g;
quad->br.colors.b = b;
quad->br.colors.a = a;
float* offset = SUPER(self)->offset;
quad->bl.vertices.x = offset[0] * slot->bone->m00 + offset[1] * slot->bone->m01 + slot->bone->worldX;
quad->bl.vertices.y = offset[0] * slot->bone->m10 + offset[1] * slot->bone->m11 + slot->bone->worldY;
quad->tl.vertices.x = offset[2] * slot->bone->m00 + offset[3] * slot->bone->m01 + slot->bone->worldX;
quad->tl.vertices.y = offset[2] * slot->bone->m10 + offset[3] * slot->bone->m11 + slot->bone->worldY;
quad->tr.vertices.x = offset[4] * slot->bone->m00 + offset[5] * slot->bone->m01 + slot->bone->worldX;
quad->tr.vertices.y = offset[4] * slot->bone->m10 + offset[5] * slot->bone->m11 + slot->bone->worldY;
quad->br.vertices.x = offset[6] * slot->bone->m00 + offset[7] * slot->bone->m01 + slot->bone->worldX;
quad->br.vertices.y = offset[6] * slot->bone->m10 + offset[7] * slot->bone->m11 + slot->bone->worldY;
// cocos2dx doesn't handle batching for us, so we'll just force a single texture per skeleton.
skeleton->node->atlas = self->atlas;
if (self->atlas->getCapacity() <= skeleton->node->quadCount) {
if (!self->atlas->resizeCapacity(self->atlas->getCapacity() * 2)) return;
}
self->atlas->updateQuad(quad, skeleton->node->quadCount++);
}
RegionAttachment* RegionAttachment_create (const char* name, AtlasRegion* region) {
Cocos2dxRegionAttachment* self = NEW(Cocos2dxRegionAttachment);
_RegionAttachment_init(SUPER(self), name);
VTABLE(Attachment, self) ->dispose = _Cocos2dxRegionAttachment_dispose;
VTABLE(Attachment, self) ->draw = _Cocos2dxRegionAttachment_draw;
Cocos2dxAtlasPage* page = SUB_CAST(Cocos2dxAtlasPage, region->page);
self->atlas = page->atlas;
const CCSize& size = page->texture->getContentSizeInPixels();
float u = region->x / size.width;
float u2 = (region->x + region->width) / size.width;
float v = region->y / size.height;
float v2 = (region->y + region->height) / size.height;
ccV3F_C4B_T2F_Quad* quad = &self->quad;
if (region->rotate) {
quad->tl.texCoords.u = u;
quad->tl.texCoords.v = v2;
quad->tr.texCoords.u = u;
quad->tr.texCoords.v = v;
quad->br.texCoords.u = u2;
quad->br.texCoords.v = v;
quad->bl.texCoords.u = u2;
quad->bl.texCoords.v = v2;
} else {
quad->bl.texCoords.u = u;
quad->bl.texCoords.v = v2;
quad->tl.texCoords.u = u;
quad->tl.texCoords.v = v;
quad->tr.texCoords.u = u2;
quad->tr.texCoords.v = v;
quad->br.texCoords.u = u2;
quad->br.texCoords.v = v2;
}
quad->bl.vertices.z = 0;
quad->tl.vertices.z = 0;
quad->tr.vertices.z = 0;
quad->br.vertices.z = 0;
return SUPER(self);
}
/**/
char* _Util_readFile (const char* path, int* length) {
unsigned long size;
char* data = reinterpret_cast<char*>(CCFileUtils::sharedFileUtils()->getFileData(
CCFileUtils::sharedFileUtils()->fullPathForFilename(path).c_str(), "r", &size));
*length = size;
return data;
}
}

View File

@ -23,26 +23,37 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#ifndef SPINE_CCSKELETON_H_
#define SPINE_CCSKELETON_H_
#include <spine/spine.h>
#include "cocos2d.h"
namespace spine {
class SkeletonData;
class Skeleton;
class AnimationState;
class AnimationStateData;
typedef struct {
AtlasPage super;
cocos2d::CCTexture2D* texture;
cocos2d::CCTextureAtlas* atlas;
} Cocos2dxAtlasPage;
/**/
class CCSkeleton;
typedef struct {
Skeleton super;
CCSkeleton* node;
} Cocos2dxSkeleton;
class CCSkeleton: public cocos2d::CCNodeRGBA, public cocos2d::CCBlendProtocol {
public:
Skeleton *skeleton;
AnimationState *state;
bool debug;
Skeleton* skeleton;
AnimationState* state;
bool debugSlots;
bool debugBones;
cocos2d::CCTextureAtlas* atlas; // All region attachments for a skeleton must use the same texture.
unsigned int quadCount;
static CCSkeleton* create (SkeletonData* skeletonData);
CCSkeleton (SkeletonData *skeletonData, AnimationStateData *stateData = 0);
CCSkeleton (SkeletonData* skeletonData, AnimationStateData* stateData = 0);
virtual ~CCSkeleton ();
virtual void update (float deltaTime);
@ -52,5 +63,12 @@ public:
CC_PROPERTY(cocos2d::ccBlendFunc, blendFunc, BlendFunc);
};
} /* namespace spine */
#endif /* SPINE_CCSKELETON_H_ */
/**/
typedef struct {
RegionAttachment super;
cocos2d::ccV3F_C4B_T2F_Quad quad;
cocos2d::CCTextureAtlas* atlas;
} Cocos2dxRegionAttachment;
}