parin.bindings.box2d

The box2d module provides access to the Box2D v3 C API. By default these bindings match the Box2D v3.1.1 release. To use latest Box2D instead, compile with -version=Box2D_Main. The versions have different ABIs, so the flag must match the library you link.

fn b2Body_ApplyAngularImpulse b2Body_ApplyForce b2Body_ApplyForceToCenter b2Body_ApplyLinearImpulse b2Body_ApplyLinearImpulseToCenter b2Body_ApplyTorque b2Body_Disable b2Body_Enable b2Body_GetAngularDamping b2Body_GetAngularVelocity b2Body_GetGravityScale b2Body_GetLinearDamping b2Body_GetLinearVelocity b2Body_GetLocalPoint b2Body_GetLocalVector b2Body_GetMass b2Body_GetName b2Body_GetPosition b2Body_GetRotation b2Body_GetRotationalInertia b2Body_GetShapeCount b2Body_GetShapes b2Body_GetTransform b2Body_GetType b2Body_GetUserData b2Body_GetWorldPoint b2Body_GetWorldVector b2Body_IsAwake b2Body_IsBullet b2Body_IsEnabled b2Body_IsValid b2Body_SetAngularDamping b2Body_SetAngularVelocity b2Body_SetAwake b2Body_SetBullet b2Body_SetGravityScale b2Body_SetLinearDamping b2Body_SetLinearVelocity b2Body_SetName b2Body_SetTransform b2Body_SetType b2Body_SetUserData b2Chain_GetSegmentCount b2Chain_GetSegments b2Chain_IsValid b2ComputeHull b2CreateBody b2CreateCapsuleShape b2CreateChain b2CreateCircleShape b2CreateDistanceJoint b2CreateFilterJoint b2CreateMotorJoint b2CreatePolygonShape b2CreatePrismaticJoint b2CreateRevoluteJoint b2CreateSegmentShape b2CreateWeldJoint b2CreateWheelJoint b2CreateWorld b2DefaultBodyDef b2DefaultChainDef b2DefaultDistanceJointDef b2DefaultFilterJointDef b2DefaultMotorJointDef b2DefaultPrismaticJointDef b2DefaultRevoluteJointDef b2DefaultShapeDef b2DefaultWeldJointDef b2DefaultWheelJointDef b2DefaultWorldDef b2DestroyBody b2DestroyChain b2DestroyJoint b2DestroyShape b2DestroyWorld b2Joint_GetBodyA b2Joint_GetBodyB b2Joint_GetType b2Joint_GetUserData b2Joint_IsValid b2Joint_SetUserData b2MakeBox b2MakeOffsetBox b2MakeOffsetPolygon b2MakeOffsetProxy b2MakeOffsetRoundedBox b2MakeOffsetRoundedPolygon b2MakePolygon b2MakeProxy b2MakeRoundedBox b2MakeSquare b2Shape_GetAABB b2Shape_GetBody b2Shape_GetDensity b2Shape_GetFilter b2Shape_GetFriction b2Shape_GetRestitution b2Shape_GetType b2Shape_GetUserData b2Shape_IsValid b2Shape_SetDensity b2Shape_SetFilter b2Shape_SetFriction b2Shape_SetRestitution b2Shape_SetUserData b2Shape_TestPoint b2TransformPolygon b2World_CastRay b2World_CastRayClosest b2World_EnableContinuous b2World_EnableSleeping b2World_GetBodyEvents b2World_GetContactEvents b2World_GetGravity b2World_GetSensorEvents b2World_GetUserData b2World_IsContinuousEnabled b2World_IsSleepingEnabled b2World_IsValid b2World_SetGravity b2World_SetUserData b2World_Step

Types 48

