CCSkeletonAnimation::~CCSkeletonAnimation () { for (std::vector<AnimationStateData*>::iterator iter = stateDatas.begin(); iter != stateDatas.end(); ++iter) AnimationStateData_dispose(*iter); for (std::vector<AnimationState*>::iterator iter = states.begin(); iter != states.end(); ++iter) AnimationState_dispose(*iter); }
void CCSkeletonAnimation::setAnimationStateData (AnimationStateData* stateData, int stateIndex) { CCAssert(stateIndex >= 0 && stateIndex < (int)states.size(), "stateIndex out of range."); CCAssert(stateData, "stateData cannot be null."); AnimationState* state = states[stateIndex]; for (std::vector<AnimationStateData*>::iterator iter = stateDatas.begin(); iter != stateDatas.end(); ++iter) { if (state->data == *iter) { AnimationStateData_dispose(state->data); stateDatas.erase(iter); break; } } for (std::vector<AnimationState*>::iterator iter = states.begin(); iter != states.end(); ++iter) { if (state == *iter) { states.erase(iter); break; } } AnimationState_dispose(state); state = AnimationState_create(stateData); states[stateIndex] = state; }
CCSkeleton::~CCSkeleton () { if (ownsSkeleton) Skeleton_dispose(skeleton); if (ownsStateData) AnimationStateData_dispose(state->data); if (atlas) Atlas_dispose(atlas); AnimationState_dispose(state); }
CCSkeleton::~CCSkeleton () { Skeleton_dispose(skeleton); if (ownsStateData) AnimationStateData_dispose(state->data); AnimationState_dispose(state); }