From fb214ee276092ba593da4ca5a56c0a3a2e23e544 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Tue, 18 Nov 2014 03:40:20 +0100 Subject: [PATCH] Updated spine-c struct definitions to allow for forward declarations. --- spine-c/include/spine/Animation.h | 24 +++++++++++-------- spine-c/include/spine/AnimationStateData.h | 2 +- spine-c/include/spine/AtlasAttachmentLoader.h | 2 +- spine-c/include/spine/Attachment.h | 7 ++---- spine-c/include/spine/AttachmentLoader.h | 5 ++-- spine-c/include/spine/BoundingBoxAttachment.h | 5 ++-- spine-c/include/spine/Event.h | 5 ++-- spine-c/include/spine/EventData.h | 5 ++-- spine-c/include/spine/IkConstraint.h | 5 ++-- spine-c/include/spine/IkConstraintData.h | 5 ++-- spine-c/include/spine/MeshAttachment.h | 5 ++-- spine-c/include/spine/RegionAttachment.h | 5 ++-- spine-c/include/spine/Skeleton.h | 5 ++-- spine-c/include/spine/SkeletonBounds.h | 4 ++-- spine-c/include/spine/SkeletonData.h | 2 +- spine-c/include/spine/SkeletonJson.h | 2 +- spine-c/include/spine/Skin.h | 2 +- spine-c/include/spine/SkinnedMeshAttachment.h | 5 ++-- spine-c/include/spine/SlotData.h | 2 +- spine-c/include/spine/extension.h | 2 +- 20 files changed, 45 insertions(+), 54 deletions(-) diff --git a/spine-c/include/spine/Animation.h b/spine-c/include/spine/Animation.h index 2e9a0d343..69c2c3444 100644 --- a/spine-c/include/spine/Animation.h +++ b/spine-c/include/spine/Animation.h @@ -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; diff --git a/spine-c/include/spine/AnimationStateData.h b/spine-c/include/spine/AnimationStateData.h index ba1c38662..1d8dfd3aa 100644 --- a/spine-c/include/spine/AnimationStateData.h +++ b/spine-c/include/spine/AnimationStateData.h @@ -38,7 +38,7 @@ extern "C" { #endif -typedef struct { +typedef struct spAnimationStateData { spSkeletonData* const skeletonData; float defaultMix; const void* const entries; diff --git a/spine-c/include/spine/AtlasAttachmentLoader.h b/spine-c/include/spine/AtlasAttachmentLoader.h index bd36afb33..cc1ba628e 100644 --- a/spine-c/include/spine/AtlasAttachmentLoader.h +++ b/spine-c/include/spine/AtlasAttachmentLoader.h @@ -38,7 +38,7 @@ extern "C" { #endif -typedef struct { +typedef struct spAtlasAttachmentLoader { spAttachmentLoader super; spAtlas* atlas; } spAtlasAttachmentLoader; diff --git a/spine-c/include/spine/Attachment.h b/spine-c/include/spine/Attachment.h index 9b516b04f..485cf43bb 100644 --- a/spine-c/include/spine/Attachment.h +++ b/spine-c/include/spine/Attachment.h @@ -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); diff --git a/spine-c/include/spine/AttachmentLoader.h b/spine-c/include/spine/AttachmentLoader.h index 4088e0c47..1f0402e02 100644 --- a/spine-c/include/spine/AttachmentLoader.h +++ b/spine-c/include/spine/AttachmentLoader.h @@ -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); diff --git a/spine-c/include/spine/BoundingBoxAttachment.h b/spine-c/include/spine/BoundingBoxAttachment.h index e67db6c77..582e02720 100644 --- a/spine-c/include/spine/BoundingBoxAttachment.h +++ b/spine-c/include/spine/BoundingBoxAttachment.h @@ -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); diff --git a/spine-c/include/spine/Event.h b/spine-c/include/spine/Event.h index dabdd24a0..1ac5c75ba 100644 --- a/spine-c/include/spine/Event.h +++ b/spine-c/include/spine/Event.h @@ -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); diff --git a/spine-c/include/spine/EventData.h b/spine-c/include/spine/EventData.h index bbbb65462..4a5b88325 100644 --- a/spine-c/include/spine/EventData.h +++ b/spine-c/include/spine/EventData.h @@ -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); diff --git a/spine-c/include/spine/IkConstraint.h b/spine-c/include/spine/IkConstraint.h index b5cd89b59..6d5e87453 100644 --- a/spine-c/include/spine/IkConstraint.h +++ b/spine-c/include/spine/IkConstraint.h @@ -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); diff --git a/spine-c/include/spine/IkConstraintData.h b/spine-c/include/spine/IkConstraintData.h index 7cacd369d..9325e6e03 100644 --- a/spine-c/include/spine/IkConstraintData.h +++ b/spine-c/include/spine/IkConstraintData.h @@ -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); diff --git a/spine-c/include/spine/MeshAttachment.h b/spine-c/include/spine/MeshAttachment.h index 5948d84ae..e5eb271d9 100644 --- a/spine-c/include/spine/MeshAttachment.h +++ b/spine-c/include/spine/MeshAttachment.h @@ -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); diff --git a/spine-c/include/spine/RegionAttachment.h b/spine-c/include/spine/RegionAttachment.h index 22def9486..c076eeac4 100644 --- a/spine-c/include/spine/RegionAttachment.h +++ b/spine-c/include/spine/RegionAttachment.h @@ -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); diff --git a/spine-c/include/spine/Skeleton.h b/spine-c/include/spine/Skeleton.h index e6428e27c..518ce0d6c 100644 --- a/spine-c/include/spine/Skeleton.h +++ b/spine-c/include/spine/Skeleton.h @@ -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); diff --git a/spine-c/include/spine/SkeletonBounds.h b/spine-c/include/spine/SkeletonBounds.h index 9767dacf4..c7746d4c1 100644 --- a/spine-c/include/spine/SkeletonBounds.h +++ b/spine-c/include/spine/SkeletonBounds.h @@ -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; diff --git a/spine-c/include/spine/SkeletonData.h b/spine-c/include/spine/SkeletonData.h index 1c9822fe4..4635b3011 100644 --- a/spine-c/include/spine/SkeletonData.h +++ b/spine-c/include/spine/SkeletonData.h @@ -42,7 +42,7 @@ extern "C" { #endif -typedef struct { +typedef struct spSkeletonData { const char* version; const char* hash; float width, height; diff --git a/spine-c/include/spine/SkeletonJson.h b/spine-c/include/spine/SkeletonJson.h index ba2bef522..76c34ce24 100644 --- a/spine-c/include/spine/SkeletonJson.h +++ b/spine-c/include/spine/SkeletonJson.h @@ -41,7 +41,7 @@ extern "C" { #endif -typedef struct { +typedef struct spSkeletonJson { float scale; spAttachmentLoader* attachmentLoader; const char* const error; diff --git a/spine-c/include/spine/Skin.h b/spine-c/include/spine/Skin.h index 22d56fe9c..e8d5a7930 100644 --- a/spine-c/include/spine/Skin.h +++ b/spine-c/include/spine/Skin.h @@ -39,7 +39,7 @@ extern "C" { struct spSkeleton; -typedef struct { +typedef struct spSkin { const char* const name; } spSkin; diff --git a/spine-c/include/spine/SkinnedMeshAttachment.h b/spine-c/include/spine/SkinnedMeshAttachment.h index 9d60565e6..f00ef4417 100644 --- a/spine-c/include/spine/SkinnedMeshAttachment.h +++ b/spine-c/include/spine/SkinnedMeshAttachment.h @@ -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); diff --git a/spine-c/include/spine/SlotData.h b/spine-c/include/spine/SlotData.h index f47132638..d1ef5a50e 100644 --- a/spine-c/include/spine/SlotData.h +++ b/spine-c/include/spine/SlotData.h @@ -37,7 +37,7 @@ extern "C" { #endif -typedef struct { +typedef struct spSlotData { const char* const name; const spBoneData* const boneData; const char* attachmentName; diff --git a/spine-c/include/spine/extension.h b/spine-c/include/spine/extension.h index 281d63212..0d63f650a 100644 --- a/spine-c/include/spine/extension.h +++ b/spine-c/include/spine/extension.h @@ -124,7 +124,7 @@ char* _readFile (const char* path, int* length); /**/ -typedef struct { +typedef struct _spAnimationState { spAnimationState super; spEvent** events;