1 回答

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超5個贊
你說不能new 是不是因?yàn)闆]有添加相應(yīng)的文件,按照以下流程試一下看看:
1.在你對應(yīng)的cocos2d-x庫資源中找到文件:GLES-Render.h 和 GLES-Render.cpp
把他們拷貝到你的項(xiàng)目里面去并引用;
2.創(chuàng)建世界的時(shí)候加上這些
GLESDebugDraw * _debugDraw = new GLESDebugDraw(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);
3.添加或者修改 draw 方法
void PlayLayer::draw()
{
//
// IMPORTANT:
// This is only for debug purposes
// It is recommend to disable it
CCLayer::draw();
ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
kmGLPushMatrix();
world->DrawDebugData();
kmGLPopMatrix();
CHECK_GL_ERROR_DEBUG();
}
- 1 回答
- 0 關(guān)注
- 1041 瀏覽
添加回答
舉報(bào)