mirror of https://github.com/axmolengine/axmol.git
add CC_DLL for Event and Physics
This commit is contained in:
parent
cd9e42eb99
commit
9db59c0046
|
@ -39,7 +39,7 @@ class Node;
|
||||||
/**
|
/**
|
||||||
* Base class of all kinds of events.
|
* Base class of all kinds of events.
|
||||||
*/
|
*/
|
||||||
class Event : public Ref
|
class CC_DLL Event : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Type
|
enum class Type
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class EventCustom : public Event
|
class CC_DLL EventCustom : public Event
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
|
|
|
@ -49,7 +49,7 @@ class EventCustom;
|
||||||
*
|
*
|
||||||
* dispatcher->removeEventListener(listener);
|
* dispatcher->removeEventListener(listener);
|
||||||
*/
|
*/
|
||||||
class EventListenerCustom : public EventListener
|
class CC_DLL EventListenerCustom : public EventListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an event listener with type and callback.
|
/** Creates an event listener with type and callback.
|
||||||
|
|
|
@ -53,7 +53,7 @@ const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(0.1f, 0.5f, 0.5f);
|
||||||
* if you create body with createEdgeXXX, the mass and moment will be PHYSICS_INFINITY by default. and it's a static body.
|
* if you create body with createEdgeXXX, the mass and moment will be PHYSICS_INFINITY by default. and it's a static body.
|
||||||
* you can change mass and moment with setMass() and setMoment(). and you can change the body to be dynamic or static by use function setDynamic().
|
* you can change mass and moment with setMass() and setMoment(). and you can change the body to be dynamic or static by use function setDynamic().
|
||||||
*/
|
*/
|
||||||
class PhysicsBody : public Ref
|
class CC_DLL PhysicsBody : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** create a body with defult mass and moment. */
|
/** create a body with defult mass and moment. */
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PhysicsContactInfo;
|
||||||
|
|
||||||
typedef Vec2 Vect;
|
typedef Vec2 Vect;
|
||||||
|
|
||||||
typedef struct PhysicsContactData
|
typedef struct CC_DLL PhysicsContactData
|
||||||
{
|
{
|
||||||
static const int POINT_MAX = 4;
|
static const int POINT_MAX = 4;
|
||||||
Vec2 points[POINT_MAX];
|
Vec2 points[POINT_MAX];
|
||||||
|
@ -59,7 +59,7 @@ typedef struct PhysicsContactData
|
||||||
/**
|
/**
|
||||||
* @brief Contact infomation. it will created automatically when two shape contact with each other. and it will destoried automatically when two shape separated.
|
* @brief Contact infomation. it will created automatically when two shape contact with each other. and it will destoried automatically when two shape separated.
|
||||||
*/
|
*/
|
||||||
class PhysicsContact : public EventCustom
|
class CC_DLL PhysicsContact : public EventCustom
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ private:
|
||||||
/*
|
/*
|
||||||
* @brief presolve value generated when onContactPreSolve called.
|
* @brief presolve value generated when onContactPreSolve called.
|
||||||
*/
|
*/
|
||||||
class PhysicsContactPreSolve
|
class CC_DLL PhysicsContactPreSolve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** get restitution between two bodies*/
|
/** get restitution between two bodies*/
|
||||||
|
@ -160,7 +160,7 @@ private:
|
||||||
/*
|
/*
|
||||||
* @brief postsolve value generated when onContactPostSolve called.
|
* @brief postsolve value generated when onContactPostSolve called.
|
||||||
*/
|
*/
|
||||||
class PhysicsContactPostSolve
|
class CC_DLL PhysicsContactPostSolve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** get restitution between two bodies*/
|
/** get restitution between two bodies*/
|
||||||
|
@ -181,7 +181,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/* contact listener. it will recive all the contact callbacks. */
|
/* contact listener. it will recive all the contact callbacks. */
|
||||||
class EventListenerPhysicsContact : public EventListenerCustom
|
class CC_DLL EventListenerPhysicsContact : public EventListenerCustom
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** create the listener */
|
/** create the listener */
|
||||||
|
@ -227,7 +227,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** this event listener only be called when bodyA and bodyB have contacts */
|
/** this event listener only be called when bodyA and bodyB have contacts */
|
||||||
class EventListenerPhysicsContactWithBodies : public EventListenerPhysicsContact
|
class CC_DLL EventListenerPhysicsContactWithBodies : public EventListenerPhysicsContact
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static EventListenerPhysicsContactWithBodies* create(PhysicsBody* bodyA, PhysicsBody* bodyB);
|
static EventListenerPhysicsContactWithBodies* create(PhysicsBody* bodyA, PhysicsBody* bodyB);
|
||||||
|
@ -245,7 +245,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** this event listener only be called when shapeA and shapeB have contacts */
|
/** this event listener only be called when shapeA and shapeB have contacts */
|
||||||
class EventListenerPhysicsContactWithShapes : public EventListenerPhysicsContact
|
class CC_DLL EventListenerPhysicsContactWithShapes : public EventListenerPhysicsContact
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static EventListenerPhysicsContactWithShapes* create(PhysicsShape* shapeA, PhysicsShape* shapeB);
|
static EventListenerPhysicsContactWithShapes* create(PhysicsShape* shapeA, PhysicsShape* shapeB);
|
||||||
|
@ -263,7 +263,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** this event listener only be called when shapeA or shapeB is in the group your specified */
|
/** this event listener only be called when shapeA or shapeB is in the group your specified */
|
||||||
class EventListenerPhysicsContactWithGroup : public EventListenerPhysicsContact
|
class CC_DLL EventListenerPhysicsContactWithGroup : public EventListenerPhysicsContact
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static EventListenerPhysicsContactWithGroup* create(int group);
|
static EventListenerPhysicsContactWithGroup* create(int group);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class PhysicsBodyInfo;
|
||||||
/*
|
/*
|
||||||
* @brief An PhysicsJoint object connects two physics bodies together.
|
* @brief An PhysicsJoint object connects two physics bodies together.
|
||||||
*/
|
*/
|
||||||
class PhysicsJoint
|
class CC_DLL PhysicsJoint
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
PhysicsJoint();
|
PhysicsJoint();
|
||||||
|
@ -97,7 +97,7 @@ protected:
|
||||||
/*
|
/*
|
||||||
* @brief A fixed joint fuses the two bodies together at a reference point. Fixed joints are useful for creating complex shapes that can be broken apart later.
|
* @brief A fixed joint fuses the two bodies together at a reference point. Fixed joints are useful for creating complex shapes that can be broken apart later.
|
||||||
*/
|
*/
|
||||||
class PhysicsJointFixed : public PhysicsJoint
|
class CC_DLL PhysicsJointFixed : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointFixed* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr);
|
static PhysicsJointFixed* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr);
|
||||||
|
@ -113,7 +113,7 @@ protected:
|
||||||
/*
|
/*
|
||||||
* @brief A limit joint imposes a maximum distance between the two bodies, as if they were connected by a rope.
|
* @brief A limit joint imposes a maximum distance between the two bodies, as if they were connected by a rope.
|
||||||
*/
|
*/
|
||||||
class PhysicsJointLimit : public PhysicsJoint
|
class CC_DLL PhysicsJointLimit : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2);
|
static PhysicsJointLimit* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2);
|
||||||
|
@ -139,7 +139,7 @@ protected:
|
||||||
/*
|
/*
|
||||||
* @brief A pin joint allows the two bodies to independently rotate around the anchor point as if pinned together.
|
* @brief A pin joint allows the two bodies to independently rotate around the anchor point as if pinned together.
|
||||||
*/
|
*/
|
||||||
class PhysicsJointPin : public PhysicsJoint
|
class CC_DLL PhysicsJointPin : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointPin* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr);
|
static PhysicsJointPin* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr);
|
||||||
|
@ -153,7 +153,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Set the fixed distance with two bodies */
|
/** Set the fixed distance with two bodies */
|
||||||
class PhysicsJointDistance : public PhysicsJoint
|
class CC_DLL PhysicsJointDistance : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointDistance* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2);
|
static PhysicsJointDistance* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2);
|
||||||
|
@ -170,7 +170,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Connecting two physics bodies together with a spring. */
|
/** Connecting two physics bodies together with a spring. */
|
||||||
class PhysicsJointSpring : public PhysicsJoint
|
class CC_DLL PhysicsJointSpring : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointSpring* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2, float stiffness, float damping);
|
static PhysicsJointSpring* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& anchr1, const Vec2& anchr2, float stiffness, float damping);
|
||||||
|
@ -194,7 +194,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Attach body a to a line, and attach body b to a dot */
|
/** Attach body a to a line, and attach body b to a dot */
|
||||||
class PhysicsJointGroove : public PhysicsJoint
|
class CC_DLL PhysicsJointGroove : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointGroove* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& grooveA, const Vec2& grooveB, const Vec2& anchr2);
|
static PhysicsJointGroove* construct(PhysicsBody* a, PhysicsBody* b, const Vec2& grooveA, const Vec2& grooveB, const Vec2& anchr2);
|
||||||
|
@ -215,7 +215,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Likes a spring joint, but works with rotary */
|
/** Likes a spring joint, but works with rotary */
|
||||||
class PhysicsJointRotarySpring : public PhysicsJoint
|
class CC_DLL PhysicsJointRotarySpring : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointRotarySpring* construct(PhysicsBody* a, PhysicsBody* b, float stiffness, float damping);
|
static PhysicsJointRotarySpring* construct(PhysicsBody* a, PhysicsBody* b, float stiffness, float damping);
|
||||||
|
@ -236,7 +236,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Likes a limit joint, but works with rotary */
|
/** Likes a limit joint, but works with rotary */
|
||||||
class PhysicsJointRotaryLimit : public PhysicsJoint
|
class CC_DLL PhysicsJointRotaryLimit : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointRotaryLimit* construct(PhysicsBody* a, PhysicsBody* b, float min, float max);
|
static PhysicsJointRotaryLimit* construct(PhysicsBody* a, PhysicsBody* b, float min, float max);
|
||||||
|
@ -256,7 +256,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Works like a socket wrench. */
|
/** Works like a socket wrench. */
|
||||||
class PhysicsJointRatchet : public PhysicsJoint
|
class CC_DLL PhysicsJointRatchet : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointRatchet* construct(PhysicsBody* a, PhysicsBody* b, float phase, float ratchet);
|
static PhysicsJointRatchet* construct(PhysicsBody* a, PhysicsBody* b, float phase, float ratchet);
|
||||||
|
@ -277,7 +277,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Keeps the angular velocity ratio of a pair of bodies constant. */
|
/** Keeps the angular velocity ratio of a pair of bodies constant. */
|
||||||
class PhysicsJointGear : public PhysicsJoint
|
class CC_DLL PhysicsJointGear : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointGear* construct(PhysicsBody* a, PhysicsBody* b, float phase, float ratio);
|
static PhysicsJointGear* construct(PhysicsBody* a, PhysicsBody* b, float phase, float ratio);
|
||||||
|
@ -296,7 +296,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Keeps the relative angular velocity of a pair of bodies constant */
|
/** Keeps the relative angular velocity of a pair of bodies constant */
|
||||||
class PhysicsJointMotor : public PhysicsJoint
|
class CC_DLL PhysicsJointMotor : public PhysicsJoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsJointMotor* construct(PhysicsBody* a, PhysicsBody* b, float rate);
|
static PhysicsJointMotor* construct(PhysicsBody* a, PhysicsBody* b, float rate);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class PhysicsBody;
|
||||||
class PhysicsBodyInfo;
|
class PhysicsBodyInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef struct PhysicsMaterial
|
typedef struct CC_DLL PhysicsMaterial
|
||||||
{
|
{
|
||||||
float density; ///< The density of the object.
|
float density; ///< The density of the object.
|
||||||
float restitution; ///< The bounciness of the physics body.
|
float restitution; ///< The bounciness of the physics body.
|
||||||
|
@ -62,7 +62,7 @@ const PhysicsMaterial PHYSICSSHAPE_MATERIAL_DEFAULT(0.0f, 0.5f, 0.5f);
|
||||||
/**
|
/**
|
||||||
* @brief A shape for body. You do not create PhysicsWorld objects directly, instead, you can view PhysicsBody to see how to create it.
|
* @brief A shape for body. You do not create PhysicsWorld objects directly, instead, you can view PhysicsBody to see how to create it.
|
||||||
*/
|
*/
|
||||||
class PhysicsShape : public Ref
|
class CC_DLL PhysicsShape : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Type
|
enum class Type
|
||||||
|
@ -192,7 +192,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A circle shape */
|
/** A circle shape */
|
||||||
class PhysicsShapeCircle : public PhysicsShape
|
class CC_DLL PhysicsShapeCircle : public PhysicsShape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeCircle* create(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2(0, 0));
|
static PhysicsShapeCircle* create(float radius, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2(0, 0));
|
||||||
|
@ -219,7 +219,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A polygon shape */
|
/** A polygon shape */
|
||||||
class PhysicsShapePolygon : public PhysicsShape
|
class CC_DLL PhysicsShapePolygon : public PhysicsShape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapePolygon* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2::ZERO);
|
static PhysicsShapePolygon* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2::ZERO);
|
||||||
|
@ -243,7 +243,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A box shape */
|
/** A box shape */
|
||||||
class PhysicsShapeBox : public PhysicsShapePolygon
|
class CC_DLL PhysicsShapeBox : public PhysicsShapePolygon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2::ZERO);
|
static PhysicsShapeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, const Vec2& offset = Vec2::ZERO);
|
||||||
|
@ -260,7 +260,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A segment shape */
|
/** A segment shape */
|
||||||
class PhysicsShapeEdgeSegment : public PhysicsShape
|
class CC_DLL PhysicsShapeEdgeSegment : public PhysicsShape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeEdgeSegment* create(const Vec2& a, const Vec2& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
static PhysicsShapeEdgeSegment* create(const Vec2& a, const Vec2& b, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
||||||
|
@ -281,7 +281,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** An edge polygon shape */
|
/** An edge polygon shape */
|
||||||
class PhysicsShapeEdgePolygon : public PhysicsShape
|
class CC_DLL PhysicsShapeEdgePolygon : public PhysicsShape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeEdgePolygon* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
static PhysicsShapeEdgePolygon* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
||||||
|
@ -301,7 +301,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** An edge box shape */
|
/** An edge box shape */
|
||||||
class PhysicsShapeEdgeBox : public PhysicsShapeEdgePolygon
|
class CC_DLL PhysicsShapeEdgeBox : public PhysicsShapeEdgePolygon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeEdgeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 0, const Vec2& offset = Vec2::ZERO);
|
static PhysicsShapeEdgeBox* create(const Size& size, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 0, const Vec2& offset = Vec2::ZERO);
|
||||||
|
@ -318,7 +318,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** a chain shape */
|
/** a chain shape */
|
||||||
class PhysicsShapeEdgeChain : public PhysicsShape
|
class CC_DLL PhysicsShapeEdgeChain : public PhysicsShape
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static PhysicsShapeEdgeChain* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
static PhysicsShapeEdgeChain* create(const Vec2* points, int count, const PhysicsMaterial& material = PHYSICSSHAPE_MATERIAL_DEFAULT, float border = 1);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "base/CCVector.h"
|
#include "base/CCVector.h"
|
||||||
#include "base/CCRef.h"
|
#include "base/CCRef.h"
|
||||||
#include "math/CCGeometry.h"
|
#include "math/CCGeometry.h"
|
||||||
|
#include "physics/CCPhysicsBody.h"
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -80,7 +80,7 @@ typedef PhysicsQueryRectCallbackFunc PhysicsQueryPointCallbackFunc;
|
||||||
/**
|
/**
|
||||||
* @brief An PhysicsWorld object simulates collisions and other physical properties. You do not create PhysicsWorld objects directly; instead, you can get it from an Scene object.
|
* @brief An PhysicsWorld object simulates collisions and other physical properties. You do not create PhysicsWorld objects directly; instead, you can get it from an Scene object.
|
||||||
*/
|
*/
|
||||||
class PhysicsWorld
|
class CC_DLL PhysicsWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const int DEBUGDRAW_NONE; ///< draw nothing
|
static const int DEBUGDRAW_NONE; ///< draw nothing
|
||||||
|
|
Loading…
Reference in New Issue