1 module chipmunk.cpBody; 2 import chipmunk.chipmunk_types; 3 import chipmunk.chipmunk_structs; 4 5 extern (C): 6 7 alias void function (cpBody*, cpVect, double, double) cpBodyVelocityFunc; 8 alias void function (cpBody*, double) cpBodyPositionFunc; 9 alias void function (cpBody*, cpShape*, void*) cpBodyShapeIteratorFunc; 10 alias void function (cpBody*, cpConstraint*, void*) cpBodyConstraintIteratorFunc; 11 alias void function (cpBody*, cpArbiter*, void*) cpBodyArbiterIteratorFunc; 12 13 enum cpBodyType 14 { 15 CP_BODY_TYPE_DYNAMIC = 0, 16 CP_BODY_TYPE_KINEMATIC = 1, 17 CP_BODY_TYPE_STATIC = 2 18 } 19 20 cpBody* cpBodyAlloc (); 21 cpBody* cpBodyInit (cpBody* body_, cpFloat mass, cpFloat moment); 22 cpBody* cpBodyNew (cpFloat mass, cpFloat moment); 23 cpBody* cpBodyNewKinematic (); 24 cpBody* cpBodyNewStatic (); 25 void cpBodyDestroy (cpBody* body_); 26 void cpBodyFree (cpBody* body_); 27 void cpBodyActivate (cpBody* body_); 28 void cpBodyActivateStatic (cpBody* body_, cpShape* filter); 29 void cpBodySleep (cpBody* body_); 30 void cpBodySleepWithGroup (cpBody* body_, cpBody* group); 31 cpBool cpBodyIsSleeping (const(cpBody)* body_); 32 cpBodyType cpBodyGetType (cpBody* body_); 33 void cpBodySetType (cpBody* body_, cpBodyType type); 34 cpSpace* cpBodyGetSpace (const(cpBody)* body_); 35 cpFloat cpBodyGetMass (const(cpBody)* body_); 36 void cpBodySetMass (cpBody* body_, cpFloat m); 37 cpFloat cpBodyGetMoment (const(cpBody)* body_); 38 void cpBodySetMoment (cpBody* body_, cpFloat i); 39 cpVect cpBodyGetPosition (const(cpBody)* body_); 40 void cpBodySetPosition (cpBody* body_, cpVect pos); 41 cpVect cpBodyGetCenterOfGravity (const(cpBody)* body_); 42 void cpBodySetCenterOfGravity (cpBody* body_, cpVect cog); 43 cpVect cpBodyGetVelocity (const(cpBody)* body_); 44 void cpBodySetVelocity (cpBody* body_, cpVect velocity); 45 cpVect cpBodyGetForce (const(cpBody)* body_); 46 void cpBodySetForce (cpBody* body_, cpVect force); 47 cpFloat cpBodyGetAngle (const(cpBody)* body_); 48 void cpBodySetAngle (cpBody* body_, cpFloat a); 49 cpFloat cpBodyGetAngularVelocity (const(cpBody)* body_); 50 void cpBodySetAngularVelocity (cpBody* body_, cpFloat angularVelocity); 51 cpFloat cpBodyGetTorque (const(cpBody)* body_); 52 void cpBodySetTorque (cpBody* body_, cpFloat torque); 53 cpVect cpBodyGetRotation (const(cpBody)* body_); 54 cpDataPointer cpBodyGetUserData (const(cpBody)* body_); 55 void cpBodySetUserData (cpBody* body_, cpDataPointer userData); 56 void cpBodySetVelocityUpdateFunc (cpBody* body_, cpBodyVelocityFunc velocityFunc); 57 void cpBodySetPositionUpdateFunc (cpBody* body_, cpBodyPositionFunc positionFunc); 58 void cpBodyUpdateVelocity (cpBody* body_, cpVect gravity, cpFloat damping, cpFloat dt); 59 void cpBodyUpdatePosition (cpBody* body_, cpFloat dt); 60 cpVect cpBodyLocalToWorld (const(cpBody)* body_, const cpVect point); 61 cpVect cpBodyWorldToLocal (const(cpBody)* body_, const cpVect point); 62 void cpBodyApplyForceAtWorldPoint (cpBody* body_, cpVect force, cpVect point); 63 void cpBodyApplyForceAtLocalPoint (cpBody* body_, cpVect force, cpVect point); 64 void cpBodyApplyImpulseAtWorldPoint (cpBody* body_, cpVect impulse, cpVect point); 65 void cpBodyApplyImpulseAtLocalPoint (cpBody* body_, cpVect impulse, cpVect point); 66 cpVect cpBodyGetVelocityAtWorldPoint (const(cpBody)* body_, cpVect point); 67 cpVect cpBodyGetVelocityAtLocalPoint (const(cpBody)* body_, cpVect point); 68 cpFloat cpBodyKineticEnergy (const(cpBody)* body_); 69 void cpBodyEachShape (cpBody* body_, cpBodyShapeIteratorFunc func, void* data); 70 void cpBodyEachConstraint (cpBody* body_, cpBodyConstraintIteratorFunc func, void* data); 71 void cpBodyEachArbiter (cpBody* body_, cpBodyArbiterIteratorFunc func, void* data);