diff --git a/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp b/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp index eb74a8ecc2..a641086bb7 100644 --- a/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp +++ b/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp @@ -24,6 +24,7 @@ #include "CCPhysicsBodyInfo_chipmunk.h" #if CC_USE_PHYSICS +#include "chipmunk.h" NS_CC_BEGIN PhysicsBodyInfo::PhysicsBodyInfo() diff --git a/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.h b/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.h index 01e21dcada..f26e327158 100644 --- a/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.h +++ b/cocos/physics/chipmunk/CCPhysicsBodyInfo_chipmunk.h @@ -28,10 +28,11 @@ #include "base/ccConfig.h" #if CC_USE_PHYSICS -#include "chipmunk.h" #include "base/CCPlatformMacros.h" #include "base/CCRef.h" +struct cpBody; + NS_CC_BEGIN class PhysicsBodyInfo diff --git a/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp b/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp index 54041c0a85..238d6d5387 100644 --- a/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp +++ b/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp @@ -24,6 +24,7 @@ #include "CCPhysicsContactInfo_chipmunk.h" #if CC_USE_PHYSICS +#include "chipmunk.h" NS_CC_BEGIN PhysicsContactInfo::PhysicsContactInfo(PhysicsContact* contact) diff --git a/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.h b/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.h index 47900c81ff..13dde02524 100644 --- a/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.h +++ b/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.h @@ -28,7 +28,6 @@ #include "base/ccConfig.h" #if CC_USE_PHYSICS -#include "chipmunk.h" #include "base/CCPlatformMacros.h" NS_CC_BEGIN diff --git a/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp b/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp index 9443a9f36c..00d174fecf 100644 --- a/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp +++ b/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp @@ -26,6 +26,7 @@ #if CC_USE_PHYSICS #include #include +#include "chipmunk.h" NS_CC_BEGIN diff --git a/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.h b/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.h index 22c62abc5a..fca8f708ad 100644 --- a/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.h +++ b/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.h @@ -28,10 +28,11 @@ #include "base/ccConfig.h" #if CC_USE_PHYSICS -#include "chipmunk.h" #include "base/CCPlatformMacros.h" #include #include + +struct cpConstraint; NS_CC_BEGIN class PhysicsJoint; diff --git a/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp b/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp index c1b8693259..450745f7d3 100644 --- a/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp +++ b/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp @@ -26,6 +26,7 @@ #if CC_USE_PHYSICS #include #include +#include "chipmunk.h" NS_CC_BEGIN diff --git a/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.h b/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.h index c48acbce60..f760ec15a6 100644 --- a/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.h +++ b/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.h @@ -30,9 +30,12 @@ #include #include -#include "chipmunk.h" #include "base/CCPlatformMacros.h" +typedef uintptr_t cpGroup; +struct cpShape; +struct cpBody; + NS_CC_BEGIN class PhysicsShape; diff --git a/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp b/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp index 23890b2198..8290b28490 100644 --- a/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp +++ b/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.cpp @@ -28,6 +28,8 @@ #include "CCPhysicsBodyInfo_chipmunk.h" #include "CCPhysicsShapeInfo_chipmunk.h" #include "CCPhysicsJointInfo_chipmunk.h" +#include "chipmunk.h" + NS_CC_BEGIN PhysicsWorldInfo::PhysicsWorldInfo() @@ -96,5 +98,15 @@ void PhysicsWorldInfo::removeJoint(PhysicsJointInfo& joint) } } +bool PhysicsWorldInfo::isLocked() +{ + return 0 == _space->locked_private ? false : true; +} + +void PhysicsWorldInfo::step(float delta) +{ + cpSpaceStep(_space, delta); +} + NS_CC_END #endif // CC_USE_PHYSICS diff --git a/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.h b/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.h index f5e885b86d..2027dd23ac 100644 --- a/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.h +++ b/cocos/physics/chipmunk/CCPhysicsWorldInfo_chipmunk.h @@ -29,9 +29,12 @@ #if CC_USE_PHYSICS #include -#include "chipmunk.h" #include "base/CCPlatformMacros.h" #include "math/CCGeometry.h" + +struct cpSpace; + + NS_CC_BEGIN typedef Vec2 Vect; class PhysicsBodyInfo; @@ -49,8 +52,8 @@ public: void addJoint(PhysicsJointInfo& joint); void removeJoint(PhysicsJointInfo& joint); void setGravity(const Vect& gravity); - inline bool isLocked() { return 0 == _space->locked_private ? false : true; } - inline void step(float delta) { cpSpaceStep(_space, delta); } + bool isLocked(); + void step(float delta); private: PhysicsWorldInfo();