fix chipmunk

This commit is contained in:
andyque 2014-08-30 16:29:06 +08:00
parent 2c068cd1f5
commit ff321ba1dc
10 changed files with 30 additions and 7 deletions

View File

@ -24,6 +24,7 @@
#include "CCPhysicsBodyInfo_chipmunk.h"
#if CC_USE_PHYSICS
#include "chipmunk.h"
NS_CC_BEGIN
PhysicsBodyInfo::PhysicsBodyInfo()

View File

@ -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

View File

@ -24,6 +24,7 @@
#include "CCPhysicsContactInfo_chipmunk.h"
#if CC_USE_PHYSICS
#include "chipmunk.h"
NS_CC_BEGIN
PhysicsContactInfo::PhysicsContactInfo(PhysicsContact* contact)

View File

@ -28,7 +28,6 @@
#include "base/ccConfig.h"
#if CC_USE_PHYSICS
#include "chipmunk.h"
#include "base/CCPlatformMacros.h"
NS_CC_BEGIN

View File

@ -26,6 +26,7 @@
#if CC_USE_PHYSICS
#include <algorithm>
#include <unordered_map>
#include "chipmunk.h"
NS_CC_BEGIN

View File

@ -28,10 +28,11 @@
#include "base/ccConfig.h"
#if CC_USE_PHYSICS
#include "chipmunk.h"
#include "base/CCPlatformMacros.h"
#include <vector>
#include <unordered_map>
struct cpConstraint;
NS_CC_BEGIN
class PhysicsJoint;

View File

@ -26,6 +26,7 @@
#if CC_USE_PHYSICS
#include <algorithm>
#include <unordered_map>
#include "chipmunk.h"
NS_CC_BEGIN

View File

@ -30,9 +30,12 @@
#include <vector>
#include <unordered_map>
#include "chipmunk.h"
#include "base/CCPlatformMacros.h"
typedef uintptr_t cpGroup;
struct cpShape;
struct cpBody;
NS_CC_BEGIN
class PhysicsShape;

View File

@ -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

View File

@ -29,9 +29,12 @@
#if CC_USE_PHYSICS
#include <vector>
#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();