[c] Remove SPINE_SHORT_NAMES and C++ struct constructors.

This commit is contained in:
badlogic 2021-03-18 11:07:16 +01:00
parent 365b242a46
commit 8798b48e39
38 changed files with 125 additions and 1044 deletions

View File

@ -47,15 +47,6 @@ typedef struct spAnimation {
int timelinesCount;
spTimeline** timelines;
#ifdef __cplusplus
spAnimation() :
name(0),
duration(0),
timelinesCount(0),
timelines(0) {
}
#endif
} spAnimation;
typedef enum {
@ -79,13 +70,6 @@ SP_API void spAnimation_dispose (spAnimation* self);
SP_API void spAnimation_apply (const spAnimation* self, struct spSkeleton* skeleton, float lastTime, float time, int loop,
spEvent** events, int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
#ifdef SPINE_SHORT_NAMES
typedef spAnimation Animation;
#define Animation_create(...) spAnimation_create(__VA_ARGS__)
#define Animation_dispose(...) spAnimation_dispose(__VA_ARGS__)
#define Animation_apply(...) spAnimation_apply(__VA_ARGS__)
#endif
/**/
typedef enum {
@ -109,13 +93,6 @@ typedef enum {
struct spTimeline {
const spTimelineType type;
const void* const vtable;
#ifdef __cplusplus
spTimeline() :
type(SP_TIMELINE_SCALE),
vtable(0) {
}
#endif
};
SP_API void spTimeline_dispose (spTimeline* self);
@ -123,31 +100,11 @@ SP_API void spTimeline_apply (const spTimeline* self, struct spSkeleton* skeleto
int* eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
SP_API int spTimeline_getPropertyId (const spTimeline* self);
#ifdef SPINE_SHORT_NAMES
typedef spTimeline Timeline;
#define TIMELINE_SCALE SP_TIMELINE_SCALE
#define TIMELINE_ROTATE SP_TIMELINE_ROTATE
#define TIMELINE_TRANSLATE SP_TIMELINE_TRANSLATE
#define TIMELINE_COLOR SP_TIMELINE_COLOR
#define TIMELINE_ATTACHMENT SP_TIMELINE_ATTACHMENT
#define TIMELINE_EVENT SP_TIMELINE_EVENT
#define TIMELINE_DRAWORDER SP_TIMELINE_DRAWORDER
#define Timeline_dispose(...) spTimeline_dispose(__VA_ARGS__)
#define Timeline_apply(...) spTimeline_apply(__VA_ARGS__)
#endif
/**/
typedef struct spCurveTimeline {
spTimeline super;
float* curves; /* type, x, y, ... */
#ifdef __cplusplus
spCurveTimeline() :
super(),
curves(0) {
}
#endif
} spCurveTimeline;
SP_API void spCurveTimeline_setLinear (spCurveTimeline* self, int frameIndex);
@ -159,14 +116,6 @@ SP_API void spCurveTimeline_setStepped (spCurveTimeline* self, int frameIndex);
SP_API void spCurveTimeline_setCurve (spCurveTimeline* self, int frameIndex, float cx1, float cy1, float cx2, float cy2);
SP_API float spCurveTimeline_getCurvePercent (const spCurveTimeline* self, int frameIndex, float percent);
#ifdef SPINE_SHORT_NAMES
typedef spCurveTimeline CurveTimeline;
#define CurveTimeline_setLinear(...) spCurveTimeline_setLinear(__VA_ARGS__)
#define CurveTimeline_setStepped(...) spCurveTimeline_setStepped(__VA_ARGS__)
#define CurveTimeline_setCurve(...) spCurveTimeline_setCurve(__VA_ARGS__)
#define CurveTimeline_getCurvePercent(...) spCurveTimeline_getCurvePercent(__VA_ARGS__)
#endif
/**/
typedef struct spBaseTimeline {
@ -174,15 +123,6 @@ typedef struct spBaseTimeline {
int const framesCount;
float* const frames; /* time, angle, ... for rotate. time, x, y, ... for translate and scale. */
int boneIndex;
#ifdef __cplusplus
spBaseTimeline() :
super(),
framesCount(0),
frames(0),
boneIndex(0) {
}
#endif
} spBaseTimeline;
/**/
@ -197,12 +137,6 @@ SP_API spRotateTimeline* spRotateTimeline_create (int framesCount);
SP_API void spRotateTimeline_setFrame (spRotateTimeline* self, int frameIndex, float time, float angle);
#ifdef SPINE_SHORT_NAMES
typedef spRotateTimeline RotateTimeline;
#define RotateTimeline_create(...) spRotateTimeline_create(__VA_ARGS__)
#define RotateTimeline_setFrame(...) spRotateTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int TRANSLATE_ENTRIES = 3;
@ -213,12 +147,6 @@ SP_API spTranslateTimeline* spTranslateTimeline_create (int framesCount);
SP_API void spTranslateTimeline_setFrame (spTranslateTimeline* self, int frameIndex, float time, float x, float y);
#ifdef SPINE_SHORT_NAMES
typedef spTranslateTimeline TranslateTimeline;
#define TranslateTimeline_create(...) spTranslateTimeline_create(__VA_ARGS__)
#define TranslateTimeline_setFrame(...) spTranslateTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spBaseTimeline spScaleTimeline;
@ -227,12 +155,6 @@ SP_API spScaleTimeline* spScaleTimeline_create (int framesCount);
SP_API void spScaleTimeline_setFrame (spScaleTimeline* self, int frameIndex, float time, float x, float y);
#ifdef SPINE_SHORT_NAMES
typedef spScaleTimeline ScaleTimeline;
#define ScaleTimeline_create(...) spScaleTimeline_create(__VA_ARGS__)
#define ScaleTimeline_setFrame(...) spScaleTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spBaseTimeline spShearTimeline;
@ -241,12 +163,6 @@ SP_API spShearTimeline* spShearTimeline_create (int framesCount);
SP_API void spShearTimeline_setFrame (spShearTimeline* self, int frameIndex, float time, float x, float y);
#ifdef SPINE_SHORT_NAMES
typedef spShearTimeline ShearTimeline;
#define ShearTimeline_create(...) spShearTimeline_create(__VA_ARGS__)
#define ShearTimeline_setFrame(...) spShearTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int COLOR_ENTRIES = 5;
@ -256,27 +172,12 @@ typedef struct spColorTimeline {
int const framesCount;
float* const frames; /* time, r, g, b, a, ... */
int slotIndex;
#ifdef __cplusplus
spColorTimeline() :
super(),
framesCount(0),
frames(0),
slotIndex(0) {
}
#endif
} spColorTimeline;
SP_API spColorTimeline* spColorTimeline_create (int framesCount);
SP_API void spColorTimeline_setFrame (spColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a);
#ifdef SPINE_SHORT_NAMES
typedef spColorTimeline ColorTimeline;
#define ColorTimeline_create(...) spColorTimeline_create(__VA_ARGS__)
#define ColorTimeline_setFrame(...) spColorTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int TWOCOLOR_ENTRIES = 8;
@ -286,27 +187,12 @@ typedef struct spTwoColorTimeline {
int const framesCount;
float* const frames; /* time, r, g, b, a, ... */
int slotIndex;
#ifdef __cplusplus
spTwoColorTimeline() :
super(),
framesCount(0),
frames(0),
slotIndex(0) {
}
#endif
} spTwoColorTimeline;
SP_API spTwoColorTimeline* spTwoColorTimeline_create (int framesCount);
SP_API void spTwoColorTimeline_setFrame (spTwoColorTimeline* self, int frameIndex, float time, float r, float g, float b, float a, float r2, float g2, float b2);
#ifdef SPINE_SHORT_NAMES
typedef spTwoColorTimeline TwoColorTimeline;
#define TwoColorTimeline_create(...) spTwoColorTimeline_create(__VA_ARGS__)
#define TwoColorTimeline_setFrame(...) spTwoColorTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spAttachmentTimeline {
@ -315,16 +201,6 @@ typedef struct spAttachmentTimeline {
float* const frames; /* time, ... */
int slotIndex;
const char** const attachmentNames;
#ifdef __cplusplus
spAttachmentTimeline() :
super(),
framesCount(0),
frames(0),
slotIndex(0),
attachmentNames(0) {
}
#endif
} spAttachmentTimeline;
SP_API spAttachmentTimeline* spAttachmentTimeline_create (int framesCount);
@ -332,12 +208,6 @@ SP_API spAttachmentTimeline* spAttachmentTimeline_create (int framesCount);
/* @param attachmentName May be 0. */
SP_API void spAttachmentTimeline_setFrame (spAttachmentTimeline* self, int frameIndex, float time, const char* attachmentName);
#ifdef SPINE_SHORT_NAMES
typedef spAttachmentTimeline AttachmentTimeline;
#define AttachmentTimeline_create(...) spAttachmentTimeline_create(__VA_ARGS__)
#define AttachmentTimeline_setFrame(...) spAttachmentTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spEventTimeline {
@ -345,27 +215,12 @@ typedef struct spEventTimeline {
int const framesCount;
float* const frames; /* time, ... */
spEvent** const events;
#ifdef __cplusplus
spEventTimeline() :
super(),
framesCount(0),
frames(0),
events(0) {
}
#endif
} spEventTimeline;
SP_API spEventTimeline* spEventTimeline_create (int framesCount);
SP_API void spEventTimeline_setFrame (spEventTimeline* self, int frameIndex, spEvent* event);
#ifdef SPINE_SHORT_NAMES
typedef spEventTimeline EventTimeline;
#define EventTimeline_create(...) spEventTimeline_create(__VA_ARGS__)
#define EventTimeline_setFrame(...) spEventTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spDrawOrderTimeline {
@ -374,28 +229,12 @@ typedef struct spDrawOrderTimeline {
float* const frames; /* time, ... */
const int** const drawOrders;
int const slotsCount;
#ifdef __cplusplus
spDrawOrderTimeline() :
super(),
framesCount(0),
frames(0),
drawOrders(0),
slotsCount(0) {
}
#endif
} spDrawOrderTimeline;
SP_API spDrawOrderTimeline* spDrawOrderTimeline_create (int framesCount, int slotsCount);
SP_API void spDrawOrderTimeline_setFrame (spDrawOrderTimeline* self, int frameIndex, float time, const int* drawOrder);
#ifdef SPINE_SHORT_NAMES
typedef spDrawOrderTimeline DrawOrderTimeline;
#define DrawOrderTimeline_create(...) spDrawOrderTimeline_create(__VA_ARGS__)
#define DrawOrderTimeline_setFrame(...) spDrawOrderTimeline_setFrame(__VA_ARGS__)
#endif
/**/
typedef struct spDeformTimeline {
@ -406,29 +245,12 @@ typedef struct spDeformTimeline {
const float** const frameVertices;
int slotIndex;
spAttachment* attachment;
#ifdef __cplusplus
spDeformTimeline() :
super(),
framesCount(0),
frames(0),
frameVerticesCount(0),
frameVertices(0),
slotIndex(0) {
}
#endif
} spDeformTimeline;
SP_API spDeformTimeline* spDeformTimeline_create (int framesCount, int frameVerticesCount);
SP_API void spDeformTimeline_setFrame (spDeformTimeline* self, int frameIndex, float time, float* vertices);
#ifdef SPINE_SHORT_NAMES
typedef spDeformTimeline DeformTimeline;
#define DeformTimeline_create(...) spDeformTimeline_create(__VA_ARGS__)
#define DeformTimeline_setFrame(...) spDeformTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int IKCONSTRAINT_ENTRIES = 6;
@ -438,27 +260,12 @@ typedef struct spIkConstraintTimeline {
int const framesCount;
float* const frames; /* time, mix, bendDirection, ... */
int ikConstraintIndex;
#ifdef __cplusplus
spIkConstraintTimeline() :
super(),
framesCount(0),
frames(0),
ikConstraintIndex(0) {
}
#endif
} spIkConstraintTimeline;
SP_API spIkConstraintTimeline* spIkConstraintTimeline_create (int framesCount);
SP_API void spIkConstraintTimeline_setFrame (spIkConstraintTimeline* self, int frameIndex, float time, float mix, float softness, int bendDirection, int /*boolean*/ compress, int /**boolean**/ stretch);
#ifdef SPINE_SHORT_NAMES
typedef spIkConstraintTimeline IkConstraintTimeline;
#define IkConstraintTimeline_create(...) spIkConstraintTimeline_create(__VA_ARGS__)
#define IkConstraintTimeline_setFrame(...) spIkConstraintTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int TRANSFORMCONSTRAINT_ENTRIES = 5;
@ -468,27 +275,12 @@ typedef struct spTransformConstraintTimeline {
int const framesCount;
float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */
int transformConstraintIndex;
#ifdef __cplusplus
spTransformConstraintTimeline() :
super(),
framesCount(0),
frames(0),
transformConstraintIndex(0) {
}
#endif
} spTransformConstraintTimeline;
SP_API spTransformConstraintTimeline* spTransformConstraintTimeline_create (int framesCount);
SP_API void spTransformConstraintTimeline_setFrame (spTransformConstraintTimeline* self, int frameIndex, float time, float rotateMix, float translateMix, float scaleMix, float shearMix);
#ifdef SPINE_SHORT_NAMES
typedef spTransformConstraintTimeline TransformConstraintTimeline;
#define TransformConstraintTimeline_create(...) spTransformConstraintTimeline_create(__VA_ARGS__)
#define TransformConstraintTimeline_setFrame(...) spTransformConstraintTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int PATHCONSTRAINTPOSITION_ENTRIES = 2;
@ -498,27 +290,12 @@ typedef struct spPathConstraintPositionTimeline {
int const framesCount;
float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */
int pathConstraintIndex;
#ifdef __cplusplus
spPathConstraintPositionTimeline() :
super(),
framesCount(0),
frames(0),
pathConstraintIndex(0) {
}
#endif
} spPathConstraintPositionTimeline;
SP_API spPathConstraintPositionTimeline* spPathConstraintPositionTimeline_create (int framesCount);
SP_API void spPathConstraintPositionTimeline_setFrame (spPathConstraintPositionTimeline* self, int frameIndex, float time, float value);
#ifdef SPINE_SHORT_NAMES
typedef spPathConstraintPositionTimeline PathConstraintPositionTimeline;
#define PathConstraintPositionTimeline_create(...) spPathConstraintPositionTimeline_create(__VA_ARGS__)
#define PathConstraintPositionTimeline_setFrame(...) spPathConstraintPositionTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int PATHCONSTRAINTSPACING_ENTRIES = 2;
@ -528,27 +305,12 @@ typedef struct spPathConstraintSpacingTimeline {
int const framesCount;
float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */
int pathConstraintIndex;
#ifdef __cplusplus
spPathConstraintSpacingTimeline() :
super(),
framesCount(0),
frames(0),
pathConstraintIndex(0) {
}
#endif
} spPathConstraintSpacingTimeline;
SP_API spPathConstraintSpacingTimeline* spPathConstraintSpacingTimeline_create (int framesCount);
SP_API void spPathConstraintSpacingTimeline_setFrame (spPathConstraintSpacingTimeline* self, int frameIndex, float time, float value);
#ifdef SPINE_SHORT_NAMES
typedef spPathConstraintSpacingTimeline PathConstraintSpacingTimeline;
#define PathConstraintSpacingTimeline_create(...) spPathConstraintSpacingTimeline_create(__VA_ARGS__)
#define PathConstraintSpacingTimeline_setFrame(...) spPathConstraintSpacingTimeline_setFrame(__VA_ARGS__)
#endif
/**/
static const int PATHCONSTRAINTMIX_ENTRIES = 3;
@ -558,27 +320,12 @@ typedef struct spPathConstraintMixTimeline {
int const framesCount;
float* const frames; /* time, rotate mix, translate mix, scale mix, shear mix, ... */
int pathConstraintIndex;
#ifdef __cplusplus
spPathConstraintMixTimeline() :
super(),
framesCount(0),
frames(0),
pathConstraintIndex(0) {
}
#endif
} spPathConstraintMixTimeline;
SP_API spPathConstraintMixTimeline* spPathConstraintMixTimeline_create (int framesCount);
SP_API void spPathConstraintMixTimeline_setFrame (spPathConstraintMixTimeline* self, int frameIndex, float time, float rotateMix, float translateMix);
#ifdef SPINE_SHORT_NAMES
typedef spPathConstraintMixTimeline PathConstraintMixTimeline;
#define PathConstraintMixTimeline_create(...) spPathConstraintMixTimeline_create(__VA_ARGS__)
#define PathConstraintMixTimeline_setFrame(...) spPathConstraintMixTimeline_setFrame(__VA_ARGS__)
#endif
/**/
#ifdef __cplusplus

View File

@ -71,27 +71,6 @@ struct spTrackEntry {
int timelinesRotationCount;
void* rendererObject;
void* userData;
#ifdef __cplusplus
spTrackEntry() :
animation(0),
next(0), mixingFrom(0), mixingTo(0),
listener(0),
trackIndex(0),
loop(0),
holdPrevious(0),
eventThreshold(0), attachmentThreshold(0), drawOrderThreshold(0),
animationStart(0), animationEnd(0), animationLast(0), nextAnimationLast(0),
delay(0), trackTime(0), trackLast(0), nextTrackLast(0), trackEnd(0), timeScale(0),
alpha(0), mixTime(0), mixDuration(0), interruptAlpha(0), totalAlpha(0),
mixBlend(SP_MIX_BLEND_REPLACE),
timelineMode(0),
timelineHoldMix(0),
timelinesRotation(0),
timelinesRotationCount(0),
rendererObject(0), userData(0) {
}
#endif
};
struct spAnimationState {
@ -108,19 +87,6 @@ struct spAnimationState {
void* userData;
int unkeyedState;
#ifdef __cplusplus
spAnimationState() :
data(0),
tracksCount(0),
tracks(0),
listener(0),
timeScale(0),
rendererObject(0),
userData(0),
unkeyedState(0) {
}
#endif
};
/* @param data May be 0 for no mixing. */
@ -157,34 +123,6 @@ SP_API float spTrackEntry_getAnimationTime (spTrackEntry* entry);
/** Use this to dispose static memory before your app exits to appease your memory leak detector*/
SP_API void spAnimationState_disposeStatics ();
#ifdef SPINE_SHORT_NAMES
typedef spEventType EventType;
#define ANIMATION_START SP_ANIMATION_START
#define ANIMATION_INTERRUPT SP_ANIMATION_INTERRUPT
#define ANIMATION_END SP_ANIMATION_END
#define ANIMATION_COMPLETE SP_ANIMATION_COMPLETE
#define ANIMATION_DISPOSE SP_ANIMATION_DISPOSE
#define ANIMATION_EVENT SP_ANIMATION_EVENT
typedef spAnimationStateListener AnimationStateListener;
typedef spTrackEntry TrackEntry;
typedef spAnimationState AnimationState;
#define AnimationState_create(...) spAnimationState_create(__VA_ARGS__)
#define AnimationState_dispose(...) spAnimationState_dispose(__VA_ARGS__)
#define AnimationState_update(...) spAnimationState_update(__VA_ARGS__)
#define AnimationState_apply(...) spAnimationState_apply(__VA_ARGS__)
#define AnimationState_clearTracks(...) spAnimationState_clearTracks(__VA_ARGS__)
#define AnimationState_clearTrack(...) spAnimationState_clearTrack(__VA_ARGS__)
#define AnimationState_setAnimationByName(...) spAnimationState_setAnimationByName(__VA_ARGS__)
#define AnimationState_setAnimation(...) spAnimationState_setAnimation(__VA_ARGS__)
#define AnimationState_addAnimationByName(...) spAnimationState_addAnimationByName(__VA_ARGS__)
#define AnimationState_addAnimation(...) spAnimationState_addAnimation(__VA_ARGS__)
#define AnimationState_setEmptyAnimation(...) spAnimationState_setEmptyAnimation(__VA_ARGS__)
#define AnimationState_addEmptyAnimation(...) spAnimationState_addEmptyAnimation(__VA_ARGS__)
#define AnimationState_setEmptyAnimations(...) spAnimationState_setEmptyAnimations(__VA_ARGS__)
#define AnimationState_getCurrent(...) spAnimationState_getCurrent(__VA_ARGS__)
#define AnimationState_clearListenerNotifications(...) spAnimationState_clearListenerNotifications(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -42,14 +42,6 @@ typedef struct spAnimationStateData {
spSkeletonData* const skeletonData;
float defaultMix;
const void* const entries;
#ifdef __cplusplus
spAnimationStateData() :
skeletonData(0),
defaultMix(0),
entries(0) {
}
#endif
} spAnimationStateData;
SP_API spAnimationStateData* spAnimationStateData_create (spSkeletonData* skeletonData);
@ -60,15 +52,6 @@ SP_API void spAnimationStateData_setMix (spAnimationStateData* self, spAnimation
/* Returns 0 if there is no mixing between the animations. */
SP_API float spAnimationStateData_getMix (spAnimationStateData* self, spAnimation* from, spAnimation* to);
#ifdef SPINE_SHORT_NAMES
typedef spAnimationStateData AnimationStateData;
#define AnimationStateData_create(...) spAnimationStateData_create(__VA_ARGS__)
#define AnimationStateData_dispose(...) spAnimationStateData_dispose(__VA_ARGS__)
#define AnimationStateData_setMixByName(...) spAnimationStateData_setMixByName(__VA_ARGS__)
#define AnimationStateData_setMix(...) spAnimationStateData_setMix(__VA_ARGS__)
#define AnimationStateData_getMix(...) spAnimationStateData_getMix(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -83,34 +83,6 @@ struct spAtlasPage {
SP_API spAtlasPage* spAtlasPage_create (spAtlas* atlas, const char* name);
SP_API void spAtlasPage_dispose (spAtlasPage* self);
#ifdef SPINE_SHORT_NAMES
typedef spAtlasFormat AtlasFormat;
#define ATLAS_UNKNOWN_FORMAT SP_ATLAS_UNKNOWN_FORMAT
#define ATLAS_ALPHA SP_ATLAS_ALPHA
#define ATLAS_INTENSITY SP_ATLAS_INTENSITY
#define ATLAS_LUMINANCE_ALPHA SP_ATLAS_LUMINANCE_ALPHA
#define ATLAS_RGB565 SP_ATLAS_RGB565
#define ATLAS_RGBA4444 SP_ATLAS_RGBA4444
#define ATLAS_RGB888 SP_ATLAS_RGB888
#define ATLAS_RGBA8888 SP_ATLAS_RGBA8888
typedef spAtlasFilter AtlasFilter;
#define ATLAS_UNKNOWN_FILTER SP_ATLAS_UNKNOWN_FILTER
#define ATLAS_NEAREST SP_ATLAS_NEAREST
#define ATLAS_LINEAR SP_ATLAS_LINEAR
#define ATLAS_MIPMAP SP_ATLAS_MIPMAP
#define ATLAS_MIPMAP_NEAREST_NEAREST SP_ATLAS_MIPMAP_NEAREST_NEAREST
#define ATLAS_MIPMAP_LINEAR_NEAREST SP_ATLAS_MIPMAP_LINEAR_NEAREST
#define ATLAS_MIPMAP_NEAREST_LINEAR SP_ATLAS_MIPMAP_NEAREST_LINEAR
#define ATLAS_MIPMAP_LINEAR_LINEAR SP_ATLAS_MIPMAP_LINEAR_LINEAR
typedef spAtlasWrap AtlasWrap;
#define ATLAS_MIRROREDREPEAT SP_ATLAS_MIRROREDREPEAT
#define ATLAS_CLAMPTOEDGE SP_ATLAS_CLAMPTOEDGE
#define ATLAS_REPEAT SP_ATLAS_REPEAT
typedef spAtlasPage AtlasPage;
#define AtlasPage_create(...) spAtlasPage_create(__VA_ARGS__)
#define AtlasPage_dispose(...) spAtlasPage_dispose(__VA_ARGS__)
#endif
/**/
typedef struct spAtlasRegion spAtlasRegion;
@ -135,12 +107,6 @@ struct spAtlasRegion {
SP_API spAtlasRegion* spAtlasRegion_create ();
SP_API void spAtlasRegion_dispose (spAtlasRegion* self);
#ifdef SPINE_SHORT_NAMES
typedef spAtlasRegion AtlasRegion;
#define AtlasRegion_create(...) spAtlasRegion_create(__VA_ARGS__)
#define AtlasRegion_dispose(...) spAtlasRegion_dispose(__VA_ARGS__)
#endif
/**/
struct spAtlas {
@ -159,14 +125,6 @@ SP_API void spAtlas_dispose (spAtlas* atlas);
/* Returns 0 if the region was not found. */
SP_API spAtlasRegion* spAtlas_findRegion (const spAtlas* self, const char* name);
#ifdef SPINE_SHORT_NAMES
typedef spAtlas Atlas;
#define Atlas_create(...) spAtlas_create(__VA_ARGS__)
#define Atlas_createFromFile(...) spAtlas_createFromFile(__VA_ARGS__)
#define Atlas_dispose(...) spAtlas_dispose(__VA_ARGS__)
#define Atlas_findRegion(...) spAtlas_findRegion(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -45,11 +45,6 @@ typedef struct spAtlasAttachmentLoader {
SP_API spAtlasAttachmentLoader* spAtlasAttachmentLoader_create (spAtlas* atlas);
#ifdef SPINE_SHORT_NAMES
typedef spAtlasAttachmentLoader AtlasAttachmentLoader;
#define AtlasAttachmentLoader_create(...) spAtlasAttachmentLoader_create(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -54,31 +54,12 @@ typedef struct spAttachment {
const void* const vtable;
int refCount;
struct spAttachmentLoader* attachmentLoader;
#ifdef __cplusplus
spAttachment() :
name(0),
type(SP_ATTACHMENT_REGION),
vtable(0),
refCount(0) {
}
#endif
} spAttachment;
void spAttachment_dispose (spAttachment* self);
spAttachment* spAttachment_copy (spAttachment* self);
#ifdef SPINE_SHORT_NAMES
typedef spAttachmentType AttachmentType;
#define ATTACHMENT_REGION SP_ATTACHMENT_REGION
#define ATTACHMENT_BOUNDING_BOX SP_ATTACHMENT_BOUNDING_BOX
#define ATTACHMENT_MESH SP_ATTACHMENT_MESH
#define ATTACHMENT_LINKED_MESH SP_ATTACHMENT_LINKED_MESH
typedef spAttachment Attachment;
#define Attachment_dispose(...) spAttachment_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -43,13 +43,6 @@ typedef struct spAttachmentLoader {
const char* error2;
const void* const vtable;
#ifdef __cplusplus
spAttachmentLoader () :
error1(0),
error2(0),
vtable(0) {
}
#endif
} spAttachmentLoader;
SP_API void spAttachmentLoader_dispose (spAttachmentLoader* self);
@ -63,14 +56,6 @@ SP_API void spAttachmentLoader_configureAttachment (spAttachmentLoader* self, sp
/* Called just before the attachment is disposed. This can release allocations made in spAttachmentLoader_configureAttachment. */
SP_API void spAttachmentLoader_disposeAttachment (spAttachmentLoader* self, spAttachment* attachment);
#ifdef SPINE_SHORT_NAMES
typedef spAttachmentLoader AttachmentLoader;
#define AttachmentLoader_dispose(...) spAttachmentLoader_dispose(__VA_ARGS__)
#define AttachmentLoader_createAttachment(...) spAttachmentLoader_createAttachment(__VA_ARGS__)
#define AttachmentLoader_configureAttachment(...) spAttachmentLoader_configureAttachment(__VA_ARGS__)
#define AttachmentLoader_disposeAttachment(...) spAttachmentLoader_disposeAttachment(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -99,27 +99,6 @@ SP_API float spBone_worldToLocalRotation (spBone* self, float worldRotation);
SP_API float spBone_localToWorldRotation (spBone* self, float localRotation);
SP_API void spBone_rotateWorld (spBone* self, float degrees);
#ifdef SPINE_SHORT_NAMES
typedef spBone Bone;
#define Bone_setYDown(...) spBone_setYDown(__VA_ARGS__)
#define Bone_isYDown() spBone_isYDown()
#define Bone_create(...) spBone_create(__VA_ARGS__)
#define Bone_dispose(...) spBone_dispose(__VA_ARGS__)
#define Bone_setToSetupPose(...) spBone_setToSetupPose(__VA_ARGS__)
#define Bone_updateWorldTransform(...) spBone_updateWorldTransform(__VA_ARGS__)
#define Bone_updateWorldTransformWith(...) spBone_updateWorldTransformWith(__VA_ARGS__)
#define Bone_getWorldRotationX(...) spBone_getWorldRotationX(__VA_ARGS__)
#define Bone_getWorldRotationY(...) spBone_getWorldRotationY(__VA_ARGS__)
#define Bone_getWorldScaleX(...) spBone_getWorldScaleX(__VA_ARGS__)
#define Bone_getWorldScaleY(...) spBone_getWorldScaleY(__VA_ARGS__)
#define Bone_updateAppliedTransform(...) spBone_updateAppliedTransform(__VA_ARGS__)
#define Bone_worldToLocal(...) spBone_worldToLocal(__VA_ARGS__)
#define Bone_localToWorld(...) spBone_localToWorld(__VA_ARGS__)
#define Bone_worldToLocalRotation(...) spBone_worldToLocalRotation(__VA_ARGS__)
#define Bone_localToWorldRotation(...) spBone_localToWorldRotation(__VA_ARGS__)
#define Bone_rotateWorld(...) spBone_rotateWorld(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -53,32 +53,11 @@ struct spBoneData {
float x, y, rotation, scaleX, scaleY, shearX, shearY;
spTransformMode transformMode;
int/*bool*/ skinRequired;
#ifdef __cplusplus
spBoneData() :
index(0),
name(0),
parent(0),
length(0),
x(0), y(0),
rotation(0),
scaleX(0), scaleY(0),
shearX(0), shearY(0),
transformMode(SP_TRANSFORMMODE_NORMAL),
skinRequired(0) {
}
#endif
};
SP_API spBoneData* spBoneData_create (int index, const char* name, spBoneData* parent);
SP_API void spBoneData_dispose (spBoneData* self);
#ifdef SPINE_SHORT_NAMES
typedef spBoneData BoneData;
#define BoneData_create(...) spBoneData_create(__VA_ARGS__)
#define BoneData_dispose(...) spBoneData_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -46,11 +46,6 @@ typedef struct spBoundingBoxAttachment {
SP_API spBoundingBoxAttachment* spBoundingBoxAttachment_create (const char* name);
#ifdef SPINE_SHORT_NAMES
typedef spBoundingBoxAttachment BoundingBoxAttachment;
#define BoundingBoxAttachment_create(...) spBoundingBoxAttachment_create(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -48,11 +48,6 @@ typedef struct spClippingAttachment {
SP_API void _spClippingAttachment_dispose(spAttachment* self);
SP_API spClippingAttachment* spClippingAttachment_create (const char* name);
#ifdef SPINE_SHORT_NAMES
typedef spClippingAttachment ClippingAttachment;
#define ClippingAttachment_create(...) spClippingAttachment_create(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -38,16 +38,6 @@ extern "C" {
typedef struct spColor {
float r, g, b, a;
#ifdef __cplusplus
spColor() :
r(0), g(0), b(0), a(0) {
}
bool operator==(const spColor& rhs) {
return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a;
}
#endif
} spColor;
/* @param attachmentName May be 0 for no setup pose attachment. */
@ -59,17 +49,6 @@ SP_API void spColor_addFloats(spColor* color, float r, float g, float b, float a
SP_API void spColor_addColor(spColor* color, spColor* otherColor);
SP_API void spColor_clamp(spColor* color);
#ifdef SPINE_SHORT_NAMES
typedef spColor color;
#define Color_create() spColor_create()
#define Color_dispose(...) spColor_dispose(__VA_ARGS__)
#define Color_setFromFloats(...) spColor_setFromFloats(__VA_ARGS__)
#define Color_setFromColor(...) spColor_setFromColor(__VA_ARGS__)
#define Color_addColor(...) spColor_addColor(__VA_ARGS__)
#define Color_addFloats(...) spColor_addFloats(__VA_ARGS__)
#define Color_clamp(...) spColor_clamp(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -62,12 +62,6 @@ typedef struct spEvent {
SP_API spEvent* spEvent_create (float time, spEventData* data);
SP_API void spEvent_dispose (spEvent* self);
#ifdef SPINE_SHORT_NAMES
typedef spEvent Event;
#define Event_create(...) spEvent_create(__VA_ARGS__)
#define Event_dispose(...) spEvent_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -44,29 +44,11 @@ typedef struct spEventData {
const char* audioPath;
float volume;
float balance;
#ifdef __cplusplus
spEventData() :
name(0),
intValue(0),
floatValue(0),
stringValue(0),
audioPath(0),
volume(0),
balance(0) {
}
#endif
} spEventData;
SP_API spEventData* spEventData_create (const char* name);
SP_API void spEventData_dispose (spEventData* self);
#ifdef SPINE_SHORT_NAMES
typedef spEventData EventData;
#define EventData_create(...) spEventData_create(__VA_ARGS__)
#define EventData_dispose(...) spEventData_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -54,20 +54,6 @@ typedef struct spIkConstraint {
float softness;
int /*boolean*/ active;
#ifdef __cplusplus
spIkConstraint() :
data(0),
bonesCount(0),
bones(0),
target(0),
bendDirection(0),
stretch(0),
mix(0),
softness(0),
active(0) {
}
#endif
} spIkConstraint;
SP_API spIkConstraint* spIkConstraint_create (spIkConstraintData* data, const struct spSkeleton* skeleton);
@ -78,15 +64,6 @@ SP_API void spIkConstraint_apply (spIkConstraint* self);
SP_API void spIkConstraint_apply1 (spBone* bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch, int /*boolean*/ uniform, float alpha);
SP_API void spIkConstraint_apply2 (spBone* parent, spBone* child, float targetX, float targetY, int bendDirection, int /*boolean*/ stretch, float softness, float alpha);
#ifdef SPINE_SHORT_NAMES
typedef spIkConstraint IkConstraint;
#define IkConstraint_create(...) spIkConstraint_create(__VA_ARGS__)
#define IkConstraint_dispose(...) spIkConstraint_dispose(__VA_ARGS__)
#define IkConstraint_apply(...) spIkConstraint_apply(__VA_ARGS__)
#define IkConstraint_apply1(...) spIkConstraint_apply1(__VA_ARGS__)
#define IkConstraint_apply2(...) spIkConstraint_apply2(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -51,34 +51,11 @@ typedef struct spIkConstraintData {
int /*boolean*/ uniform;
float mix;
float softness;
#ifdef __cplusplus
spIkConstraintData() :
name(0),
order(0),
skinRequired(0),
bonesCount(0),
bones(0),
target(0),
bendDirection(0),
compress(0),
stretch(0),
uniform(0),
mix(0),
softness(0) {
}
#endif
} spIkConstraintData;
SP_API spIkConstraintData* spIkConstraintData_create (const char* name);
SP_API void spIkConstraintData_dispose (spIkConstraintData* self);
#ifdef SPINE_SHORT_NAMES
typedef spIkConstraintData IkConstraintData;
#define IkConstraintData_create(...) spIkConstraintData_create(__VA_ARGS__)
#define IkConstraintData_dispose(...) spIkConstraintData_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -77,13 +77,6 @@ SP_API void spMeshAttachment_updateUVs (spMeshAttachment* self);
SP_API void spMeshAttachment_setParentMesh (spMeshAttachment* self, spMeshAttachment* parentMesh);
SP_API spMeshAttachment* spMeshAttachment_newLinkedMesh (spMeshAttachment* self);
#ifdef SPINE_SHORT_NAMES
typedef spMeshAttachment MeshAttachment;
#define MeshAttachment_create(...) spMeshAttachment_create(__VA_ARGS__)
#define MeshAttachment_updateUVs(...) spMeshAttachment_updateUVs(__VA_ARGS__)
#define MeshAttachment_setParentMesh(...) spMeshAttachment_setParentMesh(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -49,12 +49,6 @@ typedef struct spPathAttachment {
SP_API spPathAttachment* spPathAttachment_create (const char* name);
#ifdef SPINE_SHORT_NAMES
typedef spPathAttachment PathAttachment;
#define PathAttachment_create(...) spPathAttachment_create(__VA_ARGS__)
#define PathAttachment_computeWorldVertices(...) spPathAttachment_computeWorldVertices(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -67,30 +67,6 @@ typedef struct spPathConstraint {
float segments[10];
int /*boolean*/ active;
#ifdef __cplusplus
spPathConstraint() :
data(0),
bonesCount(0),
bones(0),
target(0),
position(0),
spacing(0),
rotateMix(0),
translateMix(0),
spacesCount(0),
spaces(0),
positionsCount(0),
positions(0),
worldCount(0),
world(0),
curvesCount(0),
curves(0),
lengthsCount(0),
lengths(0),
active(0) {
}
#endif
} spPathConstraint;
#define SP_PATHCONSTRAINT_
@ -101,13 +77,6 @@ SP_API void spPathConstraint_dispose (spPathConstraint* self);
SP_API void spPathConstraint_apply (spPathConstraint* self);
SP_API float* spPathConstraint_computeWorldPositions(spPathConstraint* self, spPathAttachment* path, int spacesCount, int/*bool*/ tangents, int/*bool*/percentPosition, int/**/percentSpacing);
#ifdef SPINE_SHORT_NAMES
typedef spPathConstraint PathConstraint;
#define PathConstraint_create(...) spPathConstraint_create(__VA_ARGS__)
#define PathConstraint_dispose(...) spPathConstraint_dispose(__VA_ARGS__)
#define PathConstraint_apply(...) spPathConstraint_apply(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -62,36 +62,11 @@ typedef struct spPathConstraintData {
spRotateMode rotateMode;
float offsetRotation;
float position, spacing, rotateMix, translateMix;
#ifdef __cplusplus
spPathConstraintData() :
name(0),
order(0),
skinRequired(0),
bonesCount(0),
bones(0),
target(0),
positionMode(SP_POSITION_MODE_FIXED),
spacingMode(SP_SPACING_MODE_LENGTH),
rotateMode(SP_ROTATE_MODE_TANGENT),
offsetRotation(0),
position(0),
spacing(0),
rotateMix(0),
translateMix(0) {
}
#endif
} spPathConstraintData;
SP_API spPathConstraintData* spPathConstraintData_create (const char* name);
SP_API void spPathConstraintData_dispose (spPathConstraintData* self);
#ifdef SPINE_SHORT_NAMES
typedef spPathConstraintData PathConstraintData;
#define PathConstraintData_create(...) spPathConstraintData_create(__VA_ARGS__)
#define PathConstraintData_dispose(...) spPathConstraintData_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -50,13 +50,6 @@ SP_API spPointAttachment* spPointAttachment_create (const char* name);
SP_API void spPointAttachment_computeWorldPosition (spPointAttachment* self, spBone* bone, float* x, float* y);
SP_API float spPointAttachment_computeWorldRotation (spPointAttachment* self, spBone* bone);
#ifdef SPINE_SHORT_NAMES
typedef spPointAttachment PointAttachment;
#define PointAttachment_create(...) spPointAttachment_create(__VA_ARGS__)
#define PointAttachment_computeWorldPosition(...) spPointAttachment_computeWorldPosition(__VA_ARGS__)
#define PointAttachment_computeWorldRotation(...) spPointAttachment_computeWorldRotation(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -59,14 +59,6 @@ SP_API void spRegionAttachment_setUVs (spRegionAttachment* self, float u, float
SP_API void spRegionAttachment_updateOffset (spRegionAttachment* self);
SP_API void spRegionAttachment_computeWorldVertices (spRegionAttachment* self, spBone* bone, float* vertices, int offset, int stride);
#ifdef SPINE_SHORT_NAMES
typedef spRegionAttachment RegionAttachment;
#define RegionAttachment_create(...) spRegionAttachment_create(__VA_ARGS__)
#define RegionAttachment_setUVs(...) spRegionAttachment_setUVs(__VA_ARGS__)
#define RegionAttachment_updateOffset(...) spRegionAttachment_updateOffset(__VA_ARGS__)
#define RegionAttachment_computeWorldVertices(...) spRegionAttachment_computeWorldVertices(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -67,31 +67,6 @@ typedef struct spSkeleton {
float time;
float scaleX, scaleY;
float x, y;
#ifdef __cplusplus
spSkeleton() :
data(0),
bonesCount(0),
bones(0),
root(0),
slotsCount(0),
slots(0),
drawOrder(0),
ikConstraintsCount(0),
ikConstraints(0),
transformConstraintsCount(0),
transformConstraints(0),
skin(0),
color(),
time(0),
scaleX(1),
scaleY(1),
x(0), y(0) {
}
#endif
} spSkeleton;
SP_API spSkeleton* spSkeleton_create (spSkeletonData* data);
@ -146,26 +121,6 @@ SP_API spPathConstraint* spSkeleton_findPathConstraint (const spSkeleton* self,
SP_API void spSkeleton_update (spSkeleton* self, float deltaTime);
#ifdef SPINE_SHORT_NAMES
typedef spSkeleton Skeleton;
#define Skeleton_create(...) spSkeleton_create(__VA_ARGS__)
#define Skeleton_dispose(...) spSkeleton_dispose(__VA_ARGS__)
#define Skeleton_updateWorldTransform(...) spSkeleton_updateWorldTransform(__VA_ARGS__)
#define Skeleton_setToSetupPose(...) spSkeleton_setToSetupPose(__VA_ARGS__)
#define Skeleton_setBonesToSetupPose(...) spSkeleton_setBonesToSetupPose(__VA_ARGS__)
#define Skeleton_setSlotsToSetupPose(...) spSkeleton_setSlotsToSetupPose(__VA_ARGS__)
#define Skeleton_findBone(...) spSkeleton_findBone(__VA_ARGS__)
#define Skeleton_findBoneIndex(...) spSkeleton_findBoneIndex(__VA_ARGS__)
#define Skeleton_findSlot(...) spSkeleton_findSlot(__VA_ARGS__)
#define Skeleton_findSlotIndex(...) spSkeleton_findSlotIndex(__VA_ARGS__)
#define Skeleton_setSkin(...) spSkeleton_setSkin(__VA_ARGS__)
#define Skeleton_setSkinByName(...) spSkeleton_setSkinByName(__VA_ARGS__)
#define Skeleton_getAttachmentForSlotName(...) spSkeleton_getAttachmentForSlotName(__VA_ARGS__)
#define Skeleton_getAttachmentForSlotIndex(...) spSkeleton_getAttachmentForSlotIndex(__VA_ARGS__)
#define Skeleton_setAttachment(...) spSkeleton_setAttachment(__VA_ARGS__)
#define Skeleton_update(...) spSkeleton_update(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -55,15 +55,6 @@ SP_API void spSkeletonBinary_dispose (spSkeletonBinary* self);
SP_API spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const unsigned char* binary, const int length);
SP_API spSkeletonData* spSkeletonBinary_readSkeletonDataFile (spSkeletonBinary* self, const char* path);
#ifdef SPINE_SHORT_NAMES
typedef spSkeletonBinary SkeletonBinary;
#define SkeletonBinary_createWithLoader(...) spSkeletonBinary_createWithLoader(__VA_ARGS__)
#define SkeletonBinary_create(...) spSkeletonBinary_create(__VA_ARGS__)
#define SkeletonBinary_dispose(...) spSkeletonBinary_dispose(__VA_ARGS__)
#define SkeletonBinary_readSkeletonData(...) spSkeletonBinary_readSkeletonData(__VA_ARGS__)
#define SkeletonBinary_readSkeletonDataFile(...) spSkeletonBinary_readSkeletonDataFile(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -50,14 +50,6 @@ SP_API void spPolygon_dispose (spPolygon* self);
SP_API int/*bool*/spPolygon_containsPoint (spPolygon* polygon, float x, float y);
SP_API int/*bool*/spPolygon_intersectsSegment (spPolygon* polygon, float x1, float y1, float x2, float y2);
#ifdef SPINE_SHORT_NAMES
typedef spPolygon Polygon;
#define Polygon_create(...) spPolygon_create(__VA_ARGS__)
#define Polygon_dispose(...) spPolygon_dispose(__VA_ARGS__)
#define Polygon_containsPoint(...) spPolygon_containsPoint(__VA_ARGS__)
#define Polygon_intersectsSegment(...) spPolygon_intersectsSegment(__VA_ARGS__)
#endif
/**/
typedef struct spSkeletonBounds {
@ -92,19 +84,6 @@ SP_API spBoundingBoxAttachment* spSkeletonBounds_intersectsSegment (spSkeletonBo
/** Returns the polygon for the specified bounding box, or null. */
SP_API spPolygon* spSkeletonBounds_getPolygon (spSkeletonBounds* self, spBoundingBoxAttachment* boundingBox);
#ifdef SPINE_SHORT_NAMES
typedef spSkeletonBounds SkeletonBounds;
#define SkeletonBounds_create(...) spSkeletonBounds_create(__VA_ARGS__)
#define SkeletonBounds_dispose(...) spSkeletonBounds_dispose(__VA_ARGS__)
#define SkeletonBounds_update(...) spSkeletonBounds_update(__VA_ARGS__)
#define SkeletonBounds_aabbContainsPoint(...) spSkeletonBounds_aabbContainsPoint(__VA_ARGS__)
#define SkeletonBounds_aabbIntersectsSegment(...) spSkeletonBounds_aabbIntersectsSegment(__VA_ARGS__)
#define SkeletonBounds_aabbIntersectsSkeleton(...) spSkeletonBounds_aabbIntersectsSkeleton(__VA_ARGS__)
#define SkeletonBounds_containsPoint(...) spSkeletonBounds_containsPoint(__VA_ARGS__)
#define SkeletonBounds_intersectsSegment(...) spSkeletonBounds_intersectsSegment(__VA_ARGS__)
#define SkeletonBounds_getPolygon(...) spSkeletonBounds_getPolygon(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -99,19 +99,6 @@ SP_API spTransformConstraintData* spSkeletonData_findTransformConstraint (const
SP_API spPathConstraintData* spSkeletonData_findPathConstraint (const spSkeletonData* self, const char* constraintName);
#ifdef SPINE_SHORT_NAMES
typedef spSkeletonData SkeletonData;
#define SkeletonData_create(...) spSkeletonData_create(__VA_ARGS__)
#define SkeletonData_dispose(...) spSkeletonData_dispose(__VA_ARGS__)
#define SkeletonData_findBone(...) spSkeletonData_findBone(__VA_ARGS__)
#define SkeletonData_findBoneIndex(...) spSkeletonData_findBoneIndex(__VA_ARGS__)
#define SkeletonData_findSlot(...) spSkeletonData_findSlot(__VA_ARGS__)
#define SkeletonData_findSlotIndex(...) spSkeletonData_findSlotIndex(__VA_ARGS__)
#define SkeletonData_findSkin(...) spSkeletonData_findSkin(__VA_ARGS__)
#define SkeletonData_findEvent(...) spSkeletonData_findEvent(__VA_ARGS__)
#define SkeletonData_findAnimation(...) spSkeletonData_findAnimation(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -56,15 +56,6 @@ SP_API void spSkeletonJson_dispose (spSkeletonJson* self);
SP_API spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const char* json);
SP_API spSkeletonData* spSkeletonJson_readSkeletonDataFile (spSkeletonJson* self, const char* path);
#ifdef SPINE_SHORT_NAMES
typedef spSkeletonJson SkeletonJson;
#define SkeletonJson_createWithLoader(...) spSkeletonJson_createWithLoader(__VA_ARGS__)
#define SkeletonJson_create(...) spSkeletonJson_create(__VA_ARGS__)
#define SkeletonJson_dispose(...) spSkeletonJson_dispose(__VA_ARGS__)
#define SkeletonJson_readSkeletonData(...) spSkeletonJson_readSkeletonData(__VA_ARGS__)
#define SkeletonJson_readSkeletonDataFile(...) spSkeletonJson_readSkeletonDataFile(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -58,16 +58,6 @@ typedef struct spSkin {
spIkConstraintDataArray* ikConstraints;
spTransformConstraintDataArray* transformConstraints;
spPathConstraintDataArray* pathConstraints;
#ifdef __cplusplus
spSkin() :
name(0),
bones(0),
ikConstraints(0),
transformConstraints(0),
pathConstraints(0) {
}
#endif
} spSkin;
/* Private structs, needed by Skeleton */
@ -118,16 +108,6 @@ SP_API spSkinEntry* spSkin_getAttachments(const spSkin* self);
/** Clears all attachments, bones, and constraints. */
SP_API void spSkin_clear(spSkin* self);
#ifdef SPINE_SHORT_NAMES
typedef spSkin Skin;
#define Skin_create(...) spSkin_create(__VA_ARGS__)
#define Skin_dispose(...) spSkin_dispose(__VA_ARGS__)
#define Skin_setAttachment(...) spSkin_addAttachment(__VA_ARGS__)
#define Skin_getAttachment(...) spSkin_getAttachment(__VA_ARGS__)
#define Skin_getAttachmentName(...) spSkin_getAttachmentName(__VA_ARGS__)
#define Skin_attachAll(...) spSkin_attachAll(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -50,20 +50,6 @@ typedef struct spSlot {
int deformCapacity;
int deformCount;
float* deform;
#ifdef __cplusplus
spSlot() :
data(0),
bone(0),
color(),
darkColor(0),
attachment(0),
attachmentState(0),
deformCapacity(0),
deformCount(0),
deform(0) {
}
#endif
} spSlot;
SP_API spSlot* spSlot_create (spSlotData* data, spBone* bone);
@ -77,16 +63,6 @@ SP_API float spSlot_getAttachmentTime (const spSlot* self);
SP_API void spSlot_setToSetupPose (spSlot* self);
#ifdef SPINE_SHORT_NAMES
typedef spSlot Slot;
#define Slot_create(...) spSlot_create(__VA_ARGS__)
#define Slot_dispose(...) spSlot_dispose(__VA_ARGS__)
#define Slot_setAttachment(...) spSlot_setAttachment(__VA_ARGS__)
#define Slot_setAttachmentTime(...) spSlot_setAttachmentTime(__VA_ARGS__)
#define Slot_getAttachmentTime(...) spSlot_getAttachmentTime(__VA_ARGS__)
#define Slot_setToSetupPose(...) spSlot_setToSetupPose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -50,18 +50,6 @@ typedef struct spSlotData {
spColor color;
spColor* darkColor;
spBlendMode blendMode;
#ifdef __cplusplus
spSlotData() :
index(0),
name(0),
boneData(0),
attachmentName(0),
color(),
darkColor(0),
blendMode(SP_BLEND_MODE_NORMAL) {
}
#endif
} spSlotData;
SP_API spSlotData* spSlotData_create (const int index, const char* name, spBoneData* boneData);
@ -70,18 +58,6 @@ SP_API void spSlotData_dispose (spSlotData* self);
/* @param attachmentName May be 0 for no setup pose attachment. */
SP_API void spSlotData_setAttachmentName (spSlotData* self, const char* attachmentName);
#ifdef SPINE_SHORT_NAMES
typedef spBlendMode BlendMode;
#define BLEND_MODE_NORMAL SP_BLEND_MODE_NORMAL
#define BLEND_MODE_ADDITIVE SP_BLEND_MODE_ADDITIVE
#define BLEND_MODE_MULTIPLY SP_BLEND_MODE_MULTIPLY
#define BLEND_MODE_SCREEN SP_BLEND_MODE_SCREEN
typedef spSlotData SlotData;
#define SlotData_create(...) spSlotData_create(__VA_ARGS__)
#define SlotData_dispose(...) spSlotData_dispose(__VA_ARGS__)
#define SlotData_setAttachmentName(...) spSlotData_setAttachmentName(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -47,20 +47,6 @@ typedef struct spTransformConstraint {
spBone* target;
float rotateMix, translateMix, scaleMix, shearMix;
int /*boolean*/ active;
#ifdef __cplusplus
spTransformConstraint() :
data(0),
bonesCount(0),
bones(0),
target(0),
rotateMix(0),
translateMix(0),
scaleMix(0),
shearMix(0),
active(0) {
}
#endif
} spTransformConstraint;
SP_API spTransformConstraint* spTransformConstraint_create (spTransformConstraintData* data, const struct spSkeleton* skeleton);
@ -68,13 +54,6 @@ SP_API void spTransformConstraint_dispose (spTransformConstraint* self);
SP_API void spTransformConstraint_apply (spTransformConstraint* self);
#ifdef SPINE_SHORT_NAMES
typedef spTransformConstraint TransformConstraint;
#define TransformConstraint_create(...) spTransformConstraint_create(__VA_ARGS__)
#define TransformConstraint_dispose(...) spTransformConstraint_dispose(__VA_ARGS__)
#define TransformConstraint_apply(...) spTransformConstraint_apply(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -48,40 +48,11 @@ typedef struct spTransformConstraintData {
float offsetRotation, offsetX, offsetY, offsetScaleX, offsetScaleY, offsetShearY;
int /*boolean*/ relative;
int /*boolean*/ local;
#ifdef __cplusplus
spTransformConstraintData() :
name(0),
order(0),
skinRequired(0),
bonesCount(0),
bones(0),
target(0),
rotateMix(0),
translateMix(0),
scaleMix(0),
shearMix(0),
offsetRotation(0),
offsetX(0),
offsetY(0),
offsetScaleX(0),
offsetScaleY(0),
offsetShearY(0),
relative(0),
local(0) {
}
#endif
} spTransformConstraintData;
SP_API spTransformConstraintData* spTransformConstraintData_create (const char* name);
SP_API void spTransformConstraintData_dispose (spTransformConstraintData* self);
#ifdef SPINE_SHORT_NAMES
typedef spTransformConstraintData TransformConstraintData;
#define TransformConstraintData_create(...) spTransformConstraintData_create(__VA_ARGS__)
#define TransformConstraintData_dispose(...) spTransformConstraintData_dispose(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -59,11 +59,6 @@ SP_API void spVertexAttachment_computeWorldVertices (spVertexAttachment* self, s
void spVertexAttachment_copyTo(spVertexAttachment* self, spVertexAttachment* other);
#ifdef SPINE_SHORT_NAMES
typedef spVertexAttachment VertexAttachment;
#define VertexAttachment_computeWorldVertices(...) spVertexAttachment_computeWorldVertices(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -54,7 +54,6 @@
- OOP in C tends to lose type safety. Macros for casting are provided in extension.h to give context for why a cast is being done.
- If SPINE_SHORT_NAMES is defined, the "sp" prefix for all class names is optional.
*/
#ifndef SPINE_EXTENSION_H_
@ -162,12 +161,6 @@ void _spAtlasPage_createTexture (spAtlasPage* self, const char* path);
void _spAtlasPage_disposeTexture (spAtlasPage* self);
char* _spUtil_readFile (const char* path, int* length);
#ifdef SPINE_SHORT_NAMES
#define _AtlasPage_createTexture(...) _spAtlasPage_createTexture(__VA_ARGS__)
#define _AtlasPage_disposeTexture(...) _spAtlasPage_disposeTexture(__VA_ARGS__)
#define _Util_readFile(...) _spUtil_readFile(__VA_ARGS__)
#endif
/*
* Internal API available for extension:
*/
@ -213,16 +206,6 @@ typedef struct _spEventQueue {
int objectsCount;
int objectsCapacity;
int /*boolean*/ drainDisabled;
#ifdef __cplusplus
_spEventQueue() :
state(0),
objects(0),
objectsCount(0),
objectsCapacity(0),
drainDisabled(0) {
}
#endif
} _spEventQueue;
struct _spAnimationState {
@ -238,19 +221,6 @@ struct _spAnimationState {
int propertyIDsCapacity;
int /*boolean*/ animationsChanged;
#ifdef __cplusplus
_spAnimationState() :
super(),
eventsCount(0),
events(0),
queue(0),
propertyIDs(0),
propertyIDsCount(0),
propertyIDsCapacity(0),
animationsChanged(0) {
}
#endif
};
@ -269,13 +239,6 @@ void _spAttachmentLoader_deinit (spAttachmentLoader* self);
void _spAttachmentLoader_setError (spAttachmentLoader* self, const char* error1, const char* error2);
void _spAttachmentLoader_setUnknownTypeError (spAttachmentLoader* self, spAttachmentType type);
#ifdef SPINE_SHORT_NAMES
#define _AttachmentLoader_init(...) _spAttachmentLoader_init(__VA_ARGS__)
#define _AttachmentLoader_deinit(...) _spAttachmentLoader_deinit(__VA_ARGS__)
#define _AttachmentLoader_setError(...) _spAttachmentLoader_setError(__VA_ARGS__)
#define _AttachmentLoader_setUnknownTypeError(...) _spAttachmentLoader_setUnknownTypeError(__VA_ARGS__)
#endif
/**/
void _spAttachment_init (spAttachment* self, const char* name, spAttachmentType type,
@ -284,12 +247,6 @@ void _spAttachment_deinit (spAttachment* self);
void _spVertexAttachment_init (spVertexAttachment* self);
void _spVertexAttachment_deinit (spVertexAttachment* self);
#ifdef SPINE_SHORT_NAMES
#define _Attachment_init(...) _spAttachment_init(__VA_ARGS__)
#define _Attachment_deinit(...) _spAttachment_deinit(__VA_ARGS__)
#define _VertexAttachment_deinit(...) _spVertexAttachment_deinit(__VA_ARGS__)
#endif
/**/
void _spTimeline_init (spTimeline* self, spTimelineType type,
@ -299,11 +256,6 @@ void _spTimeline_init (spTimeline* self, spTimelineType type,
int (*getPropertyId) (const spTimeline* self));
void _spTimeline_deinit (spTimeline* self);
#ifdef SPINE_SHORT_NAMES
#define _Timeline_init(...) _spTimeline_init(__VA_ARGS__)
#define _Timeline_deinit(...) _spTimeline_deinit(__VA_ARGS__)
#endif
/**/
void _spCurveTimeline_init (spCurveTimeline* self, spTimelineType type, int framesCount,
@ -313,12 +265,6 @@ void _spCurveTimeline_init (spCurveTimeline* self, spTimelineType type, int fram
void _spCurveTimeline_deinit (spCurveTimeline* self);
int _spCurveTimeline_binarySearch (float *values, int valuesLength, float target, int step);
#ifdef SPINE_SHORT_NAMES
#define _CurveTimeline_init(...) _spCurveTimeline_init(__VA_ARGS__)
#define _CurveTimeline_deinit(...) _spCurveTimeline_deinit(__VA_ARGS__)
#define _CurveTimeline_binarySearch(...) _spCurveTimeline_binarySearch(__VA_ARGS__)
#endif
#ifdef __cplusplus
}
#endif

View File

@ -250,11 +250,10 @@ void spBone_updateAppliedTransform (spBone* self) {
}
void spBone_worldToLocal (spBone* self, float worldX, float worldY, float* localX, float* localY) {
float a = self->a, b = self->b, c = self->c, d = self->d;
float invDet = 1 / (a * d - b * c);
float invDet = 1 / (self->a * self->d - self->b * self->c);
float x = worldX - self->worldX, y = worldY - self->worldY;
*localX = (x * d * invDet - y * b * invDet);
*localY = (y * a * invDet - x * c * invDet);
*localX = (x * self->d * invDet - y * self->b * invDet);
*localY = (y * self->a * invDet - x * self->c * invDet);
}
void spBone_localToWorld (spBone* self, float localX, float localY, float* worldX, float* worldY) {

View File

@ -29,7 +29,6 @@
#include <iostream>
#include <string.h>
#define SPINE_SHORT_NAMES
#include <spine/spine-sfml.h>
#include <SFML/Graphics.hpp>
#include <SFML/Window/Mouse.hpp>
@ -39,27 +38,27 @@ using namespace spine;
#include <stdio.h>
#include <stdlib.h>
void callback (AnimationState* state, EventType type, TrackEntry* entry, Event* event) {
void callback (spAnimationState* state, spEventType type, spTrackEntry* entry, spEvent* event) {
UNUSED(state);
const char* animationName = (entry && entry->animation) ? entry->animation->name : 0;
switch (type) {
case ANIMATION_START:
case SP_ANIMATION_START:
printf("%d start: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_INTERRUPT:
case SP_ANIMATION_INTERRUPT:
printf("%d interrupt: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_END:
case SP_ANIMATION_END:
printf("%d end: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_COMPLETE:
case SP_ANIMATION_COMPLETE:
printf("%d complete: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_DISPOSE:
case SP_ANIMATION_DISPOSE:
printf("%d dispose: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_EVENT:
case SP_ANIMATION_EVENT:
printf("%d event: %s, %s: %d, %f, %s %f %f\n", entry->trackIndex, animationName, event->data->name, event->intValue, event->floatValue,
event->stringValue, event->volume, event->balance);
break;
@ -67,72 +66,72 @@ void callback (AnimationState* state, EventType type, TrackEntry* entry, Event*
fflush(stdout);
}
SkeletonData* readSkeletonJsonData (const char* filename, Atlas* atlas, float scale) {
SkeletonJson* json = SkeletonJson_create(atlas);
spSkeletonData* readSkeletonJsonData (const char* filename, spAtlas* atlas, float scale) {
spSkeletonJson* json = spSkeletonJson_create(atlas);
json->scale = scale;
SkeletonData* skeletonData = SkeletonJson_readSkeletonDataFile(json, filename);
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
if (!skeletonData) {
printf("%s\n", json->error);
exit(0);
}
SkeletonJson_dispose(json);
spSkeletonJson_dispose(json);
return skeletonData;
}
SkeletonData* readSkeletonBinaryData (const char* filename, Atlas* atlas, float scale) {
SkeletonBinary* binary = SkeletonBinary_create(atlas);
spSkeletonData* readSkeletonBinaryData (const char* filename, spAtlas* atlas, float scale) {
spSkeletonBinary* binary = spSkeletonBinary_create(atlas);
binary->scale = scale;
SkeletonData *skeletonData = SkeletonBinary_readSkeletonDataFile(binary, filename);
spSkeletonData *skeletonData = spSkeletonBinary_readSkeletonDataFile(binary, filename);
if (!skeletonData) {
printf("%s\n", binary->error);
exit(0);
}
SkeletonBinary_dispose(binary);
spSkeletonBinary_dispose(binary);
return skeletonData;
}
void testcase (void func(SkeletonData* skeletonData, Atlas* atlas),
void testcase (void func(spSkeletonData* skeletonData, spAtlas* atlas),
const char* jsonName, const char* binaryName, const char* atlasName,
float scale) {
Atlas* atlas = Atlas_createFromFile(atlasName, 0);
spAtlas* atlas = spAtlas_createFromFile(atlasName, 0);
SkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas, scale);
spSkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas, scale);
func(skeletonData, atlas);
SkeletonData_dispose(skeletonData);
spSkeletonData_dispose(skeletonData);
skeletonData = readSkeletonBinaryData(binaryName, atlas, scale);
func(skeletonData, atlas);
SkeletonData_dispose(skeletonData);
spSkeletonData_dispose(skeletonData);
Atlas_dispose(atlas);
spAtlas_dispose(atlas);
}
void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
void spineboy (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonBounds* bounds = SkeletonBounds_create();
spSkeletonBounds* bounds = spSkeletonBounds_create();
// Configure mixing.
AnimationStateData* stateData = AnimationStateData_create(skeletonData);
AnimationStateData_setMixByName(stateData, "walk", "jump", 0.2f);
AnimationStateData_setMixByName(stateData, "jump", "run", 0.2f);
spAnimationStateData* stateData = spAnimationStateData_create(skeletonData);
spAnimationStateData_setMixByName(stateData, "walk", "jump", 0.2f);
spAnimationStateData_setMixByName(stateData, "jump", "run", 0.2f);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData, stateData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
Skeleton_setToSetupPose(skeleton);
spSkeleton* skeleton = drawable->skeleton;
spSkeleton_setToSetupPose(skeleton);
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
Slot* headSlot = Skeleton_findSlot(skeleton, "head");
spSlot* headSlot = spSkeleton_findSlot(skeleton, "head");
drawable->state->listener = callback;
AnimationState_addAnimationByName(drawable->state, 0, "walk", true, 0);
AnimationState_addAnimationByName(drawable->state, 0, "jump", false, 3);
AnimationState_addAnimationByName(drawable->state, 0, "run", true, 0);
spAnimationState_addAnimationByName(drawable->state, 0, "walk", true, 0);
spAnimationState_addAnimationByName(drawable->state, 0, "jump", false, 3);
spAnimationState_addAnimationByName(drawable->state, 0, "run", true, 0);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - spineboy");
window.setFramerateLimit(60);
@ -145,9 +144,9 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
float delta = deltaClock.getElapsedTime().asSeconds();
deltaClock.restart();
SkeletonBounds_update(bounds, skeleton, true);
spSkeletonBounds_update(bounds, skeleton, true);
sf::Vector2i position = sf::Mouse::getPosition(window);
if (SkeletonBounds_containsPoint(bounds, (float)position.x, (float)position.y)) {
if (spSkeletonBounds_containsPoint(bounds, (float)position.x, (float)position.y)) {
headSlot->color.g = 0;
headSlot->color.b = 0;
} else {
@ -162,24 +161,24 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
window.display();
}
SkeletonBounds_dispose(bounds);
spSkeletonBounds_dispose(bounds);
}
void ikDemo (SkeletonData* skeletonData, Atlas* atlas) {
void ikDemo (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
// Create the SkeletonDrawable and position it
AnimationStateData* stateData = AnimationStateData_create(skeletonData);
spAnimationStateData* stateData = spAnimationStateData_create(skeletonData);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData, stateData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 320;
skeleton->y = 590;
// Queue the "walk" animation on the first track.
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
spAnimationState_setAnimationByName(drawable->state, 0, "walk", true);
// Queue the "aim" animation on a higher track.
// It consists of a single frame that positions
@ -190,7 +189,7 @@ void ikDemo (SkeletonData* skeletonData, Atlas* atlas) {
// by the walk animation, allowing us to
// mix the two. The mouse position following
// is performed in the render() method below.
AnimationState_setAnimationByName(drawable->state, 1, "aim", true);
spAnimationState_setAnimationByName(drawable->state, 1, "aim", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - IK Demo");
window.setFramerateLimit(60);
@ -222,8 +221,8 @@ void ikDemo (SkeletonData* skeletonData, Atlas* atlas) {
// worldToLocal() function!
sf::Vector2i mouseCoords = sf::Mouse::getPosition(window);
float boneCoordsX = 0, boneCoordsY = 0;
Bone* crosshair = Skeleton_findBone(drawable->skeleton, "crosshair"); // Should be cached.
Bone_worldToLocal(crosshair->parent, mouseCoords.x, mouseCoords.y, &boneCoordsX, &boneCoordsY);
spBone* crosshair = spSkeleton_findBone(drawable->skeleton, "crosshair"); // Should be cached.
spBone_worldToLocal(crosshair->parent, mouseCoords.x, mouseCoords.y, &boneCoordsX, &boneCoordsY);
crosshair->x = boneCoordsX;
crosshair->y = boneCoordsY;
crosshair->appliedValid = false;
@ -231,7 +230,7 @@ void ikDemo (SkeletonData* skeletonData, Atlas* atlas) {
// Calculate final world transform with the
// crosshair bone set to the mouse cursor
// position.
Skeleton_updateWorldTransform(drawable->skeleton);
spSkeleton_updateWorldTransform(drawable->skeleton);
window.clear();
window.draw(*drawable);
@ -239,22 +238,22 @@ void ikDemo (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void goblins (SkeletonData* skeletonData, Atlas* atlas) {
void goblins (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
Skeleton_setSkinByName(skeleton, "goblin");
Skeleton_setSlotsToSetupPose(skeleton);
spSkeleton* skeleton = drawable->skeleton;
spSkeleton_setSkinByName(skeleton, "goblin");
spSkeleton_setSlotsToSetupPose(skeleton);
//Skeleton_setAttachment(skeleton, "left hand item", "dagger");
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
spAnimationState_setAnimationByName(drawable->state, 0, "walk", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - goblins");
window.setFramerateLimit(60);
@ -275,7 +274,7 @@ void goblins (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void raptor (SkeletonData* skeletonData, Atlas* atlas) {
void raptor (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
@ -285,13 +284,13 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) {
effect->centerY = -200;
drawable->vertexEffect = &effect->super;
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
AnimationState_addAnimationByName(drawable->state, 1, "gun-grab", false, 2);
spAnimationState_setAnimationByName(drawable->state, 0, "walk", true);
spAnimationState_addAnimationByName(drawable->state, 1, "gun-grab", false, 2);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - raptor");
window.setFramerateLimit(60);
@ -319,18 +318,18 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) {
spSwirlVertexEffect_dispose(effect);
}
void tank (SkeletonData* skeletonData, Atlas* atlas) {
void tank (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 500;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "drive", true);
spAnimationState_setAnimationByName(drawable->state, 0, "drive", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - tank");
window.setFramerateLimit(60);
@ -350,18 +349,18 @@ void tank (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void vine (SkeletonData* skeletonData, Atlas* atlas) {
void vine (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "grow", true);
spAnimationState_setAnimationByName(drawable->state, 0, "grow", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
window.setFramerateLimit(60);
@ -382,18 +381,18 @@ void vine (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void stretchyman (SkeletonData* skeletonData, Atlas* atlas) {
void stretchyman (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 100;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "sneak", true);
spAnimationState_setAnimationByName(drawable->state, 0, "sneak", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - Streatchyman");
window.setFramerateLimit(60);
@ -414,18 +413,18 @@ void stretchyman (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void coin (SkeletonData* skeletonData, Atlas* atlas) {
void coin (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 320;
skeleton->y = 320;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "animation", true);
spAnimationState_setAnimationByName(drawable->state, 0, "animation", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
window.setFramerateLimit(60);
@ -447,23 +446,23 @@ void coin (SkeletonData* skeletonData, Atlas* atlas) {
}
}
void owl (SkeletonData* skeletonData, Atlas* atlas) {
void owl (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
skeleton->x = 320;
skeleton->y = 400;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "idle", true);
AnimationState_setAnimationByName(drawable->state, 1, "blink", true);
spTrackEntry* left = AnimationState_setAnimationByName(drawable->state, 2, "left", true);
spTrackEntry* right = AnimationState_setAnimationByName(drawable->state, 3, "right", true);
spTrackEntry* up = AnimationState_setAnimationByName(drawable->state, 4, "up", true);
spTrackEntry* down = AnimationState_setAnimationByName(drawable->state, 5, "down", true);
spAnimationState_setAnimationByName(drawable->state, 0, "idle", true);
spAnimationState_setAnimationByName(drawable->state, 1, "blink", true);
spTrackEntry* left = spAnimationState_setAnimationByName(drawable->state, 2, "left", true);
spTrackEntry* right = spAnimationState_setAnimationByName(drawable->state, 3, "right", true);
spTrackEntry* up = spAnimationState_setAnimationByName(drawable->state, 4, "up", true);
spTrackEntry* down = spAnimationState_setAnimationByName(drawable->state, 5, "down", true);
left->alpha = 0;
right->alpha = 0;
@ -505,9 +504,9 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
/**
* Used for debugging purposes during runtime development
*/
void test (SkeletonData* skeletonData, Atlas* atlas) {
void test (spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
spSkeleton* skeleton = Skeleton_create(skeletonData);
spSkeleton* skeleton = spSkeleton_create(skeletonData);
spAnimationStateData* animData = spAnimationStateData_create(skeletonData);
spAnimationState* animState = spAnimationState_create(animData);
spAnimationState_setAnimationByName(animState, 0, "drive", true);
@ -527,16 +526,16 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
d += 0.1f;
}
Skeleton_dispose(skeleton);
spSkeleton_dispose(skeleton);
}
void testSkinsApi(SkeletonData* skeletonData, Atlas* atlas) {
void testSkinsApi(spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
spSkin* skin = spSkin_create("test-skin");
spSkin_copySkin(skin, spSkeletonData_findSkin(skeletonData, "goblingirl"));
@ -546,9 +545,9 @@ void testSkinsApi(SkeletonData* skeletonData, Atlas* atlas) {
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
spAnimationState_setAnimationByName(drawable->state, 0, "walk", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - skins api");
window.setFramerateLimit(60);
@ -572,13 +571,13 @@ void testSkinsApi(SkeletonData* skeletonData, Atlas* atlas) {
spSkin_dispose(skin);
}
void testMixAndMatch(SkeletonData* skeletonData, Atlas* atlas) {
void testMixAndMatch(spSkeletonData* skeletonData, spAtlas* atlas) {
UNUSED(atlas);
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
drawable->timeScale = 1;
drawable->setUsePremultipliedAlpha(true);
Skeleton* skeleton = drawable->skeleton;
spSkeleton* skeleton = drawable->skeleton;
// Create a new skin, by mixing and matching other skins
// that fit together. Items making up the girl are individual
@ -599,9 +598,9 @@ void testMixAndMatch(SkeletonData* skeletonData, Atlas* atlas) {
skeleton->x = 320;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
spSkeleton_updateWorldTransform(skeleton);
AnimationState_setAnimationByName(drawable->state, 0, "dance", true);
spAnimationState_setAnimationByName(drawable->state, 0, "dance", true);
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - mix and match");
window.setFramerateLimit(60);

View File

@ -27,7 +27,6 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#define SPINE_SHORT_NAMES
#include <spine/spine-sfml.h>
#ifndef SPINE_MESH_VERTEX_COUNT_MAX
@ -48,7 +47,7 @@ sf::BlendMode screenPma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::OneMi
_SP_ARRAY_IMPLEMENT_TYPE(spColorArray, spColor)
void _AtlasPage_createTexture (AtlasPage* self, const char* path){
void _spAtlasPage_createTexture (spAtlasPage* self, const char* path){
Texture* texture = new Texture();
if (!texture->loadFromFile(path)) return;
@ -61,11 +60,11 @@ void _AtlasPage_createTexture (AtlasPage* self, const char* path){
self->height = size.y;
}
void _AtlasPage_disposeTexture (AtlasPage* self){
void _spAtlasPage_disposeTexture (spAtlasPage* self){
delete (Texture*)self->rendererObject;
}
char* _Util_readFile (const char* path, int* length){
char* _spUtil_readFile (const char* path, int* length){
return _spReadFile(path, length);
}
@ -73,21 +72,21 @@ char* _Util_readFile (const char* path, int* length){
namespace spine {
SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateData* stateData) :
SkeletonDrawable::SkeletonDrawable (spSkeletonData* skeletonData, spAnimationStateData* stateData) :
timeScale(1),
vertexArray(new VertexArray(Triangles, skeletonData->bonesCount * 4)),
vertexEffect(0),
worldVertices(0), clipper(0) {
Bone_setYDown(true);
spBone_setYDown(true);
worldVertices = MALLOC(float, SPINE_MESH_VERTEX_COUNT_MAX);
skeleton = Skeleton_create(skeletonData);
skeleton = spSkeleton_create(skeletonData);
tempUvs = spFloatArray_create(16);
tempColors = spColorArray_create(16);
ownsAnimationStateData = stateData == 0;
if (ownsAnimationStateData) stateData = AnimationStateData_create(skeletonData);
if (ownsAnimationStateData) stateData = spAnimationStateData_create(skeletonData);
state = AnimationState_create(stateData);
state = spAnimationState_create(stateData);
clipper = spSkeletonClipping_create();
}
@ -95,19 +94,19 @@ SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateDa
SkeletonDrawable::~SkeletonDrawable () {
delete vertexArray;
FREE(worldVertices);
if (ownsAnimationStateData) AnimationStateData_dispose(state->data);
AnimationState_dispose(state);
Skeleton_dispose(skeleton);
if (ownsAnimationStateData) spAnimationStateData_dispose(state->data);
spAnimationState_dispose(state);
spSkeleton_dispose(skeleton);
spSkeletonClipping_dispose(clipper);
spFloatArray_dispose(tempUvs);
spColorArray_dispose(tempColors);
}
void SkeletonDrawable::update (float deltaTime) {
Skeleton_update(skeleton, deltaTime);
AnimationState_update(state, deltaTime * timeScale);
AnimationState_apply(state, skeleton);
Skeleton_updateWorldTransform(skeleton);
spSkeleton_update(skeleton, deltaTime);
spAnimationState_update(state, deltaTime * timeScale);
spAnimationState_apply(state, skeleton);
spSkeleton_updateWorldTransform(skeleton);
}
void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
@ -123,8 +122,8 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
sf::Vertex vertex;
Texture* texture = 0;
for (int i = 0; i < skeleton->slotsCount; ++i) {
Slot* slot = skeleton->drawOrder[i];
Attachment* attachment = slot->attachment;
spSlot* slot = skeleton->drawOrder[i];
spAttachment* attachment = slot->attachment;
if (!attachment) continue;
// Early out if slot is invisible
@ -140,8 +139,8 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
int indicesCount = 0;
spColor* attachmentColor;
if (attachment->type == ATTACHMENT_REGION) {
RegionAttachment* regionAttachment = (RegionAttachment*)attachment;
if (attachment->type == SP_ATTACHMENT_REGION) {
spRegionAttachment* regionAttachment = (spRegionAttachment*)attachment;
attachmentColor = &regionAttachment->color;
// Early out if slot is invisible
@ -155,10 +154,10 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
uvs = regionAttachment->uvs;
indices = quadIndices;
indicesCount = 6;
texture = (Texture*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
texture = (Texture*)((spAtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
} else if (attachment->type == ATTACHMENT_MESH) {
MeshAttachment* mesh = (MeshAttachment*)attachment;
} else if (attachment->type == SP_ATTACHMENT_MESH) {
spMeshAttachment* mesh = (spMeshAttachment*)attachment;
attachmentColor = &mesh->color;
// Early out if slot is invisible
@ -168,7 +167,7 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
}
if (mesh->super.worldVerticesLength > SPINE_MESH_VERTEX_COUNT_MAX) continue;
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
texture = (Texture*)((spAtlasRegion*)mesh->rendererObject)->page->rendererObject;
spVertexAttachment_computeWorldVertices(SUPER(mesh), slot, 0, mesh->super.worldVerticesLength, worldVertices, 0, 2);
verticesCount = mesh->super.worldVerticesLength >> 1;
uvs = mesh->uvs;
@ -199,16 +198,16 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
sf::BlendMode blend;
if (!usePremultipliedAlpha) {
switch (slot->data->blendMode) {
case BLEND_MODE_NORMAL:
case SP_BLEND_MODE_NORMAL:
blend = normal;
break;
case BLEND_MODE_ADDITIVE:
case SP_BLEND_MODE_ADDITIVE:
blend = additive;
break;
case BLEND_MODE_MULTIPLY:
case SP_BLEND_MODE_MULTIPLY:
blend = multiply;
break;
case BLEND_MODE_SCREEN:
case SP_BLEND_MODE_SCREEN:
blend = screen;
break;
default:
@ -216,16 +215,16 @@ void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
}
} else {
switch (slot->data->blendMode) {
case BLEND_MODE_NORMAL:
case SP_BLEND_MODE_NORMAL:
blend = normalPma;
break;
case BLEND_MODE_ADDITIVE:
case SP_BLEND_MODE_ADDITIVE:
blend = additivePma;
break;
case BLEND_MODE_MULTIPLY:
case SP_BLEND_MODE_MULTIPLY:
blend = multiplyPma;
break;
case BLEND_MODE_SCREEN:
case SP_BLEND_MODE_SCREEN:
blend = screenPma;
break;
default:

View File

@ -27,8 +27,6 @@
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#define SPINE_SHORT_NAMES
#include <spine/spine-sfml.h>
#ifndef SPINE_MESH_VERTEX_COUNT_MAX