aliasb2Vec2 = joka.Vec2
aliasb2Pos = b2Vec2
aliasb2WorldTransform = b2Transform
aliasb2OverlapResultFcn = bool function(b2ShapeId shapeId, void * context)
aliasb2CastResultFcn = float function(b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void * context)
aliasb2FinishTaskCallback = void function(void * userTask, void * userContext)
aliasb2FrictionCallback = float function(float frictionA, b2UserMaterialId userMaterialIdA, float frictionB, b2UserMaterialId userMaterialIdB)
aliasb2RestitutionCallback = float function(float restitutionA, b2UserMaterialId userMaterialIdA, float restitutionB, b2UserMaterialId userMaterialIdB)
aliasb2BodyType = int
aliasb2ShapeType = int
aliasb2JointType = int
structb2WorldId
Fields
ushort index1
ushort generation
structb2BodyId
Fields
int index1
ushort world0
ushort generation
structb2ShapeId
Fields
int index1
ushort world0
ushort generation
structb2ChainId
Fields
int index1
ushort world0
ushort generation
structb2JointId
Fields
int index1
ushort world0
ushort generation
structb2Rot
Fields
float c
float s
structb2Transform
Fields
b2Vec2 p
b2Rot q
structb2AABB
Fields
b2Vec2 lowerBound
b2Vec2 upperBound
structb2Mat22
Fields
b2Vec2 cx
b2Vec2 cy
structb2Filter
Fields
ulong categoryBits
ulong maskBits
int groupIndex
structb2QueryFilter
Fields
ulong categoryBits
ulong maskBits
structb2SurfaceMaterial
Fields
float friction
float restitution
float rollingResistance
float tangentSpeed
b2UserMaterialId userMaterialId
uint customColor
structb2WorldDef
Fields
b2Vec2 gravity
float restitutionThreshold
float hitEventThreshold
float contactHertz
float contactDampingRatio
float maximumLinearSpeed
b2FrictionCallback frictionCallback
b2RestitutionCallback restitutionCallback
bool enableSleep
bool enableContinuous
int workerCount
b2EnqueueTaskCallback enqueueTask
b2FinishTaskCallback finishTask
void * userTaskContext
void * userData
int internalValue
structb2BodyDef
Fields
b2BodyType type
b2Pos position
b2Rot rotation
b2Vec2 linearVelocity
float angularVelocity
float linearDamping
float angularDamping
float gravityScale
float sleepThreshold
const(char) * name
void * userData
bool enableSleep
bool isAwake
bool isBullet
bool isEnabled
bool allowFastRotation
int internalValue
structb2ShapeDef
Fields
void * userData
b2SurfaceMaterial material
float density
b2Filter filter
bool isSensor
bool enableSensorEvents
bool enableContactEvents
bool enableHitEvents
bool enablePreSolveEvents
bool invokeContactCreation
bool updateBodyMass
int internalValue
structb2Circle
Fields
b2Vec2 center
float radius
structb2Capsule
Fields
b2Vec2 center1
b2Vec2 center2
float radius
structb2Segment
Fields
b2Vec2 point1
b2Vec2 point2
structb2Polygon
Fields
joka.StaticArray!(b2Vec2, 8) vertices
joka.StaticArray!(b2Vec2, 8) normals
b2Vec2 centroid
float radius
int count
structb2ManifoldPoint
Fields
b2Vec2 anchorA
b2Vec2 anchorB
float separation
float normalImpulse
float tangentImpulse
float totalNormalImpulse
float normalVelocity
ushort id
bool persisted
structb2Manifold
Fields
b2Vec2 normal
float rollingImpulse
joka.StaticArray!(b2ManifoldPoint, 2) points
int pointCount
structb2SensorBeginTouchEvent
Fields
b2ShapeId sensorShapeId
b2ShapeId visitorShapeId
structb2SensorEndTouchEvent
Fields
b2ShapeId sensorShapeId
b2ShapeId visitorShapeId
structb2SensorEvents
Fields
b2SensorBeginTouchEvent * beginEvents
b2SensorEndTouchEvent * endEvents
int beginCount
int endCount
structb2ContactBeginTouchEvent
Fields
b2ShapeId shapeIdA
b2ShapeId shapeIdB
structb2ContactEndTouchEvent
Fields
b2ShapeId shapeIdA
b2ShapeId shapeIdB
structb2ContactHitEvent
Fields
b2ShapeId shapeIdA
b2ShapeId shapeIdB
b2Pos point
b2Vec2 normal
float approachSpeed
structb2ContactEvents
Fields
b2ContactBeginTouchEvent * beginEvents
b2ContactEndTouchEvent * endEvents
b2ContactHitEvent * hitEvents
int beginCount
int endCount
int hitCount
structb2BodyMoveEvent
Fields
bool fellAsleep
structb2BodyEvents
Fields
b2BodyMoveEvent * moveEvents
int moveCount
structb2TreeStats
Fields
int nodeVisits
int leafVisits
structb2Hull
Fields
joka.StaticArray!(b2Vec2, 8) points
int count
structb2ShapeProxy
Fields
joka.StaticArray!(b2Vec2, 8) points
int count
float radius
structb2RayResult
Fields
b2ShapeId shapeId
b2Pos point
b2Vec2 normal
float fraction
int nodeVisits
int leafVisits
bool hit
structb2ChainSegment
Fields
b2Vec2 ghost1
b2Segment segment
b2Vec2 ghost2
int chainId
structb2ChainDef
Fields
void * userData
const(b2Vec2) * points
const(b2SurfaceMaterial) * materials
int materialCount
b2Filter filter
bool isLoop
bool enableSensorEvents
int internalValue
structb2ContactData
Fields
b2ShapeId shapeIdA
b2ShapeId shapeIdB
b2Manifold manifold

