mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Update to box2d 2.4.1
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#ifndef B2_BODY_H
|
||||
#define B2_BODY_H
|
||||
|
||||
#include "b2_api.h"
|
||||
#include "b2_math.h"
|
||||
#include "b2_shape.h"
|
||||
|
||||
@@ -44,19 +45,15 @@ enum b2BodyType
|
||||
b2_staticBody = 0,
|
||||
b2_kinematicBody,
|
||||
b2_dynamicBody
|
||||
|
||||
// TODO_ERIN
|
||||
//b2_bulletBody,
|
||||
};
|
||||
|
||||
/// A body definition holds all the data needed to construct a rigid body.
|
||||
/// You can safely re-use body definitions. Shapes are added to a body after construction.
|
||||
struct b2BodyDef
|
||||
struct B2_API b2BodyDef
|
||||
{
|
||||
/// This constructor sets the body definition default values.
|
||||
b2BodyDef()
|
||||
{
|
||||
userData = nullptr;
|
||||
position.Set(0.0f, 0.0f);
|
||||
angle = 0.0f;
|
||||
linearVelocity.Set(0.0f, 0.0f);
|
||||
@@ -121,14 +118,14 @@ struct b2BodyDef
|
||||
bool enabled;
|
||||
|
||||
/// Use this to store application specific body data.
|
||||
void* userData;
|
||||
b2BodyUserData userData;
|
||||
|
||||
/// Scale the gravity applied to this body.
|
||||
float gravityScale;
|
||||
};
|
||||
|
||||
/// A rigid body. These are created via b2World::CreateBody.
|
||||
class b2Body
|
||||
class B2_API b2Body
|
||||
{
|
||||
public:
|
||||
/// Creates a fixture and attach it to this body. Use this function if you need
|
||||
@@ -379,10 +376,10 @@ public:
|
||||
const b2Body* GetNext() const;
|
||||
|
||||
/// Get the user data pointer that was provided in the body definition.
|
||||
void* GetUserData() const;
|
||||
b2BodyUserData& GetUserData();
|
||||
|
||||
/// Set the user data. Use this to store your application specific data.
|
||||
void SetUserData(void* data);
|
||||
void SetUserData(b2BodyUserData& data);
|
||||
|
||||
/// Get the parent world of this body.
|
||||
b2World* GetWorld();
|
||||
@@ -398,7 +395,7 @@ private:
|
||||
friend class b2ContactManager;
|
||||
friend class b2ContactSolver;
|
||||
friend class b2Contact;
|
||||
|
||||
|
||||
friend class b2DistanceJoint;
|
||||
friend class b2FrictionJoint;
|
||||
friend class b2GearJoint;
|
||||
@@ -471,7 +468,7 @@ private:
|
||||
|
||||
float m_sleepTime;
|
||||
|
||||
void* m_userData;
|
||||
b2BodyUserData m_userData;
|
||||
};
|
||||
|
||||
inline b2BodyType b2Body::GetType() const
|
||||
@@ -734,16 +731,16 @@ inline const b2Body* b2Body::GetNext() const
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline void b2Body::SetUserData(void* data)
|
||||
{
|
||||
m_userData = data;
|
||||
}
|
||||
|
||||
inline void* b2Body::GetUserData() const
|
||||
inline b2BodyUserData& b2Body::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Body::SetUserData(b2BodyUserData& userData)
|
||||
{
|
||||
m_userData = userData;
|
||||
}
|
||||
|
||||
inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point, bool wake)
|
||||
{
|
||||
if (m_type != b2_dynamicBody)
|
||||
|
||||
Reference in New Issue
Block a user