mirror of https://github.com/axmolengine/axmol.git
Update spine runtime
This commit is contained in:
parent
5f1a4a4be7
commit
b87a89eaa4
|
@ -73,7 +73,9 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \
|
||||||
../spine/Slot.cpp \
|
../spine/Slot.cpp \
|
||||||
../spine/SlotData.cpp \
|
../spine/SlotData.cpp \
|
||||||
../spine/extension.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
|
include $(COCOS_ROOT)/cocos2dx/proj.linux/cocos2dx.mk
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,11 @@ void SpineTestScene::runThisTest()
|
||||||
bool SpineTestLayer::init () {
|
bool SpineTestLayer::init () {
|
||||||
if (!CCLayer::init()) return false;
|
if (!CCLayer::init()) return false;
|
||||||
|
|
||||||
skeletonNode = CCSkeleton::createWithFile("spine/spineboy.json", "spine/spineboy.atlas");
|
skeletonNode = CCSkeletonAnimation::createWithFile("spine/spineboy.json", "spine/spineboy.atlas");
|
||||||
AnimationStateData_setMixByName(skeletonNode->state->data, "walk", "jump", 0.4f);
|
skeletonNode->setMix("walk", "jump", 0.4f);
|
||||||
AnimationStateData_setMixByName(skeletonNode->state->data, "jump", "walk", 0.4f);
|
skeletonNode->setMix("jump", "walk", 0.4f);
|
||||||
AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
skeletonNode->setAnimation("walk", true);
|
||||||
|
|
||||||
skeletonNode->timeScale = 0.3f;
|
skeletonNode->timeScale = 0.3f;
|
||||||
skeletonNode->debugBones = true;
|
skeletonNode->debugBones = true;
|
||||||
|
|
||||||
|
@ -70,9 +71,11 @@ bool SpineTestLayer::init () {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpineTestLayer::update (float deltaTime) {
|
void SpineTestLayer::update (float deltaTime) {
|
||||||
if (skeletonNode->state->loop) {
|
if (skeletonNode->states[0]->loop) {
|
||||||
if (skeletonNode->state->time > 2) AnimationState_setAnimationByName(skeletonNode->state, "jump", false);
|
if (skeletonNode->states[0]->time > 2)
|
||||||
|
skeletonNode->setAnimation("jump", false);
|
||||||
} else {
|
} else {
|
||||||
if (skeletonNode->state->time > 1) AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
if (skeletonNode->states[0]->time > 1)
|
||||||
|
skeletonNode->setAnimation("walk", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
class SpineTestLayer: public cocos2d::CCLayer {
|
class SpineTestLayer: public cocos2d::CCLayer {
|
||||||
private:
|
private:
|
||||||
cocos2d::extension::CCSkeleton* skeletonNode;
|
cocos2d::extension::CCSkeletonAnimation* skeletonNode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue