void cpSpaceFreeChildren(cpSpace *space) { cpSpaceHashEach(space->staticShapes, (cpSpaceHashIterator)&shapeFreeWrap, NULL); cpSpaceHashEach(space->activeShapes, (cpSpaceHashIterator)&shapeFreeWrap, NULL); cpArrayEach(space->bodies, (cpArrayIter)&bodyFreeWrap, NULL); cpArrayEach(space->constraints, (cpArrayIter)&constraintFreeWrap, NULL); }
void cpSpaceFreeChildren(cpSpace *space) { cpSpaceHashEach(space->staticShapes, &shapeFreeWrap, NULL); cpSpaceHashEach(space->activeShapes, &shapeFreeWrap, NULL); cpArrayEach(space->bodies, &bodyFreeWrap, NULL); cpArrayEach(space->joints, &jointFreeWrap, NULL); }
void cpSpaceFreeChildren(cpSpace *space) { cpArray *components = space->sleepingComponents; while(components->num) cpBodyActivate((cpBody *)components->arr[0]); cpSpaceHashEach(space->staticShapes, (cpSpaceHashIterator)&shapeFreeWrap, NULL); cpSpaceHashEach(space->activeShapes, (cpSpaceHashIterator)&shapeFreeWrap, NULL); cpArrayEach(space->bodies, (cpArrayIter)&bodyFreeWrap, NULL); cpArrayEach(space->constraints, (cpArrayIter)&constraintFreeWrap, NULL); }
void cpSpaceDestroy(cpSpace *space) { cpSpaceHashFree(space->staticShapes); cpSpaceHashFree(space->activeShapes); cpArrayFree(space->bodies); cpArrayFree(space->constraints); cpHashSetFree(space->contactSet); cpArrayFree(space->arbiters); cpArrayFree(space->pooledArbiters); if(space->allocatedBuffers){ cpArrayEach(space->allocatedBuffers, freeWrap, NULL); cpArrayFree(space->allocatedBuffers); } if(space->postStepCallbacks){ cpHashSetEach(space->postStepCallbacks, freeWrap, NULL); cpHashSetFree(space->postStepCallbacks); } if(space->collFuncSet){ cpHashSetEach(space->collFuncSet, freeWrap, NULL); cpHashSetFree(space->collFuncSet); } }
void cpHashSetDestroy(cpHashSet *set) { // Free the table. cpfree(set->table); if(set->allocatedBuffers) cpArrayEach(set->allocatedBuffers, freeWrap, NULL); cpArrayFree(set->allocatedBuffers); }
void cpSpaceHashDestroy(cpSpaceHash *hash) { clearHash(hash); cpHashSetFree(hash->handleSet); cpArrayEach(hash->allocatedBuffers, freeWrap, NULL); cpArrayFree(hash->allocatedBuffers); cpArrayFree(hash->pooledHandles); cpfree(hash->table); }