[c] Fixed binary skeleton parsing.

This commit is contained in:
badlogic 2018-01-23 14:03:18 +01:00
parent c24990a1c4
commit a9deff2d2f
4 changed files with 8 additions and 3 deletions

View File

@ -42,13 +42,15 @@ typedef struct spEventData {
int intValue;
float floatValue;
const char* stringValue;
const char* audioPath;
#ifdef __cplusplus
spEventData() :
name(0),
intValue(0),
floatValue(0),
stringValue(0) {
stringValue(0),
audioPath(0) {
}
#endif
} spEventData;

View File

@ -38,6 +38,7 @@ spEventData* spEventData_create (const char* name) {
}
void spEventData_dispose (spEventData* self) {
FREE(self->audioPath);
FREE(self->stringValue);
FREE(self->name);
FREE(self);

View File

@ -885,6 +885,7 @@ spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const
/* Skip images path & fps */
readFloat(input);
FREE(readString(input));
FREE(readString(input));
}
/* Bones. */
@ -1072,6 +1073,7 @@ spSkeletonData* spSkeletonBinary_readSkeletonData (spSkeletonBinary* self, const
eventData->intValue = readVarint(input, 0);
eventData->floatValue = readFloat(input);
eventData->stringValue = readString(input);
eventData->audioPath = readString(input);
skeletonData->events[i] = eventData;
}

View File

@ -124,7 +124,7 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
Skeleton_setToSetupPose(skeleton);
skeleton->x = 320;
skeleton->y = 460;
skeleton->y = 590;
Skeleton_updateWorldTransform(skeleton);
Slot* headSlot = Skeleton_findSlot(skeleton, "head");
@ -134,7 +134,7 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
AnimationState_addAnimationByName(drawable->state, 0, "jump", false, 3);
AnimationState_addAnimationByName(drawable->state, 0, "run", true, 0);
sf::RenderWindow window(sf::VideoMode(640, 480), "Spine SFML - spineboy");
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - spineboy");
window.setFramerateLimit(60);
sf::Event event;
sf::Clock deltaClock;