Game Development Reference
In-Depth Information
PTM_RATIO );
world->SetDebugDraw(_debugDraw);
uint32 flags = 0;
flags += b2Draw::e_shapeBit;
// flags += b2Draw::e_jointBit;
// flags += b2Draw::e_aabbBit;
// flags += b2Draw::e_pairBit;
// flags += b2Draw::e_centerOfMassBit;
_debugDraw->SetFlags(flags);
}
void HelloWorld::update(float dt)
{
world->Step(dt, 8, 1);
}
9. Now comes the implementation of the draw methods. You can copy and paste
most of this code from the Box2DTest folder:
void GameLayer::draw(Renderer *renderer, const Mat4
&transform, uint32_t flags)
{
//
// IMPORTANT:
// This is only for debug purposes
// It is recommended to disable it
//
Layer::draw(renderer, transform, flags);
GL::enableVertexAttribs(
cocos2d::GL::VERTEX_ATTRIB_FLAG_POSITION );
auto director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null
when setting matrix stack");
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
_modelViewMV =
Search WWH ::




Custom Search