add spine test case

This commit is contained in:
minggo 2015-04-14 16:14:51 +08:00
parent c62b34ac01
commit cdd7acc537
5 changed files with 1635 additions and 1 deletions

View File

@ -44,6 +44,7 @@ SpineTests::SpineTests()
ADD_TEST_CASE(SpineTestLayerNormal);
ADD_TEST_CASE(SpineTestLayerFFD);
ADD_TEST_CASE(SpineTestPerformanceLayer);
ADD_TEST_CASE(SpineTestLayerRapor);
}
bool SpineTestLayerNormal::init () {
@ -168,4 +169,34 @@ bool SpineTestPerformanceLayer::init () {
void SpineTestPerformanceLayer::update (float deltaTime) {
}
}
bool SpineTestLayerRapor::init () {
if (!SpineTestLayer::init()) return false;
skeletonNode = SkeletonAnimation::createWithFile("spine/raptor.json", "spine/raptor.atlas", 0.5f);
skeletonNode->setAnimation(0, "walk", true);
skeletonNode->setAnimation(1, "empty", false);
skeletonNode->addAnimation(1, "gungrab", false, 2);
skeletonNode->setScale(0.5);
Size windowSize = Director::getInstance()->getWinSize();
skeletonNode->setPosition(Vec2(windowSize.width / 2, 20));
addChild(skeletonNode);
scheduleUpdate();
EventListenerTouchOneByOne* listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [this] (Touch* touch, Event* event) -> bool {
if (!skeletonNode->getDebugBonesEnabled())
skeletonNode->setDebugBonesEnabled(true);
else if (skeletonNode->getTimeScale() == 1)
skeletonNode->setTimeScale(0.3f);
else
skeletonNode->setDebugBonesEnabled(false);
return true;
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
return true;
}

View File

@ -78,6 +78,25 @@ public:
CREATE_FUNC (SpineTestLayerFFD);
};
class SpineTestLayerRapor: public SpineTestLayer
{
public:
virtual std::string title() const override
{
return "Spine Test";
}
virtual std::string subtitle() const override
{
return "Raptor Test";
}
virtual bool init () override;
CREATE_FUNC (SpineTestLayerRapor);
private:
spine::SkeletonAnimation* skeletonNode;
};
class SpineTestPerformanceLayer: public SpineTestLayer
{
public:

View File

@ -0,0 +1,251 @@
raptor.png
size: 1022,1022
format: RGBA8888
filter: Linear,Linear
repeat: none
back_arm
rotate: false
xy: 410, 545
size: 46, 29
orig: 46, 29
offset: 0, 0
index: -1
back_bracer
rotate: false
xy: 540, 548
size: 39, 28
orig: 39, 28
offset: 0, 0
index: -1
back_hand
rotate: true
xy: 504, 538
size: 36, 34
orig: 36, 34
offset: 0, 0
index: -1
back_knee
rotate: false
xy: 299, 478
size: 49, 67
orig: 49, 67
offset: 0, 0
index: -1
back_thigh
rotate: true
xy: 140, 247
size: 39, 24
orig: 39, 24
offset: 0, 0
index: -1
eyes_open
rotate: true
xy: 2, 2
size: 47, 45
orig: 47, 45
offset: 0, 0
index: -1
front_arm
rotate: false
xy: 360, 544
size: 48, 30
orig: 48, 30
offset: 0, 0
index: -1
front_bracer
rotate: false
xy: 538, 578
size: 41, 29
orig: 41, 29
offset: 0, 0
index: -1
front_hand
rotate: false
xy: 538, 609
size: 41, 38
orig: 41, 38
offset: 0, 0
index: -1
front_open_hand
rotate: false
xy: 894, 782
size: 43, 44
orig: 43, 44
offset: 0, 0
index: -1
front_thigh
rotate: false
xy: 942, 849
size: 57, 29
orig: 57, 29
offset: 0, 0
index: -1
gun
rotate: false
xy: 785, 774
size: 107, 103
orig: 107, 103
offset: 0, 0
index: -1
gun_nohand
rotate: false
xy: 614, 703
size: 105, 102
orig: 105, 102
offset: 0, 0
index: -1
head
rotate: false
xy: 2, 137
size: 136, 149
orig: 136, 149
offset: 0, 0
index: -1
lower_leg
rotate: true
xy: 780, 699
size: 73, 98
orig: 73, 98
offset: 0, 0
index: -1
mouth_smile
rotate: true
xy: 49, 2
size: 47, 30
orig: 47, 30
offset: 0, 0
index: -1
neck
rotate: true
xy: 1001, 860
size: 18, 21
orig: 18, 21
offset: 0, 0
index: -1
raptor_arm_back
rotate: false
xy: 940, 936
size: 82, 86
orig: 82, 86
offset: 0, 0
index: -1
raptor_body
rotate: false
xy: 2, 737
size: 610, 285
orig: 610, 285
offset: 0, 0
index: -1
raptor_front_arm
rotate: true
xy: 195, 464
size: 81, 102
orig: 81, 102
offset: 0, 0
index: -1
raptor_front_leg
rotate: false
xy: 2, 478
size: 191, 257
orig: 191, 257
offset: 0, 0
index: -1
raptor_hindleg_back
rotate: false
xy: 614, 807
size: 169, 215
orig: 169, 215
offset: 0, 0
index: -1
raptor_horn
rotate: false
xy: 360, 655
size: 182, 80
orig: 182, 80
offset: 0, 0
index: -1
raptor_horn_back
rotate: false
xy: 360, 576
size: 176, 77
orig: 176, 77
offset: 0, 0
index: -1
raptor_jaw
rotate: false
xy: 785, 879
size: 153, 143
orig: 153, 143
offset: 0, 0
index: -1
raptor_saddle_noshadow
rotate: false
xy: 2, 288
size: 163, 188
orig: 163, 188
offset: 0, 0
index: -1
raptor_saddle_strap_front
rotate: false
xy: 721, 710
size: 57, 95
orig: 57, 95
offset: 0, 0
index: -1
raptor_saddle_strap_rear
rotate: true
xy: 940, 880
size: 54, 74
orig: 54, 74
offset: 0, 0
index: -1
raptor_saddle_w_shadow
rotate: false
xy: 195, 547
size: 163, 188
orig: 163, 188
offset: 0, 0
index: -1
raptor_tongue
rotate: true
xy: 544, 649
size: 86, 64
orig: 86, 64
offset: 0, 0
index: -1
stirrup_back
rotate: false
xy: 458, 539
size: 44, 35
orig: 44, 35
offset: 0, 0
index: -1
stirrup_front
rotate: true
xy: 81, 4
size: 45, 50
orig: 45, 50
offset: 0, 0
index: -1
stirrup_strap
rotate: true
xy: 894, 828
size: 49, 46
orig: 49, 46
offset: 0, 0
index: -1
torso
rotate: true
xy: 610, 647
size: 54, 91
orig: 54, 91
offset: 0, 0
index: -1
visor
rotate: false
xy: 2, 51
size: 131, 84
orig: 131, 84
offset: 0, 0
index: -1

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 KiB