Skeleton


#ifndef SPINE_SKELETON_H_

#define SPINE_SKELETON_H_


#include <spine/SkeletonData.h>

#include <spine/Slot.h>

#include <spine/Skin.h>


namespace cocos2d { namespace extension {


typedef struct Skeleton Skeleton;

struct Skeleton {

SkeletonData* const data;


int boneCount;

Bone** bones;

Bone* const root;


int slotCount;

Slot** slots;

Slot** drawOrder;


Skin* const skin;

float r, g, b, a;

float time;

int/*bool*/flipX, flipY;

float x, y;

};


Skeleton* Skeleton_create (SkeletonData* data);

void Skeleton_dispose (Skeleton* self);


void Skeleton_updateWorldTransform (const Skeleton* self);


void Skeleton_setToSetupPose (const Skeleton* self);

void Skeleton_setBonesToSetupPose (const Skeleton* self);

void Skeleton_setSlotsToSetupPose (const Skeleton* self);


/* Returns 0 if the bone was not found. */

Bone* Skeleton_findBone (const Skeleton* self, const char* boneName);

/* Returns -1 if the bone was not found. */

int Skeleton_findBoneIndex (const Skeleton* self, const char* boneName);


/* Returns 0 if the slot was not found. */

Slot* Skeleton_findSlot (const Skeleton* self, const char* slotName);

/* Returns -1 if the slot was not found. */

int Skeleton_findSlotIndex (const Skeleton* self, const char* 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.

 * @param skin May be 0.*/

void Skeleton_setSkin (Skeleton* self, Skin* skin);

/* Returns 0 if the skin was not found. See Skeleton_setSkin.

 * @param skinName May be 0. */

int Skeleton_setSkinByName (Skeleton* self, const char* skinName);


/* Returns 0 if the slot or attachment was not found. */

Attachment* Skeleton_getAttachmentForSlotName (const Skeleton* self, const char* slotName, const char* attachmentName);

/* Returns 0 if the slot or attachment was not found. */

Attachment* Skeleton_getAttachmentForSlotIndex (const Skeleton* self, int slotIndex, const char* attachmentName);

/* Returns 0 if the slot or attachment was not found. */

int Skeleton_setAttachment (Skeleton* self, const char* slotName, const char* attachmentName);


void Skeleton_update (Skeleton* self, float deltaTime);


}} // namespace cocos2d { namespace extension {


#endif /* SPINE_SKELETON_H_*/


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值