mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
Removed convenience methods to make it clear that the spine-c API should be used.
Discussion here: http://www.esotericsoftware.com/forum/viewtopic.php?f=3&t=536
This commit is contained in:
parent
55d374f2ee
commit
f055dc8fd7
@ -37,10 +37,10 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (!self) return nil;
|
if (!self) return nil;
|
||||||
|
|
||||||
skeletonNode = [CCSkeleton create:@"spineboy.json" atlasFile:@"spineboy.atlas"];
|
skeletonNode = [CCSkeleton skeletonWithFile:@"spineboy.json" atlasFile:@"spineboy.atlas"];
|
||||||
[skeletonNode setMix:@"walk" to:@"jump" duration:0.4f];
|
AnimationStateData_setMixByName(skeletonNode->state->data, "walk", "jump", 0.4f);
|
||||||
[skeletonNode setMix:@"jump" to:@"walk" duration:0.4f];
|
AnimationStateData_setMixByName(skeletonNode->state->data, "jump", "walk", 0.4f);
|
||||||
[skeletonNode setAnimation:@"walk" loop:true];
|
AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
||||||
skeletonNode->timeScale = 0.3f;
|
skeletonNode->timeScale = 0.3f;
|
||||||
skeletonNode->debugBones = true;
|
skeletonNode->debugBones = true;
|
||||||
|
|
||||||
@ -58,10 +58,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) update:(ccTime)delta {
|
- (void) update:(ccTime)delta {
|
||||||
if (strcmp(skeletonNode->state->animation->name, "walk") == 0) {
|
if (skeletonNode->state->loop) {
|
||||||
if (skeletonNode->state->time > 2) [skeletonNode setAnimation:@"jump" loop:false];
|
if (skeletonNode->state->time > 2) AnimationState_setAnimationByName(skeletonNode->state, "jump", false);
|
||||||
} else {
|
} else {
|
||||||
if (skeletonNode->state->time > 1) [skeletonNode setAnimation:@"walk" loop:true];
|
if (skeletonNode->state->time > 1) AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -45,50 +45,17 @@
|
|||||||
ccBlendFunc blendFunc;
|
ccBlendFunc blendFunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (CCSkeleton*) create:(NSString*)skeletonDataFile atlas:(Atlas*)atlas;
|
+ (CCSkeleton*) skeletonWithFile:(NSString*)skeletonDataFile atlas:(Atlas*)atlas;
|
||||||
+ (CCSkeleton*) create:(NSString*)skeletonDataFile atlas:(Atlas*)atlas scale:(float)scale;
|
+ (CCSkeleton*) skeletonWithFile:(NSString*)skeletonDataFile atlas:(Atlas*)atlas scale:(float)scale;
|
||||||
|
|
||||||
+ (CCSkeleton*) create:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile;
|
+ (CCSkeleton*) skeletonWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile;
|
||||||
+ (CCSkeleton*) create:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale;
|
+ (CCSkeleton*) skeletonWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale;
|
||||||
|
|
||||||
+ (CCSkeleton*) create:(SkeletonData*)skeletonData;
|
+ (CCSkeleton*) skeletonWithData:(SkeletonData*)skeletonData;
|
||||||
+ (CCSkeleton*) create:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData;
|
+ (CCSkeleton*) skeletonWithData:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData;
|
||||||
|
|
||||||
- init:(SkeletonData*)skeletonData;
|
- initWithData:(SkeletonData*)skeletonData;
|
||||||
- init:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData;
|
- initWithData:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData;
|
||||||
|
|
||||||
- (void) setMix:(NSString*)fromName to:(NSString*)toName duration:(float)duration;
|
|
||||||
- (void) setAnimation:(NSString*)animationName loop:(bool)loop;
|
|
||||||
- (void) clearAnimation;
|
|
||||||
- (void) isComplete;
|
|
||||||
|
|
||||||
- (void) updateWorldTransform;
|
|
||||||
|
|
||||||
- (void) setToBindPose;
|
|
||||||
- (void) setBonesToBindPose;
|
|
||||||
- (void) setSlotsToBindPose;
|
|
||||||
|
|
||||||
/* Returns 0 if the bone was not found. */
|
|
||||||
- (Bone*) findBone:(NSString*)boneName;
|
|
||||||
/* Returns -1 if the bone was not found. */
|
|
||||||
- (int) findBoneIndex:(NSString*)boneName;
|
|
||||||
|
|
||||||
/* Returns 0 if the slot was not found. */
|
|
||||||
- (Slot*) findSlot:(NSString*)slotName;
|
|
||||||
/* Returns -1 if the slot was not found. */
|
|
||||||
- (int) findSlotIndex:(NSString*)slotName;
|
|
||||||
|
|
||||||
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
|
|
||||||
* attached if the corresponding attachment from the old skin was attached. Returns false if the skin was not found.
|
|
||||||
* @param skin May be 0.*/
|
|
||||||
- (bool) setSkin:(NSString*)skinName;
|
|
||||||
|
|
||||||
/* Returns 0 if the slot or attachment was not found. */
|
|
||||||
- (Attachment*) getAttachmentForSlotName:(NSString*)slotName attachmentName:(NSString*)attachmentName;
|
|
||||||
/* Returns 0 if the slot or attachment was not found. */
|
|
||||||
- (Attachment*) getAttachmentForSlotIndex:(int)slotIndex attachmentName:(NSString*)attachmentName;
|
|
||||||
/* Returns false if the slot or attachment was not found. */
|
|
||||||
- (bool) setAttachment:(NSString*)slotName attachmentName:(NSString*)attachmentName;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@ -112,11 +112,11 @@ void RegionAttachment_updateQuad (RegionAttachment* self, Slot* slot, ccV3F_C4B_
|
|||||||
|
|
||||||
@implementation CCSkeleton
|
@implementation CCSkeleton
|
||||||
|
|
||||||
+ (id) create:(NSString*)skeletonDataFile atlas:(Atlas*)atlas {
|
+ (id) skeletonWithFile:(NSString*)skeletonDataFile atlas:(Atlas*)atlas {
|
||||||
return [CCSkeleton create:skeletonDataFile atlas:atlas scale:1];
|
return [CCSkeleton skeletonWithFile:skeletonDataFile atlas:atlas scale:1];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) create:(NSString*)skeletonDataFile atlas:(Atlas*)atlas scale:(float)scale {
|
+ (id) skeletonWithFile:(NSString*)skeletonDataFile atlas:(Atlas*)atlas scale:(float)scale {
|
||||||
NSAssert(skeletonDataFile, @"skeletonDataFile cannot be nil.");
|
NSAssert(skeletonDataFile, @"skeletonDataFile cannot be nil.");
|
||||||
NSAssert(atlas, @"atlas cannot be nil.");
|
NSAssert(atlas, @"atlas cannot be nil.");
|
||||||
|
|
||||||
@ -126,16 +126,16 @@ void RegionAttachment_updateQuad (RegionAttachment* self, Slot* slot, ccV3F_C4B_
|
|||||||
NSAssert(skeletonData, ([NSString stringWithFormat:@"Error reading skeleton data file: %@\nError: %s", skeletonDataFile, json->error]));
|
NSAssert(skeletonData, ([NSString stringWithFormat:@"Error reading skeleton data file: %@\nError: %s", skeletonDataFile, json->error]));
|
||||||
SkeletonJson_dispose(json);
|
SkeletonJson_dispose(json);
|
||||||
|
|
||||||
CCSkeleton* node = skeletonData ? [CCSkeleton create:skeletonData] : 0;
|
CCSkeleton* node = skeletonData ? [CCSkeleton skeletonWithData:skeletonData] : 0;
|
||||||
node->ownsSkeleton = true;
|
node->ownsSkeleton = true;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) create:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile {
|
+ (id) skeletonWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile {
|
||||||
return [CCSkeleton create:skeletonDataFile atlasFile:atlasFile scale:1];
|
return [CCSkeleton skeletonWithFile:skeletonDataFile atlasFile:atlasFile scale:1];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) create:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale {
|
+ (id) skeletonWithFile:(NSString*)skeletonDataFile atlasFile:(NSString*)atlasFile scale:(float)scale {
|
||||||
NSAssert(skeletonDataFile, @"skeletonDataFile cannot be nil.");
|
NSAssert(skeletonDataFile, @"skeletonDataFile cannot be nil.");
|
||||||
NSAssert(atlasFile, @"atlasFile cannot be nil.");
|
NSAssert(atlasFile, @"atlasFile cannot be nil.");
|
||||||
|
|
||||||
@ -153,25 +153,25 @@ void RegionAttachment_updateQuad (RegionAttachment* self, Slot* slot, ccV3F_C4B_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSkeleton* node = [CCSkeleton create:skeletonData];
|
CCSkeleton* node = [CCSkeleton skeletonWithData:skeletonData];
|
||||||
node->ownsSkeleton = true;
|
node->ownsSkeleton = true;
|
||||||
node->atlas = atlas;
|
node->atlas = atlas;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) create:(SkeletonData*)skeletonData {
|
+ (id) skeletonWithData:(SkeletonData*)skeletonData {
|
||||||
return [CCSkeleton create:skeletonData stateData:0];
|
return [CCSkeleton skeletonWithData:skeletonData stateData:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (id) create:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData {
|
+ (id) skeletonWithData:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData {
|
||||||
return [[[CCSkeleton alloc] init:skeletonData stateData:stateData] autorelease];
|
return [[[CCSkeleton alloc] initWithData:skeletonData stateData:stateData] autorelease];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init:(SkeletonData*)skeletonData {
|
- (id) initWithData:(SkeletonData*)skeletonData {
|
||||||
return [self init:skeletonData stateData:0];
|
return [self initWithData:skeletonData stateData:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) init:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData {
|
- (id) initWithData:(SkeletonData*)skeletonData stateData:(AnimationStateData*)stateData {
|
||||||
NSAssert(skeletonData, @"skeletonData cannot be nil.");
|
NSAssert(skeletonData, @"skeletonData cannot be nil.");
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
@ -322,63 +322,6 @@ void RegionAttachment_updateQuad (RegionAttachment* self, Slot* slot, ccV3F_C4B_
|
|||||||
return CGRectMake(minX, minY, maxX - minX, maxY - minY);
|
return CGRectMake(minX, minY, maxX - minX, maxY - minY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience methods:
|
|
||||||
|
|
||||||
- (void) setMix:(NSString*)fromName to:(NSString*)toName duration:(float)duration {
|
|
||||||
AnimationStateData_setMixByName(state->data, [fromName UTF8String], [toName UTF8String], duration);
|
|
||||||
}
|
|
||||||
- (void) setAnimation:(NSString*)animationName loop:(bool)loop {
|
|
||||||
AnimationState_setAnimationByName(state, [animationName UTF8String], loop);
|
|
||||||
}
|
|
||||||
- (void) clearAnimation {
|
|
||||||
AnimationState_clearAnimation(state);
|
|
||||||
}
|
|
||||||
- (void) isComplete {
|
|
||||||
return AnimationState_isComplete(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) updateWorldTransform {
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setToBindPose {
|
|
||||||
Skeleton_setToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
- (void) setBonesToBindPose {
|
|
||||||
Skeleton_setBonesToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
- (void) setSlotsToBindPose {
|
|
||||||
Skeleton_setSlotsToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (Bone*) findBone:(NSString*)boneName {
|
|
||||||
return Skeleton_findBone(skeleton, [boneName UTF8String]);
|
|
||||||
}
|
|
||||||
- (int) findBoneIndex:(NSString*)boneName {
|
|
||||||
return Skeleton_findBoneIndex(skeleton, [boneName UTF8String]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (Slot*) findSlot:(NSString*)slotName {
|
|
||||||
return Skeleton_findSlot(skeleton, [slotName UTF8String]);
|
|
||||||
}
|
|
||||||
- (int) findSlotIndex:(NSString*)slotName {
|
|
||||||
return Skeleton_findSlotIndex(skeleton, [slotName UTF8String]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (bool) setSkin:(NSString*)skinName {
|
|
||||||
return (bool)Skeleton_setSkinByName(skeleton, [skinName UTF8String]);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (Attachment*) getAttachmentForSlotName:(NSString*)slotName attachmentName:(NSString*)attachmentName {
|
|
||||||
return Skeleton_getAttachmentForSlotName(skeleton, [slotName UTF8String], [attachmentName UTF8String]);
|
|
||||||
}
|
|
||||||
- (Attachment*) getAttachmentForSlotIndex:(int)slotIndex attachmentName:(NSString*)attachmentName {
|
|
||||||
return Skeleton_getAttachmentForSlotIndex(skeleton, slotIndex, [attachmentName UTF8String]);
|
|
||||||
}
|
|
||||||
- (bool) setAttachment:(NSString*)slotName attachmentName:(NSString*)attachmentName {
|
|
||||||
return (bool)Skeleton_setAttachment(skeleton, [slotName UTF8String], [attachmentName UTF8String]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// CCBlendProtocol
|
// CCBlendProtocol
|
||||||
|
|
||||||
- (void) setBlendFunc:(ccBlendFunc)func {
|
- (void) setBlendFunc:(ccBlendFunc)func {
|
||||||
|
|||||||
@ -41,10 +41,10 @@ CCScene* ExampleLayer::scene () {
|
|||||||
bool ExampleLayer::init () {
|
bool ExampleLayer::init () {
|
||||||
if (!CCLayer::init()) return false;
|
if (!CCLayer::init()) return false;
|
||||||
|
|
||||||
skeletonNode = CCSkeleton::create("spineboy.json", "spineboy.atlas");
|
skeletonNode = CCSkeleton::createWithFile("spineboy.json", "spineboy.atlas");
|
||||||
skeletonNode->setMix("walk", "jump", 0.4f);
|
AnimationStateData_setMixByName(skeletonNode->state->data, "walk", "jump", 0.4f);
|
||||||
skeletonNode->setMix("jump", "walk", 0.4f);
|
AnimationStateData_setMixByName(skeletonNode->state->data, "jump", "walk", 0.4f);
|
||||||
skeletonNode->setAnimation("walk", true);
|
AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
||||||
skeletonNode->timeScale = 0.3f;
|
skeletonNode->timeScale = 0.3f;
|
||||||
skeletonNode->debugBones = true;
|
skeletonNode->debugBones = true;
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ bool ExampleLayer::init () {
|
|||||||
|
|
||||||
void ExampleLayer::update (float deltaTime) {
|
void ExampleLayer::update (float deltaTime) {
|
||||||
if (skeletonNode->state->loop) {
|
if (skeletonNode->state->loop) {
|
||||||
if (skeletonNode->state->time > 2) skeletonNode->setAnimation("jump", false);
|
if (skeletonNode->state->time > 2) AnimationState_setAnimationByName(skeletonNode->state, "jump", false);
|
||||||
} else {
|
} else {
|
||||||
if (skeletonNode->state->time > 1) skeletonNode->setAnimation("walk", true);
|
if (skeletonNode->state->time > 1) AnimationState_setAnimationByName(skeletonNode->state, "walk", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,17 +110,17 @@ void RegionAttachment_updateQuad (RegionAttachment* self, Slot* slot, ccV3F_C4B_
|
|||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
CCSkeleton* CCSkeleton::create (const char* skeletonDataFile, Atlas* atlas, float scale) {
|
CCSkeleton* CCSkeleton::createWithFile (const char* skeletonDataFile, Atlas* atlas, float scale) {
|
||||||
SkeletonJson* json = SkeletonJson_create(atlas);
|
SkeletonJson* json = SkeletonJson_create(atlas);
|
||||||
json->scale = scale;
|
json->scale = scale;
|
||||||
SkeletonData* skeletonData = SkeletonJson_readSkeletonDataFile(json, skeletonDataFile);
|
SkeletonData* skeletonData = SkeletonJson_readSkeletonDataFile(json, skeletonDataFile);
|
||||||
SkeletonJson_dispose(json);
|
SkeletonJson_dispose(json);
|
||||||
CCSkeleton* node = skeletonData ? create(skeletonData) : 0;
|
CCSkeleton* node = skeletonData ? createWithData(skeletonData) : 0;
|
||||||
node->ownsSkeleton = true;
|
node->ownsSkeleton = true;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSkeleton* CCSkeleton::create (const char* skeletonDataFile, const char* atlasFile, float scale) {
|
CCSkeleton* CCSkeleton::createWithFile (const char* skeletonDataFile, const char* atlasFile, float scale) {
|
||||||
Atlas* atlas = Atlas_readAtlasFile(atlasFile);
|
Atlas* atlas = Atlas_readAtlasFile(atlasFile);
|
||||||
if (!atlas) return 0;
|
if (!atlas) return 0;
|
||||||
SkeletonJson* json = SkeletonJson_create(atlas);
|
SkeletonJson* json = SkeletonJson_create(atlas);
|
||||||
@ -131,13 +131,13 @@ CCSkeleton* CCSkeleton::create (const char* skeletonDataFile, const char* atlasF
|
|||||||
Atlas_dispose(atlas);
|
Atlas_dispose(atlas);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CCSkeleton* node = create(skeletonData);
|
CCSkeleton* node = createWithData(skeletonData);
|
||||||
node->ownsSkeleton = true;
|
node->ownsSkeleton = true;
|
||||||
node->atlas = atlas;
|
node->atlas = atlas;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCSkeleton* CCSkeleton::create (SkeletonData* skeletonData, AnimationStateData* stateData) {
|
CCSkeleton* CCSkeleton::createWithData (SkeletonData* skeletonData, AnimationStateData* stateData) {
|
||||||
CCSkeleton* node = new CCSkeleton(skeletonData, stateData);
|
CCSkeleton* node = new CCSkeleton(skeletonData, stateData);
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
return node;
|
return node;
|
||||||
@ -289,63 +289,6 @@ CCRect CCSkeleton::boundingBox () {
|
|||||||
return CCRectMake(minX, minY, maxX - minX, maxY - minY);
|
return CCRectMake(minX, minY, maxX - minX, maxY - minY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience methods:
|
|
||||||
|
|
||||||
void CCSkeleton::setMix (const char* fromName, const char* toName, float duration) {
|
|
||||||
AnimationStateData_setMixByName(state->data, fromName, toName, duration);
|
|
||||||
}
|
|
||||||
void CCSkeleton::setAnimation (const char* animationName, bool loop) {
|
|
||||||
AnimationState_setAnimationByName(state, animationName, loop);
|
|
||||||
}
|
|
||||||
void CCSkeleton::clearAnimation () {
|
|
||||||
AnimationState_clearAnimation(state);
|
|
||||||
}
|
|
||||||
bool CCSkeleton::isComplete () const {
|
|
||||||
return AnimationState_isComplete(state) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCSkeleton::updateWorldTransform () {
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCSkeleton::setToBindPose () {
|
|
||||||
Skeleton_setToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
void CCSkeleton::setBonesToBindPose () {
|
|
||||||
Skeleton_setBonesToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
void CCSkeleton::setSlotsToBindPose () {
|
|
||||||
Skeleton_setSlotsToBindPose(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bone* CCSkeleton::findBone (const char* boneName) const {
|
|
||||||
return Skeleton_findBone(skeleton, boneName);
|
|
||||||
}
|
|
||||||
int CCSkeleton::findBoneIndex (const char* boneName) const {
|
|
||||||
return Skeleton_findBoneIndex(skeleton, boneName);
|
|
||||||
}
|
|
||||||
|
|
||||||
Slot* CCSkeleton::findSlot (const char* slotName) const {
|
|
||||||
return Skeleton_findSlot(skeleton, slotName);
|
|
||||||
}
|
|
||||||
int CCSkeleton::findSlotIndex (const char* slotName) const {
|
|
||||||
return Skeleton_findSlotIndex(skeleton, slotName);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CCSkeleton::setSkin (const char* skinName) {
|
|
||||||
return Skeleton_setSkinByName(skeleton, skinName) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Attachment* CCSkeleton::getAttachment (const char* slotName, const char* attachmentName) const {
|
|
||||||
return Skeleton_getAttachmentForSlotName(skeleton, slotName, attachmentName);
|
|
||||||
}
|
|
||||||
Attachment* CCSkeleton::getAttachment (int slotIndex, const char* attachmentName) const {
|
|
||||||
return Skeleton_getAttachmentForSlotIndex(skeleton, slotIndex, attachmentName);
|
|
||||||
}
|
|
||||||
bool CCSkeleton::setAttachment (const char* slotName, const char* attachmentName) {
|
|
||||||
return Skeleton_setAttachment(skeleton, slotName, attachmentName) ? true : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CCBlendProtocol
|
// CCBlendProtocol
|
||||||
|
|
||||||
ccBlendFunc CCSkeleton::getBlendFunc () {
|
ccBlendFunc CCSkeleton::getBlendFunc () {
|
||||||
|
|||||||
@ -44,46 +44,13 @@ public:
|
|||||||
bool debugSlots;
|
bool debugSlots;
|
||||||
bool debugBones;
|
bool debugBones;
|
||||||
|
|
||||||
static CCSkeleton* create (const char* skeletonDataFile, Atlas* atlas, float scale = 1);
|
static CCSkeleton* createWithFile (const char* skeletonDataFile, Atlas* atlas, float scale = 1);
|
||||||
static CCSkeleton* create (const char* skeletonDataFile, const char* atlasFile, float scale = 1);
|
static CCSkeleton* createWithFile (const char* skeletonDataFile, const char* atlasFile, float scale = 1);
|
||||||
static CCSkeleton* create (SkeletonData* skeletonData, AnimationStateData* stateData = 0);
|
static CCSkeleton* createWithData (SkeletonData* skeletonData, AnimationStateData* stateData = 0);
|
||||||
|
|
||||||
CCSkeleton (SkeletonData* skeletonData, AnimationStateData* stateData = 0);
|
CCSkeleton (SkeletonData* skeletonData, AnimationStateData* stateData = 0);
|
||||||
virtual ~CCSkeleton ();
|
virtual ~CCSkeleton ();
|
||||||
|
|
||||||
void setMix (const char* fromName, const char* toName, float duration);
|
|
||||||
void setAnimation (const char* animationName, bool loop);
|
|
||||||
void clearAnimation ();
|
|
||||||
bool isComplete () const;
|
|
||||||
|
|
||||||
void updateWorldTransform ();
|
|
||||||
|
|
||||||
void setToBindPose ();
|
|
||||||
void setBonesToBindPose ();
|
|
||||||
void setSlotsToBindPose ();
|
|
||||||
|
|
||||||
/* Returns 0 if the bone was not found. */
|
|
||||||
Bone* findBone (const char* boneName) const;
|
|
||||||
/* Returns -1 if the bone was not found. */
|
|
||||||
int findBoneIndex (const char* boneName) const;
|
|
||||||
|
|
||||||
/* Returns 0 if the slot was not found. */
|
|
||||||
Slot* findSlot (const char* slotName) const;
|
|
||||||
/* Returns -1 if the slot was not found. */
|
|
||||||
int findSlotIndex (const char* slotName) const;
|
|
||||||
|
|
||||||
/* Sets the skin used to look up attachments not found in the SkeletonData defaultSkin. Attachments from the new skin are
|
|
||||||
* attached if the corresponding attachment from the old skin was attached. Returns false if the skin was not found.
|
|
||||||
* @param skin May be 0.*/
|
|
||||||
bool setSkin (const char* skinName);
|
|
||||||
|
|
||||||
/* Returns 0 if the slot or attachment was not found. */
|
|
||||||
Attachment* getAttachment (const char* slotName, const char* attachmentName) const;
|
|
||||||
/* Returns 0 if the slot or attachment was not found. */
|
|
||||||
Attachment* getAttachment (int slotIndex, const char* attachmentName) const;
|
|
||||||
/* Returns false if the slot or attachment was not found. */
|
|
||||||
bool setAttachment (const char* slotName, const char* attachmentName);
|
|
||||||
|
|
||||||
virtual void update (float deltaTime);
|
virtual void update (float deltaTime);
|
||||||
virtual void draw ();
|
virtual void draw ();
|
||||||
virtual cocos2d::CCRect boundingBox ();
|
virtual cocos2d::CCRect boundingBox ();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user