Space::Space() : _space(&_theSpace) { cpSpaceInit(_space); cpSpaceSetUserData(_space, this); cpSpaceSetDefaultCollisionHandler(_space, beginFunc, preSolveFunc, postSolveFunc, separateFunc, 0); }
void initDll(void) { Variable *mainStatic; cpSpaceInit(&mSpace); cpSpaceSetIterations(&mSpace,20); cpSpaceSetEnableContactGraph(&mSpace,cpFalse); //cpSpaceSetSleepTimeThreshold(&mSpace,0.1f); vhInit(&mVariableHandler); mainStatic = vhAddBody(&mVariableHandler,cpSpaceGetStaticBody(&mSpace)); mainStatic->mCBPtr = 0; mWind = cpv(0,0); mState = Loaded; }
cpSpace * cpHastySpaceNew(void) { cpHastySpace *hasty = (cpHastySpace *)cpcalloc(1, sizeof(cpHastySpace)); cpSpaceInit((cpSpace *)hasty); pthread_mutex_init(&hasty->mutex, NULL); pthread_cond_init(&hasty->cond_work, NULL); pthread_cond_init(&hasty->cond_resume, NULL); // TODO magic number, should test this more thoroughly. hasty->constraint_count_threshold = 50; // Default to 1 thread for determinism. hasty->num_threads = 1; cpHastySpaceSetThreads((cpSpace *)hasty, 1); return (cpSpace *)hasty; }
cpSpace* cpSpaceNew(void) { return cpSpaceInit(cpSpaceAlloc()); }