mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 09:46:02 +08:00
parent
725fd49c77
commit
5e2e5ed8d9
@ -78,9 +78,12 @@ spAnimationState* spAnimationState_create (spAnimationStateData* data) {
|
||||
}
|
||||
|
||||
void spAnimationState_dispose (spAnimationState* self) {
|
||||
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
|
||||
FREE(internal->events);
|
||||
int i;
|
||||
for (i = 0; i < self->trackCount; i++)
|
||||
_spTrackEntry_disposeAll(self->tracks[i]);
|
||||
FREE(self->tracks);
|
||||
FREE(self);
|
||||
}
|
||||
|
||||
@ -189,6 +192,7 @@ spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index
|
||||
if (index < self->trackCount) return self->tracks[index];
|
||||
newTracks = CALLOC(spTrackEntry*, index + 1);
|
||||
memcpy(newTracks, self->tracks, self->trackCount * sizeof(spTrackEntry*));
|
||||
FREE(self->tracks);
|
||||
self->tracks = newTracks;
|
||||
self->trackCount = index + 1;
|
||||
return 0;
|
||||
|
||||
@ -57,6 +57,10 @@ void spSkeletonData_dispose (spSkeletonData* self) {
|
||||
spAnimation_dispose(self->animations[i]);
|
||||
FREE(self->animations);
|
||||
|
||||
for (i = 0; i < self->eventCount; ++i)
|
||||
spEventData_dispose(self->events[i]);
|
||||
FREE(self->events);
|
||||
|
||||
FREE(self);
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,7 @@ static void callback (AnimationState* state, int trackIndex, EventType type, Eve
|
||||
}
|
||||
|
||||
- (void) initialize {
|
||||
_ownsAnimationStateData = true;
|
||||
_state = AnimationState_create(AnimationStateData_create(_skeleton->data));
|
||||
_state->context = self;
|
||||
_state->listener = callback;
|
||||
@ -113,7 +114,7 @@ static void callback (AnimationState* state, int trackIndex, EventType type, Eve
|
||||
if (_ownsAnimationStateData) AnimationStateData_dispose(_state->data);
|
||||
AnimationState_dispose(_state);
|
||||
|
||||
_ownsAnimationStateData = true;
|
||||
_ownsAnimationStateData = false;
|
||||
_state = AnimationState_create(stateData);
|
||||
_state->context = self;
|
||||
_state->listener = callback;
|
||||
|
||||
@ -68,6 +68,7 @@ void CCSkeletonAnimation::initialize () {
|
||||
listenerInstance = 0;
|
||||
listenerMethod = 0;
|
||||
|
||||
ownsAnimationStateData = true;
|
||||
state = spAnimationState_create(spAnimationStateData_create(skeleton->data));
|
||||
state->context = this;
|
||||
state->listener = callback;
|
||||
@ -108,7 +109,7 @@ void CCSkeletonAnimation::setAnimationStateData (spAnimationStateData* stateData
|
||||
if (ownsAnimationStateData) spAnimationStateData_dispose(state->data);
|
||||
spAnimationState_dispose(state);
|
||||
|
||||
ownsAnimationStateData = true;
|
||||
ownsAnimationStateData = false;
|
||||
state = spAnimationState_create(stateData);
|
||||
state->context = this;
|
||||
state->listener = callback;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user