Updated spine-c struct definitions to allow for forward declarations.

This commit is contained in:
NathanSweet 2014-11-18 03:40:20 +01:00
parent 1fa410bb53
commit fb214ee276
20 changed files with 45 additions and 54 deletions

View File

@ -41,7 +41,7 @@ extern "C" {
typedef struct spTimeline spTimeline;
struct spSkeleton;
typedef struct {
typedef struct spAnimation {
const char* const name;
float duration;
@ -114,7 +114,7 @@ typedef spTimeline Timeline;
/**/
typedef struct {
typedef struct spCurveTimeline {
spTimeline super;
float* curves; /* type, x, y, ... */
} spCurveTimeline;
@ -143,7 +143,11 @@ typedef struct spBaseTimeline {
int const framesCount;
float* const frames; /* time, angle, ... for rotate. time, x, y, ... for translate and scale. */
int boneIndex;
} spRotateTimeline;
} spBaseTimeline;
/**/
typedef struct spBaseTimeline spRotateTimeline;
spRotateTimeline* spRotateTimeline_create (int framesCount);
@ -185,7 +189,7 @@ typedef spScaleTimeline ScaleTimeline;
/**/
typedef struct {
typedef struct spColorTimeline {
spCurveTimeline super;
int const framesCount;
float* const frames; /* time, r, g, b, a, ... */
@ -204,7 +208,7 @@ typedef spColorTimeline ColorTimeline;
/**/
typedef struct {
typedef struct spAttachmentTimeline {
spTimeline super;
int const framesCount;
float* const frames; /* time, ... */
@ -225,7 +229,7 @@ typedef spAttachmentTimeline AttachmentTimeline;
/**/
typedef struct {
typedef struct spEventTimeline {
spTimeline super;
int const framesCount;
float* const frames; /* time, ... */
@ -244,7 +248,7 @@ typedef spEventTimeline EventTimeline;
/**/
typedef struct {
typedef struct spDrawOrderTimeline {
spTimeline super;
int const framesCount;
float* const frames; /* time, ... */
@ -264,7 +268,7 @@ typedef spDrawOrderTimeline DrawOrderTimeline;
/**/
typedef struct {
typedef struct spFFDTimeline {
spCurveTimeline super;
int const framesCount;
float* const frames; /* time, ... */
@ -286,7 +290,7 @@ typedef spFFDTimeline FFDTimeline;
/**/
typedef struct {
typedef struct spIkConstraintTimeline {
spCurveTimeline super;
int const framesCount;
float* const frames; /* time, mix, bendDirection, ... */
@ -306,7 +310,7 @@ typedef spIkConstraintTimeline IkConstraintTimeline;
/**/
typedef struct {
typedef struct spFlipTimeline {
spTimeline super;
int const x;
int const framesCount;

View File

@ -38,7 +38,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spAnimationStateData {
spSkeletonData* const skeletonData;
float defaultMix;
const void* const entries;

View File

@ -38,7 +38,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spAtlasAttachmentLoader {
spAttachmentLoader super;
spAtlas* atlas;
} spAtlasAttachmentLoader;

View File

@ -35,19 +35,16 @@
extern "C" {
#endif
struct spSlot;
typedef enum {
SP_ATTACHMENT_REGION, SP_ATTACHMENT_BOUNDING_BOX, SP_ATTACHMENT_MESH, SP_ATTACHMENT_SKINNED_MESH
} spAttachmentType;
typedef struct spAttachment spAttachment;
struct spAttachment {
typedef struct spAttachment {
const char* const name;
const spAttachmentType type;
const void* const vtable;
};
} spAttachment;
void spAttachment_dispose (spAttachment* self);

View File

@ -38,8 +38,7 @@
extern "C" {
#endif
typedef struct spAttachmentLoader spAttachmentLoader;
struct spAttachmentLoader {
typedef struct spAttachmentLoader {
const char* error1;
const char* error2;
@ -51,7 +50,7 @@ struct spAttachmentLoader {
vtable(0) {
}
#endif
};
} spAttachmentLoader;
void spAttachmentLoader_dispose (spAttachmentLoader* self);

View File

@ -39,12 +39,11 @@
extern "C" {
#endif
typedef struct spBoundingBoxAttachment spBoundingBoxAttachment;
struct spBoundingBoxAttachment {
typedef struct spBoundingBoxAttachment {
spAttachment super;
int verticesCount;
float* vertices;
};
} spBoundingBoxAttachment;
spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name);
void spBoundingBoxAttachment_computeWorldVertices (spBoundingBoxAttachment* self, spBone* bone, float* vertices);

View File

@ -37,13 +37,12 @@
extern "C" {
#endif
typedef struct spEvent spEvent;
struct spEvent {
typedef struct spEvent {
spEventData* const data;
int intValue;
float floatValue;
const char* stringValue;
};
} spEvent;
spEvent* spEvent_create (spEventData* data);
void spEvent_dispose (spEvent* self);

View File

@ -35,13 +35,12 @@
extern "C" {
#endif
typedef struct spEventData spEventData;
struct spEventData {
typedef struct spEventData {
const char* const name;
int intValue;
float floatValue;
const char* stringValue;
};
} spEventData;
spEventData* spEventData_create (const char* name);
void spEventData_dispose (spEventData* self);

View File

@ -40,8 +40,7 @@ extern "C" {
struct spSkeleton;
typedef struct spIkConstraint spIkConstraint;
struct spIkConstraint {
typedef struct spIkConstraint {
spIkConstraintData* const data;
int bonesCount;
@ -50,7 +49,7 @@ struct spIkConstraint {
spBone* target;
int bendDirection;
float mix;
};
} spIkConstraint;
spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton);
void spIkConstraint_dispose (spIkConstraint* self);

View File

@ -37,8 +37,7 @@
extern "C" {
#endif
typedef struct spIkConstraintData spIkConstraintData;
struct spIkConstraintData {
typedef struct spIkConstraintData {
const char* const name;
int bonesCount;
@ -47,7 +46,7 @@ struct spIkConstraintData {
spBoneData* target;
int bendDirection;
float mix;
};
} spIkConstraintData;
spIkConstraintData* spIkConstraintData_create (const char* name);
void spIkConstraintData_dispose (spIkConstraintData* self);

View File

@ -39,8 +39,7 @@
extern "C" {
#endif
typedef struct spMeshAttachment spMeshAttachment;
struct spMeshAttachment {
typedef struct spMeshAttachment {
spAttachment super;
const char* path;
@ -67,7 +66,7 @@ struct spMeshAttachment {
int edgesCount;
int* edges;
float width, height;
};
} spMeshAttachment;
spMeshAttachment* spMeshAttachment_create (const char* name);
void spMeshAttachment_updateUVs (spMeshAttachment* self);

View File

@ -43,8 +43,7 @@ typedef enum {
SP_VERTEX_X1 = 0, SP_VERTEX_Y1, SP_VERTEX_X2, SP_VERTEX_Y2, SP_VERTEX_X3, SP_VERTEX_Y3, SP_VERTEX_X4, SP_VERTEX_Y4
} spVertexIndex;
typedef struct spRegionAttachment spRegionAttachment;
struct spRegionAttachment {
typedef struct spRegionAttachment {
spAttachment super;
const char* path;
float x, y, scaleX, scaleY, rotation, width, height;
@ -57,7 +56,7 @@ struct spRegionAttachment {
float offset[8];
float uvs[8];
};
} spRegionAttachment;
spRegionAttachment* spRegionAttachment_create (const char* name);
void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float v, float u2, float v2, int/*bool*/rotate);

View File

@ -40,8 +40,7 @@
extern "C" {
#endif
typedef struct spSkeleton spSkeleton;
struct spSkeleton {
typedef struct spSkeleton {
spSkeletonData* const data;
int bonesCount;
@ -60,7 +59,7 @@ struct spSkeleton {
float time;
int/*bool*/flipX, flipY;
float x, y;
};
} spSkeleton;
spSkeleton* spSkeleton_create (spSkeletonData* data);
void spSkeleton_dispose (spSkeleton* self);

View File

@ -38,7 +38,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spPolygon {
float* const vertices;
int count;
int capacity;
@ -60,7 +60,7 @@ typedef spPolygon Polygon;
/**/
typedef struct {
typedef struct spSkeletonBounds {
int count;
spBoundingBoxAttachment** boundingBoxes;
spPolygon** polygons;

View File

@ -42,7 +42,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spSkeletonData {
const char* version;
const char* hash;
float width, height;

View File

@ -41,7 +41,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spSkeletonJson {
float scale;
spAttachmentLoader* attachmentLoader;
const char* const error;

View File

@ -39,7 +39,7 @@ extern "C" {
struct spSkeleton;
typedef struct {
typedef struct spSkin {
const char* const name;
} spSkin;

View File

@ -38,8 +38,7 @@
extern "C" {
#endif
typedef struct spSkinnedMeshAttachment spSkinnedMeshAttachment;
struct spSkinnedMeshAttachment {
typedef struct spSkinnedMeshAttachment {
spAttachment super;
const char* path;
@ -70,7 +69,7 @@ struct spSkinnedMeshAttachment {
int edgesCount;
int* edges;
float width, height;
};
} spSkinnedMeshAttachment;
spSkinnedMeshAttachment* spSkinnedMeshAttachment_create (const char* name);
void spSkinnedMeshAttachment_updateUVs (spSkinnedMeshAttachment* self);

View File

@ -37,7 +37,7 @@
extern "C" {
#endif
typedef struct {
typedef struct spSlotData {
const char* const name;
const spBoneData* const boneData;
const char* attachmentName;

View File

@ -124,7 +124,7 @@ char* _readFile (const char* path, int* length);
/**/
typedef struct {
typedef struct _spAnimationState {
spAnimationState super;
spEvent** events;