Functions 123

fnb2WorldDef b2DefaultWorldDef() extern(C) @system nothrow @nogc
fnb2WorldId b2CreateWorld(const(b2WorldDef) * def) extern(C) @system nothrow @nogc
fnvoid b2DestroyWorld(b2WorldId worldId) extern(C) @system nothrow @nogc
fnbool b2World_IsValid(b2WorldId id) extern(C) @system nothrow @nogc
fnvoid b2World_Step(b2WorldId worldId, float timeStep, int subStepCount) extern(C) @system nothrow @nogc
fnb2BodyEvents b2World_GetBodyEvents(b2WorldId worldId) extern(C) @system nothrow @nogc
fnb2SensorEvents b2World_GetSensorEvents(b2WorldId worldId) extern(C) @system nothrow @nogc
fnb2ContactEvents b2World_GetContactEvents(b2WorldId worldId) extern(C) @system nothrow @nogc
fnvoid b2World_SetGravity(b2WorldId worldId, b2Vec2 gravity) extern(C) @system nothrow @nogc
fnb2Vec2 b2World_GetGravity(b2WorldId worldId) extern(C) @system nothrow @nogc
fnvoid b2World_EnableSleeping(b2WorldId worldId, bool flag) extern(C) @system nothrow @nogc
fnbool b2World_IsSleepingEnabled(b2WorldId worldId) extern(C) @system nothrow @nogc
fnvoid b2World_EnableContinuous(b2WorldId worldId, bool flag) extern(C) @system nothrow @nogc
fnbool b2World_IsContinuousEnabled(b2WorldId worldId) extern(C) @system nothrow @nogc
fnvoid b2World_SetUserData(b2WorldId worldId, void * userData) extern(C) @system nothrow @nogc
fnvoid * b2World_GetUserData(b2WorldId worldId) extern(C) @system nothrow @nogc
fnb2BodyDef b2DefaultBodyDef() extern(C) @system nothrow @nogc
fnb2BodyId b2CreateBody(b2WorldId worldId, const(b2BodyDef) * def) extern(C) @system nothrow @nogc
fnvoid b2DestroyBody(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnbool b2Body_IsValid(b2BodyId id) extern(C) @system nothrow @nogc
fnb2BodyType b2Body_GetType(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetType(b2BodyId bodyId, b2BodyType type) extern(C) @system nothrow @nogc
fnvoid b2Body_SetUserData(b2BodyId bodyId, void * userData) extern(C) @system nothrow @nogc
fnvoid * b2Body_GetUserData(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnb2Pos b2Body_GetPosition(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnb2Rot b2Body_GetRotation(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnb2WorldTransform b2Body_GetTransform(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetTransform(b2BodyId bodyId, b2Pos position, b2Rot rotation) extern(C) @system nothrow @nogc
fnb2Vec2 b2Body_GetLinearVelocity(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnfloat b2Body_GetAngularVelocity(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetLinearVelocity(b2BodyId bodyId, b2Vec2 linearVelocity) extern(C) @system nothrow @nogc
fnvoid b2Body_SetAngularVelocity(b2BodyId bodyId, float angularVelocity) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyForce(b2BodyId bodyId, b2Vec2 force, b2Pos point, bool wake) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyForceToCenter(b2BodyId bodyId, b2Vec2 force, bool wake) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyTorque(b2BodyId bodyId, float torque, bool wake) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyLinearImpulse(b2BodyId bodyId, b2Vec2 impulse, b2Pos point, bool wake) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyLinearImpulseToCenter(b2BodyId bodyId, b2Vec2 impulse, bool wake) extern(C) @system nothrow @nogc
fnvoid b2Body_ApplyAngularImpulse(b2BodyId bodyId, float impulse, bool wake) extern(C) @system nothrow @nogc
fnfloat b2Body_GetMass(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnbool b2Body_IsAwake(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetAwake(b2BodyId bodyId, bool awake) extern(C) @system nothrow @nogc
fnbool b2Body_IsEnabled(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_Enable(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_Disable(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetBullet(b2BodyId bodyId, bool flag) extern(C) @system nothrow @nogc
fnbool b2Body_IsBullet(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnint b2Body_GetShapeCount(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnint b2Body_GetShapes(b2BodyId bodyId, b2ShapeId * shapeArray, int capacity) extern(C) @system nothrow @nogc
fnb2ShapeDef b2DefaultShapeDef() extern(C) @system nothrow @nogc
fnb2ShapeId b2CreateCircleShape(b2BodyId bodyId, const(b2ShapeDef) * def, const(b2Circle) * circle) extern(C) @system nothrow @nogc
fnb2ShapeId b2CreateCapsuleShape(b2BodyId bodyId, const(b2ShapeDef) * def, const(b2Capsule) * capsule) extern(C) @system nothrow @nogc
fnb2ShapeId b2CreateSegmentShape(b2BodyId bodyId, const(b2ShapeDef) * def, const(b2Segment) * segment) extern(C) @system nothrow @nogc
fnb2ShapeId b2CreatePolygonShape(b2BodyId bodyId, const(b2ShapeDef) * def, const(b2Polygon) * polygon) extern(C) @system nothrow @nogc
fnvoid b2DestroyShape(b2ShapeId shapeId, bool updateBodyMass) extern(C) @system nothrow @nogc
fnbool b2Shape_IsValid(b2ShapeId id) extern(C) @system nothrow @nogc
fnb2ShapeType b2Shape_GetType(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnb2BodyId b2Shape_GetBody(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnvoid b2Shape_SetUserData(b2ShapeId shapeId, void * userData) extern(C) @system nothrow @nogc
fnvoid * b2Shape_GetUserData(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnvoid b2Shape_SetDensity(b2ShapeId shapeId, float density, bool updateBodyMass) extern(C) @system nothrow @nogc
fnfloat b2Shape_GetDensity(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnvoid b2Shape_SetFriction(b2ShapeId shapeId, float friction) extern(C) @system nothrow @nogc
fnfloat b2Shape_GetFriction(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnvoid b2Shape_SetRestitution(b2ShapeId shapeId, float restitution) extern(C) @system nothrow @nogc
fnfloat b2Shape_GetRestitution(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnb2Filter b2Shape_GetFilter(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnvoid b2Shape_SetFilter(b2ShapeId shapeId, b2Filter filter) extern(C) @system nothrow @nogc
fnbool b2Shape_TestPoint(b2ShapeId shapeId, b2Pos point) extern(C) @system nothrow @nogc
fnb2AABB b2Shape_GetAABB(b2ShapeId shapeId) extern(C) @system nothrow @nogc
fnb2DistanceJointDef b2DefaultDistanceJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateDistanceJoint(b2WorldId worldId, const(b2DistanceJointDef) * def) extern(C) @system nothrow @nogc
fnb2RevoluteJointDef b2DefaultRevoluteJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateRevoluteJoint(b2WorldId worldId, const(b2RevoluteJointDef) * def) extern(C) @system nothrow @nogc
fnb2PrismaticJointDef b2DefaultPrismaticJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreatePrismaticJoint(b2WorldId worldId, const(b2PrismaticJointDef) * def) extern(C) @system nothrow @nogc
fnb2WeldJointDef b2DefaultWeldJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateWeldJoint(b2WorldId worldId, const(b2WeldJointDef) * def) extern(C) @system nothrow @nogc
fnb2WheelJointDef b2DefaultWheelJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateWheelJoint(b2WorldId worldId, const(b2WheelJointDef) * def) extern(C) @system nothrow @nogc
fnvoid b2DestroyJoint(b2JointId jointId) extern(C) @system nothrow @nogc
fnbool b2Joint_IsValid(b2JointId id) extern(C) @system nothrow @nogc
fnb2JointType b2Joint_GetType(b2JointId jointId) extern(C) @system nothrow @nogc
fnb2BodyId b2Joint_GetBodyA(b2JointId jointId) extern(C) @system nothrow @nogc
fnb2BodyId b2Joint_GetBodyB(b2JointId jointId) extern(C) @system nothrow @nogc
fnvoid b2Joint_SetUserData(b2JointId jointId, void * userData) extern(C) @system nothrow @nogc
fnvoid * b2Joint_GetUserData(b2JointId jointId) extern(C) @system nothrow @nogc
fnb2TreeStats b2World_CastRay(b2WorldId worldId, b2Pos origin, b2Vec2 translation, b2QueryFilter filter, b2CastResultFcn fcn, void * context) extern(C) @system nothrow @nogc
fnb2Vec2 b2Body_GetWorldPoint(b2BodyId bodyId, b2Vec2 localPoint) extern(C) @system nothrow @nogc
fnb2Vec2 b2Body_GetLocalPoint(b2BodyId bodyId, b2Pos worldPoint) extern(C) @system nothrow @nogc
fnb2Vec2 b2Body_GetWorldVector(b2BodyId bodyId, b2Vec2 localVector) extern(C) @system nothrow @nogc
fnb2Vec2 b2Body_GetLocalVector(b2BodyId bodyId, b2Vec2 worldVector) extern(C) @system nothrow @nogc
fnb2Polygon b2MakePolygon(const(b2Hull) * hull, float radius) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeOffsetPolygon(const(b2Hull) * hull, b2Vec2 position, b2Rot rotation) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeOffsetRoundedPolygon(const(b2Hull) * hull, b2Vec2 position, b2Rot rotation, float radius) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeSquare(float halfWidth) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeBox(float halfWidth, float halfHeight) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeRoundedBox(float halfWidth, float halfHeight, float radius) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeOffsetBox(float halfWidth, float halfHeight, b2Vec2 center, b2Rot rotation) extern(C) @system nothrow @nogc
fnb2Polygon b2MakeOffsetRoundedBox(float halfWidth, float halfHeight, b2Vec2 center, b2Rot rotation, float radius) extern(C) @system nothrow @nogc
fnb2Polygon b2TransformPolygon(b2Transform transform, const(b2Polygon) * polygon) extern(C) @system nothrow @nogc
fnb2Hull b2ComputeHull(const(b2Vec2) * points, int count) extern(C) @system nothrow @nogc
fnb2ShapeProxy b2MakeProxy(const(b2Vec2) * points, int count, float radius) extern(C) @system nothrow @nogc
fnb2ShapeProxy b2MakeOffsetProxy(const(b2Vec2) * points, int count, float radius, b2Vec2 position, b2Rot rotation) extern(C) @system nothrow @nogc
fnb2ChainDef b2DefaultChainDef() extern(C) @system nothrow @nogc
fnb2ChainId b2CreateChain(b2BodyId bodyId, const(b2ChainDef) * def) extern(C) @system nothrow @nogc
fnvoid b2DestroyChain(b2ChainId chainId) extern(C) @system nothrow @nogc
fnbool b2Chain_IsValid(b2ChainId id) extern(C) @system nothrow @nogc
fnint b2Chain_GetSegmentCount(b2ChainId chainId) extern(C) @system nothrow @nogc
fnint b2Chain_GetSegments(b2ChainId chainId, b2ShapeId * segmentArray, int capacity) extern(C) @system nothrow @nogc
fnb2RayResult b2World_CastRayClosest(b2WorldId worldId, b2Pos origin, b2Vec2 translation, b2QueryFilter filter) extern(C) @system nothrow @nogc
fnb2FilterJointDef b2DefaultFilterJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateFilterJoint(b2WorldId worldId, const(b2FilterJointDef) * def) extern(C) @system nothrow @nogc
fnb2MotorJointDef b2DefaultMotorJointDef() extern(C) @system nothrow @nogc
fnb2JointId b2CreateMotorJoint(b2WorldId worldId, const(b2MotorJointDef) * def) extern(C) @system nothrow @nogc
fnvoid b2Body_SetName(b2BodyId bodyId, const(char) * name) extern(C) @system nothrow @nogc
fnconst(char) * b2Body_GetName(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnfloat b2Body_GetRotationalInertia(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetLinearDamping(b2BodyId bodyId, float linearDamping) extern(C) @system nothrow @nogc
fnfloat b2Body_GetLinearDamping(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetAngularDamping(b2BodyId bodyId, float angularDamping) extern(C) @system nothrow @nogc
fnfloat b2Body_GetAngularDamping(b2BodyId bodyId) extern(C) @system nothrow @nogc
fnvoid b2Body_SetGravityScale(b2BodyId bodyId, float gravityScale) extern(C) @system nothrow @nogc
fnfloat b2Body_GetGravityScale(b2BodyId bodyId) extern(C) @system nothrow @nogc