Skip to content

Commit

Permalink
[c] More 4.2 porting, only loaders left.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Apr 15, 2024
1 parent 430758e commit f7f4d5c
Show file tree
Hide file tree
Showing 17 changed files with 659 additions and 359 deletions.
85 changes: 72 additions & 13 deletions spine-c/spine-c/include/spine/Animation.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,17 @@ typedef enum {
SP_TIMELINE_TRANSLATE,
SP_TIMELINE_DEFORM,
SP_TIMELINE_SEQUENCE,
SP_TIMELINE_INHERIT,
SP_TIMELINE_IKCONSTRAINT,
SP_TIMELINE_PATHCONSTRAINTMIX,
SP_TIMELINE_PHYSICSCONSTRAINT_INERTIA,
SP_TIMELINE_PHYSICSCONSTRAINT_STRENGTH,
SP_TIMELINE_PHYSICSCONSTRAINT_DAMPING,
SP_TIMELINE_PHYSICSCONSTRAINT_MASS,
SP_TIMELINE_PHYSICSCONSTRAINT_WIND,
SP_TIMELINE_PHYSICSCONSTRAINT_GRAVITY,
SP_TIMELINE_PHYSICSCONSTRAINT_MIX,
SP_TIMELINE_PHYSICSCONSTRAINT_RESET,
SP_TIMELINE_RGB2,
SP_TIMELINE_RGBA2,
SP_TIMELINE_RGBA,
Expand All @@ -122,19 +131,28 @@ typedef enum {
SP_PROPERTY_SCALEY = 1 << 4,
SP_PROPERTY_SHEARX = 1 << 5,
SP_PROPERTY_SHEARY = 1 << 6,
SP_PROPERTY_RGB = 1 << 7,
SP_PROPERTY_ALPHA = 1 << 8,
SP_PROPERTY_RGB2 = 1 << 9,
SP_PROPERTY_ATTACHMENT = 1 << 10,
SP_PROPERTY_DEFORM = 1 << 11,
SP_PROPERTY_EVENT = 1 << 12,
SP_PROPERTY_DRAWORDER = 1 << 13,
SP_PROPERTY_IKCONSTRAINT = 1 << 14,
SP_PROPERTY_TRANSFORMCONSTRAINT = 1 << 15,
SP_PROPERTY_PATHCONSTRAINT_POSITION = 1 << 16,
SP_PROPERTY_PATHCONSTRAINT_SPACING = 1 << 17,
SP_PROPERTY_PATHCONSTRAINT_MIX = 1 << 18,
SP_PROPERTY_SEQUENCE = 1 << 19
SP_PROPERTY_INHERIT = 1 << 7,
SP_PROPERTY_RGB = 1 << 8,
SP_PROPERTY_ALPHA = 1 << 9,
SP_PROPERTY_RGB2 = 1 << 10,
SP_PROPERTY_ATTACHMENT = 1 << 11,
SP_PROPERTY_DEFORM = 1 << 12,
SP_PROPERTY_EVENT = 1 << 13,
SP_PROPERTY_DRAWORDER = 1 << 14,
SP_PROPERTY_IKCONSTRAINT = 1 << 15,
SP_PROPERTY_TRANSFORMCONSTRAINT = 1 << 16,
SP_PROPERTY_PATHCONSTRAINT_POSITION = 1 << 17,
SP_PROPERTY_PATHCONSTRAINT_SPACING = 1 << 18,
SP_PROPERTY_PATHCONSTRAINT_MIX = 1 << 19,
SP_PROPERTY_PHYSICSCONSTRAINT_INERTIA = 1 << 20,
SP_PROPERTY_PHYSICSCONSTRAINT_STRENGTH = 1 << 21,
SP_PROPERTY_PHYSICSCONSTRAINT_DAMPING = 1 << 22,
SP_PROPERTY_PHYSICSCONSTRAINT_MASS = 1 << 23,
SP_PROPERTY_PHYSICSCONSTRAINT_WIND = 1 << 24,
SP_PROPERTY_PHYSICSCONSTRAINT_GRAVITY = 1 << 25,
SP_PROPERTY_PHYSICSCONSTRAINT_MIX = 1 << 26,
SP_PROPERTY_PHYSICSCONSTRAINT_RESET = 1 << 27,
SP_PROPERTY_SEQUENCE = 1 << 28
} spProperty;

#define SP_MAX_PROPERTY_IDS 3
Expand Down Expand Up @@ -196,6 +214,14 @@ SP_API void spCurveTimeline1_setFrame(spCurveTimeline1 *self, int frame, float t

SP_API float spCurveTimeline1_getCurveValue(spCurveTimeline1 *self, float time);

SP_API float spCurveTimeline1_getRelativeValue(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup);

SP_API float spCurveTimeline1_getAbsoluteValue(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup);

SP_API float spCurveTimeline1_getAbsoluteValue2(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup, float value);

SP_API float spCurveTimeline1_getScaleValue (spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, spMixDirection direction, float current, float setup);

typedef struct spCurveTimeline spCurveTimeline2;

SP_API void spCurveTimeline2_setFrame(spCurveTimeline1 *self, int frame, float time, float value1, float value2);
Expand Down Expand Up @@ -437,6 +463,18 @@ SP_API spDrawOrderTimeline *spDrawOrderTimeline_create(int framesCount, int slot

SP_API void spDrawOrderTimeline_setFrame(spDrawOrderTimeline *self, int frameIndex, float time, const int *drawOrder);

/**/

typedef struct spInheritTimeline {
spTimeline super;
int boneIndex;
} spInheritTimeline;

SP_API spInheritTimeline *spInheritTimeline_create(int framesCount, int boneIndex);

SP_API void spInheritTimeline_setFrame(spDrawOrderTimeline *self, int frameIndex, float time, spInherit inherit);


/**/

typedef struct spIkConstraintTimeline {
Expand Down Expand Up @@ -508,6 +546,27 @@ spPathConstraintMixTimeline_setFrame(spPathConstraintMixTimeline *self, int fram

/**/

typedef struct spPhysicsConstraintTimeline {
spCurveTimeline super;
int physicsConstraintIndex;
} spPhysicsConstraintTimeline;

SP_API spPhysicsConstraintTimeline *
spPhysicsConstraintTimeline_create(int framesCount, int bezierCount, int physicsConstraintIndex, spTimelineType type);

SP_API void spPhysicsConstraintTimeline_setFrame(spPhysicsConstraintTimeline *self, int frame, float time, float value);

/**/

typedef struct spPhysicsConstraintResetTimeline {
spTimeline super;
int physicsConstraintIndex;
} spPhysicsConstraintResetTimeline;

SP_API spPhysicsConstraintResetTimeline *spPhysicsConstraintResetTimeline_create(int framesCount, int boneIndex);

SP_API void spPhysicsConstraintResetTimeline_setFrame(spPhysicsConstraintResetTimeline *self, int frameIndex, float time);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 5 additions & 1 deletion spine-c/spine-c/include/spine/AnimationState.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct spTrackEntry {
int /*boolean*/ holdPrevious;
int /*boolean*/ reverse;
int /*boolean*/ shortestRotation;
float eventThreshold, attachmentThreshold, drawOrderThreshold;
float eventThreshold, mixAttachmentThreshold, alphaAttachmentThreshold, mixDrawOrderThreshold;
float animationStart, animationEnd, animationLast, nextAnimationLast;
float delay, trackTime, trackLast, nextTrackLast, trackEnd, timeScale;
float alpha, mixTime, mixDuration, interruptAlpha, totalAlpha;
Expand Down Expand Up @@ -146,6 +146,10 @@ SP_API void spTrackEntry_resetRotationDirections(spTrackEntry *entry);

SP_API float spTrackEntry_getTrackComplete(spTrackEntry *entry);

SP_API void spTrackEntry_setMixDuration(spTrackEntry *entry, float mixDuration, float delay);

SP_API int/*bool*/ spTrackEntry_wasApplied(spTrackEntry *entry);

SP_API void spAnimationState_clearNext(spAnimationState *self, spTrackEntry *entry);

/** Use this to dispose static memory before your app exits to appease your memory leak detector*/
Expand Down
2 changes: 2 additions & 0 deletions spine-c/spine-c/include/spine/IkConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ SP_API void spIkConstraint_dispose(spIkConstraint *self);

SP_API void spIkConstraint_update(spIkConstraint *self);

SP_API void spIkConstraint_setToSetupPose(spIkConstraint *self);

SP_API void
spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch,
int /*boolean*/ uniform, float alpha);
Expand Down
2 changes: 2 additions & 0 deletions spine-c/spine-c/include/spine/PathConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ SP_API void spPathConstraint_dispose(spPathConstraint *self);

SP_API void spPathConstraint_update(spPathConstraint *self);

SP_API void spPathConstraint_setToSetupPose(spPathConstraint *self);

SP_API float *spPathConstraint_computeWorldPositions(spPathConstraint *self, spPathAttachment *path, int spacesCount,
int/*bool*/ tangents);

Expand Down
4 changes: 4 additions & 0 deletions spine-c/spine-c/include/spine/Skeleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ SP_API spPathConstraint *spSkeleton_findPathConstraint(const spSkeleton *self, c
/* Returns 0 if the physics constraint was not found. */
SP_API spPhysicsConstraint *spSkeleton_findPhysicsConstraint(const spSkeleton *self, const char *constraintName);

SP_API void spSkeleton_physicsTranslate(spSkeleton *self, float x, float y);

SP_API void spSkeleton_physicsRotate(spSkeleton *self, float x, float y, float degrees);

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 4 additions & 0 deletions spine-c/spine-c/include/spine/Skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <spine/IkConstraintData.h>
#include <spine/TransformConstraintData.h>
#include <spine/PathConstraintData.h>
#include <spine/PhysicsConstraintData.h>
#include <spine/Array.h>

#ifdef __cplusplus
Expand All @@ -54,13 +55,16 @@ _SP_ARRAY_DECLARE_TYPE(spTransformConstraintDataArray, spTransformConstraintData

_SP_ARRAY_DECLARE_TYPE(spPathConstraintDataArray, spPathConstraintData*)

_SP_ARRAY_DECLARE_TYPE(spPhysicsConstraintDataArray, spPhysicsConstraintData*)

typedef struct spSkin {
char *name;

spBoneDataArray *bones;
spIkConstraintDataArray *ikConstraints;
spTransformConstraintDataArray *transformConstraints;
spPathConstraintDataArray *pathConstraints;
spPhysicsConstraintDataArray *physicsConstraints;
spColor color;
} spSkin;

Expand Down
2 changes: 2 additions & 0 deletions spine-c/spine-c/include/spine/TransformConstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ SP_API void spTransformConstraint_dispose(spTransformConstraint *self);

SP_API void spTransformConstraint_update(spTransformConstraint *self);

SP_API void spTransformConstraint_setToSetupPose(spTransformConstraint *self);

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit f7f4d5c

Please sign in to comment.