|
@@ -72,24 +72,46 @@ void disposeTrackEntry (spTrackEntry* entry) {
|
|
//
|
|
//
|
|
|
|
|
|
SkeletonAnimation* SkeletonAnimation::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
|
SkeletonAnimation* SkeletonAnimation::createWithData (spSkeletonData* skeletonData, bool ownsSkeletonData) {
|
|
- SkeletonAnimation* node = new SkeletonAnimation(skeletonData, ownsSkeletonData);
|
|
|
|
|
|
+ SkeletonAnimation* node = new SkeletonAnimation();
|
|
|
|
+ node->initWithData(skeletonData, ownsSkeletonData);
|
|
node->autorelease();
|
|
node->autorelease();
|
|
return node;
|
|
return node;
|
|
}
|
|
}
|
|
|
|
|
|
-SkeletonAnimation* SkeletonAnimation::createWithFile (const std::string& skeletonDataFile, spAtlas* atlas, float scale) {
|
|
|
|
- SkeletonAnimation* node = new SkeletonAnimation(skeletonDataFile, atlas, scale);
|
|
|
|
|
|
+SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, spAtlas* atlas, float scale) {
|
|
|
|
+ SkeletonAnimation* node = new SkeletonAnimation();
|
|
|
|
+ node->initWithJsonFile(skeletonJsonFile, atlas, scale);
|
|
node->autorelease();
|
|
node->autorelease();
|
|
return node;
|
|
return node;
|
|
}
|
|
}
|
|
|
|
|
|
-SkeletonAnimation* SkeletonAnimation::createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) {
|
|
|
|
- SkeletonAnimation* node = new SkeletonAnimation(skeletonDataFile, atlasFile, scale);
|
|
|
|
|
|
+SkeletonAnimation* SkeletonAnimation::createWithJsonFile (const std::string& skeletonJsonFile, const std::string& atlasFile, float scale) {
|
|
|
|
+ SkeletonAnimation* node = new SkeletonAnimation();
|
|
|
|
+ spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
|
|
|
+ node->initWithJsonFile(skeletonJsonFile, atlas, scale);
|
|
node->autorelease();
|
|
node->autorelease();
|
|
return node;
|
|
return node;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, spAtlas* atlas, float scale) {
|
|
|
|
+ SkeletonAnimation* node = new SkeletonAnimation();
|
|
|
|
+ node->initWithBinaryFile(skeletonBinaryFile, atlas, scale);
|
|
|
|
+ node->autorelease();
|
|
|
|
+ return node;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+SkeletonAnimation* SkeletonAnimation::createWithBinaryFile (const std::string& skeletonBinaryFile, const std::string& atlasFile, float scale) {
|
|
|
|
+ SkeletonAnimation* node = new SkeletonAnimation();
|
|
|
|
+ spAtlas* atlas = spAtlas_createFromFile(atlasFile.c_str(), 0);
|
|
|
|
+ node->initWithBinaryFile(skeletonBinaryFile, atlas, scale);
|
|
|
|
+ node->autorelease();
|
|
|
|
+ return node;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
void SkeletonAnimation::initialize () {
|
|
void SkeletonAnimation::initialize () {
|
|
|
|
+ super::initialize();
|
|
|
|
+
|
|
_ownsAnimationStateData = true;
|
|
_ownsAnimationStateData = true;
|
|
_state = spAnimationState_create(spAnimationStateData_create(_skeleton->data));
|
|
_state = spAnimationState_create(spAnimationStateData_create(_skeleton->data));
|
|
_state->rendererObject = this;
|
|
_state->rendererObject = this;
|
|
@@ -103,21 +125,6 @@ SkeletonAnimation::SkeletonAnimation ()
|
|
: SkeletonRenderer() {
|
|
: SkeletonRenderer() {
|
|
}
|
|
}
|
|
|
|
|
|
-SkeletonAnimation::SkeletonAnimation (spSkeletonData *skeletonData, bool ownsSkeletonData)
|
|
|
|
- : SkeletonRenderer(skeletonData, ownsSkeletonData) {
|
|
|
|
- initialize();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-SkeletonAnimation::SkeletonAnimation (const std::string& skeletonDataFile, spAtlas* atlas, float scale)
|
|
|
|
- : SkeletonRenderer(skeletonDataFile, atlas, scale) {
|
|
|
|
- initialize();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-SkeletonAnimation::SkeletonAnimation (const std::string& skeletonDataFile, const std::string& atlasFile, float scale)
|
|
|
|
- : SkeletonRenderer(skeletonDataFile, atlasFile, scale) {
|
|
|
|
- initialize();
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
SkeletonAnimation::~SkeletonAnimation () {
|
|
SkeletonAnimation::~SkeletonAnimation () {
|
|
if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data);
|
|
if (_ownsAnimationStateData) spAnimationStateData_dispose(_state->data);
|
|
spAnimationState_dispose(_state);
|
|
spAnimationState_dispose(_state);
|
|
@@ -165,9 +172,9 @@ spTrackEntry* SkeletonAnimation::addAnimation (int trackIndex, const std::string
|
|
}
|
|
}
|
|
return spAnimationState_addAnimation(_state, trackIndex, animation, loop, delay);
|
|
return spAnimationState_addAnimation(_state, trackIndex, animation, loop, delay);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
spAnimation* SkeletonAnimation::findAnimation(const std::string& name) const {
|
|
spAnimation* SkeletonAnimation::findAnimation(const std::string& name) const {
|
|
- return spSkeletonData_findAnimation(_skeleton->data, name.c_str());
|
|
|
|
|
|
+ return spSkeletonData_findAnimation(_skeleton->data, name.c_str());
|
|
}
|
|
}
|
|
|
|
|
|
spTrackEntry* SkeletonAnimation::getCurrent (int trackIndex) {
|
|
spTrackEntry* SkeletonAnimation::getCurrent (int trackIndex) {
|