77 int32 GetConstraintCount()
const;
113 d2Body* GetBodies()
const;
119 int32 GetBodyCount()
const;
The d2BlockAllocator class is responsible for managing memory allocation and deallocation....
Definition d2BlockAllocator.h:41
A class representing a 2D rigid body.
Definition d2Body.h:28
Definition d2Broadphase.h:16
Definition d2Constraint.h:7
Represents a 2D physics world.
Definition d2World.h:22
void SetDebugDraw(d2Draw *debugDraw)
Set the debug draw object.
void AddTorque(real torque)
Add an external torque to be applied to m_bodiesList.
d2Constraint * m_constraints
Definition d2World.h:144
void DestroyBody(d2Body *body)
Destroy a body.
void DebugDraw()
Debug draw the world.
int32 m_bodyCount
Definition d2World.h:142
d2Body * m_bodiesList
Definition d2World.h:141
int32 GetConstraintCount() const
Get the number of constraints in the world.
Definition d2World.h:165
d2World(const d2World &other)=delete
d2BlockAllocator m_blockAllocator
Definition d2World.h:139
void AddForce(const d2Vec2 &force)
Add an external force to be applied to m_bodiesList.
d2Body * GetBodies() const
Get pointer to the array of m_bodiesList.
Definition d2World.h:150
int32 m_constraintCount
Definition d2World.h:145
d2World(const d2Vec2 &gravity)
Constructor that initializes the world with specified gravity.
~d2World()
Destructor to clean up resources.
void Step(real dt, int32 posIterations=3)
Update the world simulation by a specified time step.
void DrawShape(const d2Body *body, const bool &mesh, const d2Color &color)
Draw a shape.
void CheckCollisions()
Check for collisions between m_bodiesList.
d2Constraint *& GetConstraints()
Get a reference to the list of constraints.
Definition d2World.h:160
d2World & operator=(const d2World &other)=delete
d2Broadphase * broadphase
Definition d2World.h:138
int32 GetBodyCount() const
Get the number of m_bodiesList in the world.
Definition d2World.h:155
void Solve(real dt)
Solve the world simulation by a specified time step.
d2Constraint * CreateJoint(d2Body *bodyA, d2Body *bodyB, d2Vec2 anchorPoint)
Create a joint between two bodies.
d2Body * CreateBody(const d2Shape &shape, d2Vec2 position, real mass)
Create a new rigid body with given shape, position, and mass.
void DestroyJoint(d2Constraint *joint)
Destroy a joint.
float real
Definition d2Types.h:10
signed int int32
Definition d2Types.h:6
#define D2_API
Definition d2api.h:27
Represents a 2D vector.
Definition d2Math.h:22