mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Update to box2d 2.4.1
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#ifndef B2_JOINT_H
|
||||
#define B2_JOINT_H
|
||||
|
||||
#include "b2_api.h"
|
||||
#include "b2_math.h"
|
||||
|
||||
class b2Body;
|
||||
@@ -47,7 +48,7 @@ enum b2JointType
|
||||
e_motorJoint
|
||||
};
|
||||
|
||||
struct b2Jacobian
|
||||
struct B2_API b2Jacobian
|
||||
{
|
||||
b2Vec2 linear;
|
||||
float angularA;
|
||||
@@ -59,7 +60,7 @@ struct b2Jacobian
|
||||
/// is an edge. A joint edge belongs to a doubly linked list
|
||||
/// maintained in each attached body. Each joint has two joint
|
||||
/// nodes, one for each attached body.
|
||||
struct b2JointEdge
|
||||
struct B2_API b2JointEdge
|
||||
{
|
||||
b2Body* other; ///< provides quick access to the other body attached.
|
||||
b2Joint* joint; ///< the joint
|
||||
@@ -68,12 +69,11 @@ struct b2JointEdge
|
||||
};
|
||||
|
||||
/// Joint definitions are used to construct joints.
|
||||
struct b2JointDef
|
||||
struct B2_API b2JointDef
|
||||
{
|
||||
b2JointDef()
|
||||
{
|
||||
type = e_unknownJoint;
|
||||
userData = nullptr;
|
||||
bodyA = nullptr;
|
||||
bodyB = nullptr;
|
||||
collideConnected = false;
|
||||
@@ -83,7 +83,7 @@ struct b2JointDef
|
||||
b2JointType type;
|
||||
|
||||
/// Use this to attach application specific data to your joints.
|
||||
void* userData;
|
||||
b2JointUserData userData;
|
||||
|
||||
/// The first attached body.
|
||||
b2Body* bodyA;
|
||||
@@ -96,18 +96,18 @@ struct b2JointDef
|
||||
};
|
||||
|
||||
/// Utility to compute linear stiffness values from frequency and damping ratio
|
||||
void b2LinearStiffness(float& stiffness, float& damping,
|
||||
B2_API void b2LinearStiffness(float& stiffness, float& damping,
|
||||
float frequencyHertz, float dampingRatio,
|
||||
const b2Body* bodyA, const b2Body* bodyB);
|
||||
|
||||
/// Utility to compute rotational stiffness values frequency and damping ratio
|
||||
void b2AngularStiffness(float& stiffness, float& damping,
|
||||
B2_API void b2AngularStiffness(float& stiffness, float& damping,
|
||||
float frequencyHertz, float dampingRatio,
|
||||
const b2Body* bodyA, const b2Body* bodyB);
|
||||
|
||||
/// The base joint class. Joints are used to constraint two bodies together in
|
||||
/// various fashions. Some joints also feature limits and motors.
|
||||
class b2Joint
|
||||
class B2_API b2Joint
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -137,10 +137,10 @@ public:
|
||||
const b2Joint* GetNext() const;
|
||||
|
||||
/// Get the user data pointer.
|
||||
void* GetUserData() const;
|
||||
b2JointUserData& GetUserData();
|
||||
|
||||
/// Set the user data pointer.
|
||||
void SetUserData(void* data);
|
||||
void SetUserData(b2JointUserData& userData);
|
||||
|
||||
/// Short-cut function to determine if either body is enabled.
|
||||
bool IsEnabled() const;
|
||||
@@ -190,7 +190,7 @@ protected:
|
||||
bool m_islandFlag;
|
||||
bool m_collideConnected;
|
||||
|
||||
void* m_userData;
|
||||
b2JointUserData m_userData;
|
||||
};
|
||||
|
||||
inline b2JointType b2Joint::GetType() const
|
||||
@@ -218,14 +218,14 @@ inline const b2Joint* b2Joint::GetNext() const
|
||||
return m_next;
|
||||
}
|
||||
|
||||
inline void* b2Joint::GetUserData() const
|
||||
inline b2JointUserData& b2Joint::GetUserData()
|
||||
{
|
||||
return m_userData;
|
||||
}
|
||||
|
||||
inline void b2Joint::SetUserData(void* data)
|
||||
inline void b2Joint::SetUserData(b2JointUserData& userData)
|
||||
{
|
||||
m_userData = data;
|
||||
m_userData = userData;
|
||||
}
|
||||
|
||||
inline bool b2Joint::GetCollideConnected() const
|
||||
|
||||
Reference in New Issue
Block a user