mirror of https://github.com/axmolengine/axmol.git
add Scene::update & addChild into CC_USE_PHYSICS scope, TestCpp compiles and runs successfully when CC_USE_PHYSICS == 0
This commit is contained in:
parent
d7704d574a
commit
ece68aafc2
|
@ -88,26 +88,22 @@ Scene* Scene::getScene()
|
|||
return this;
|
||||
}
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
void Scene::addChild(Node* child, int zOrder, int tag)
|
||||
{
|
||||
Node::addChild(child, zOrder, tag);
|
||||
#if CC_USE_PHYSICS
|
||||
addChildToPhysicsWorld(child);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Scene::update(float delta)
|
||||
{
|
||||
Node::update(delta);
|
||||
#if CC_USE_PHYSICS
|
||||
if (nullptr != _physicsWorld)
|
||||
{
|
||||
_physicsWorld->update(delta);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CC_USE_PHYSICS
|
||||
Scene *Scene::createWithPhysics()
|
||||
{
|
||||
Scene *ret = new Scene();
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
virtual Scene *getScene() override;
|
||||
|
||||
using Node::addChild;
|
||||
virtual void addChild(Node* child, int zOrder, int tag) override;
|
||||
virtual void update(float delta) override;
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
protected:
|
||||
|
@ -74,6 +72,8 @@ private:
|
|||
|
||||
#if CC_USE_PHYSICS
|
||||
public:
|
||||
virtual void addChild(Node* child, int zOrder, int tag) override;
|
||||
virtual void update(float delta) override;
|
||||
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
|
||||
static Scene *createWithPhysics();
|
||||
protected:
|
||||
|
|
|
@ -79,7 +79,7 @@ void PhysicsTestScene::toggleDebug()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifndef CC_USE_PHYSICS
|
||||
#if CC_USE_PHYSICS == 0
|
||||
void PhysicsDemoDisabled::onEnter()
|
||||
{
|
||||
auto label = LabelTTF::create("Should define CC_USE_PHYSICS\n to run this test case",
|
||||
|
|
|
@ -22,7 +22,7 @@ private:
|
|||
bool _debugDraw;
|
||||
};
|
||||
|
||||
#ifndef CC_USE_PHYSICS
|
||||
#if CC_USE_PHYSICS == 0
|
||||
class PhysicsDemoDisabled : public BaseTest
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue