mirror of https://github.com/axmolengine/axmol.git
issue #1640: Updated ChipmunkTest.cpp.
This commit is contained in:
parent
4d919465a5
commit
0c28510513
|
@ -11,8 +11,8 @@ enum {
|
|||
kTagParentNode = 1,
|
||||
};
|
||||
|
||||
enum {
|
||||
Z_PHYSICS_DEBUG = 100,
|
||||
enum {
|
||||
Z_PHYSICS_DEBUG = 100,
|
||||
};
|
||||
|
||||
// callback to remove Shapes from the Space
|
||||
|
@ -51,12 +51,12 @@ ChipmunkTestLayer::ChipmunkTestLayer()
|
|||
|
||||
addNewSpriteAtPosition(ccp(200,200));
|
||||
|
||||
// menu for debug layer
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle debug", this, menu_selector(ChipmunkTestLayer::toggleDebugCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
// menu for debug layer
|
||||
CCMenuItemFont::setFontSize(18);
|
||||
CCMenuItemFont *item = CCMenuItemFont::create("Toggle debug", this, menu_selector(ChipmunkTestLayer::toggleDebugCallback));
|
||||
|
||||
CCMenu *menu = CCMenu::create(item, NULL);
|
||||
this->addChild(menu);
|
||||
menu->setPosition(ccp(VisibleRect::right().x-100, VisibleRect::top().y-60));
|
||||
|
||||
scheduleUpdate();
|
||||
|
@ -117,8 +117,8 @@ void ChipmunkTestLayer::initPhysics()
|
|||
cpSpaceAddStaticShape(m_pSpace, m_pWalls[i] );
|
||||
}
|
||||
|
||||
// Physics debug layer
|
||||
m_pDebugLayer = CCPhysicsDebugNode::create(m_pSpace);
|
||||
// Physics debug layer
|
||||
m_pDebugLayer = CCPhysicsDebugNode::create(m_pSpace);
|
||||
this->addChild(m_pDebugLayer, Z_PHYSICS_DEBUG);
|
||||
}
|
||||
|
||||
|
@ -183,10 +183,10 @@ void ChipmunkTestLayer::addNewSpriteAtPosition(CCPoint pos)
|
|||
shape->e = 0.5f; shape->u = 0.5f;
|
||||
cpSpaceAddShape(m_pSpace, shape);
|
||||
|
||||
CCPhysicsSprite *sprite = CCPhysicsSprite::createWithTexture(m_pSpriteTexture, CCRectMake(posx, posy, 85, 121));
|
||||
parent->addChild(sprite);
|
||||
|
||||
sprite->setBody(body);
|
||||
CCPhysicsSprite *sprite = CCPhysicsSprite::createWithTexture(m_pSpriteTexture, CCRectMake(posx, posy, 85, 121));
|
||||
parent->addChild(sprite);
|
||||
|
||||
sprite->setCPBody(body);
|
||||
sprite->setPosition(pos);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue