mirror of https://github.com/axmolengine/axmol.git
issue #2771: rename PhysicsWorld::create() to PhysicsWorld::construct(), fix some bugs
This commit is contained in:
parent
a56dedb41a
commit
4efacdbcf3
|
@ -102,7 +102,7 @@ bool Scene::initWithPhysics()
|
||||||
Director * pDirector;
|
Director * pDirector;
|
||||||
CC_BREAK_IF( ! (pDirector = Director::getInstance()) );
|
CC_BREAK_IF( ! (pDirector = Director::getInstance()) );
|
||||||
this->setContentSize(pDirector->getWinSize());
|
this->setContentSize(pDirector->getWinSize());
|
||||||
CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::create(*this)));
|
CC_BREAK_IF(! (_physicsWorld = PhysicsWorld::construct(*this)));
|
||||||
|
|
||||||
this->scheduleUpdate();
|
this->scheduleUpdate();
|
||||||
// success
|
// success
|
||||||
|
|
|
@ -987,7 +987,7 @@ void PhysicsDebugDraw::drawContact()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PhysicsWorld* PhysicsWorld::create(Scene& scene)
|
PhysicsWorld* PhysicsWorld::construct(Scene& scene)
|
||||||
{
|
{
|
||||||
PhysicsWorld * world = new PhysicsWorld();
|
PhysicsWorld * world = new PhysicsWorld();
|
||||||
if(world && world->init(scene))
|
if(world && world->init(scene))
|
||||||
|
|
|
@ -121,7 +121,7 @@ public:
|
||||||
inline int getDebugDrawMask() { return _debugDrawMask; }
|
inline int getDebugDrawMask() { return _debugDrawMask; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static PhysicsWorld* create(Scene& scene);
|
static PhysicsWorld* construct(Scene& scene);
|
||||||
bool init(Scene& scene);
|
bool init(Scene& scene);
|
||||||
|
|
||||||
virtual void addBody(PhysicsBody* body);
|
virtual void addBody(PhysicsBody* body);
|
||||||
|
@ -182,10 +182,9 @@ protected:
|
||||||
|
|
||||||
class PhysicsDebugDraw
|
class PhysicsDebugDraw
|
||||||
{
|
{
|
||||||
public:
|
protected:
|
||||||
virtual bool begin();
|
virtual bool begin();
|
||||||
virtual void end();
|
virtual void end();
|
||||||
void close();
|
|
||||||
virtual void drawShape(PhysicsShape& shape);
|
virtual void drawShape(PhysicsShape& shape);
|
||||||
virtual void drawJoint(PhysicsJoint& joint);
|
virtual void drawJoint(PhysicsJoint& joint);
|
||||||
virtual void drawContact();
|
virtual void drawContact();
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
static float cpfloat2float(cpFloat f) { return f; }
|
static float cpfloat2float(cpFloat f) { return f; }
|
||||||
static cpFloat float2cpfloat(float f) { return f; }
|
static cpFloat float2cpfloat(float f) { return f; }
|
||||||
static cpBB rect2cpbb(const Rect& rect) { return cpBBNew(rect.origin.x, rect.origin.y, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); }
|
static cpBB rect2cpbb(const Rect& rect) { return cpBBNew(rect.origin.x, rect.origin.y, rect.origin.x + rect.size.width, rect.origin.y + rect.size.height); }
|
||||||
static Rect cpbb2rect(const cpBB& bb) { return Rect(bb.l, bb.b, bb.r, bb.t); }
|
static Rect cpbb2rect(const cpBB& bb) { return Rect(bb.l, bb.b, bb.r - bb.l, bb.t - bb.b); }
|
||||||
|
|
||||||
static Point* cpvs2points(const cpVect* cpvs, Point* out, int count)
|
static Point* cpvs2points(const cpVect* cpvs, Point* out, int count)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue