From b87a89eaa4a0ac793e5872450595188e21ae21e2 Mon Sep 17 00:00:00 2001 From: flaming0 Date: Sun, 2 Jun 2013 19:59:13 +0400 Subject: [PATCH] Update spine runtime --- extensions/proj.linux/Makefile | 4 +++- .../Cpp/TestCpp/Classes/SpineTest/SpineTest.cpp | 17 ++++++++++------- .../Cpp/TestCpp/Classes/SpineTest/SpineTest.h | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/extensions/proj.linux/Makefile b/extensions/proj.linux/Makefile index a3dcf6a26b..ef6bc702fa 100644 --- a/extensions/proj.linux/Makefile +++ b/extensions/proj.linux/Makefile @@ -73,7 +73,9 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \ ../spine/Slot.cpp \ ../spine/SlotData.cpp \ ../spine/extension.cpp \ -../spine/spine-cocos2dx.cpp +../spine/spine-cocos2dx.cpp \ +../spine/CCSkeleton.cpp \ +../spine/CCSkeletonAnimation.cpp include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk diff --git a/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.cpp b/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.cpp index 087211e3bf..703eb6b6b0 100644 --- a/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.cpp +++ b/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.cpp @@ -48,10 +48,11 @@ void SpineTestScene::runThisTest() bool SpineTestLayer::init () { if (!CCLayer::init()) return false; - skeletonNode = CCSkeleton::createWithFile("spine/spineboy.json", "spine/spineboy.atlas"); - AnimationStateData_setMixByName(skeletonNode->state->data, "walk", "jump", 0.4f); - AnimationStateData_setMixByName(skeletonNode->state->data, "jump", "walk", 0.4f); - AnimationState_setAnimationByName(skeletonNode->state, "walk", true); + skeletonNode = CCSkeletonAnimation::createWithFile("spine/spineboy.json", "spine/spineboy.atlas"); + skeletonNode->setMix("walk", "jump", 0.4f); + skeletonNode->setMix("jump", "walk", 0.4f); + skeletonNode->setAnimation("walk", true); + skeletonNode->timeScale = 0.3f; skeletonNode->debugBones = true; @@ -70,9 +71,11 @@ bool SpineTestLayer::init () { } void SpineTestLayer::update (float deltaTime) { - if (skeletonNode->state->loop) { - if (skeletonNode->state->time > 2) AnimationState_setAnimationByName(skeletonNode->state, "jump", false); + if (skeletonNode->states[0]->loop) { + if (skeletonNode->states[0]->time > 2) + skeletonNode->setAnimation("jump", false); } else { - if (skeletonNode->state->time > 1) AnimationState_setAnimationByName(skeletonNode->state, "walk", true); + if (skeletonNode->states[0]->time > 1) + skeletonNode->setAnimation("walk", true); } } diff --git a/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.h b/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.h index 10eadbc3b5..091ee3f44c 100644 --- a/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.h +++ b/samples/Cpp/TestCpp/Classes/SpineTest/SpineTest.h @@ -38,7 +38,7 @@ public: class SpineTestLayer: public cocos2d::CCLayer { private: - cocos2d::extension::CCSkeleton* skeletonNode; + cocos2d::extension::CCSkeletonAnimation* skeletonNode; public: