Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to implement debug render for cocos2d android.So I can view how bodies are created. Right now I use gdx.jar file for box2d and load that jar file following way.

static {
      System.loadLibrary("gdx.jar");
}

All the desire bodies are created but I need box2d debug renderer. I have search many place for this question but I could not found anything. So please anybody has knowledge regarding this then suggest me.

share|improve this question

1 Answer 1

You can use GLES_Render class in TestCpp, which is located in

 ./samples/TestCpp/Classes/Box2DTestBed/GLES-Render.cpp
 ./samples/TestCpp/Classes/Box2DTestBed/GLES-Render.h

of the download package.

To implement the debug draw, you can draw the debug renderer with your world data after CLayer::draw(); as demonstrated in samples/TestCpp/Classes/Box2DTestBed/Box2dView.cpp ,

void Box2DView::draw()
{
    CCLayer::draw();

    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );

    kmGLPushMatrix();

    m_test->m_world->DrawDebugData();

    kmGLPopMatrix();

    CHECK_GL_ERROR_DEBUG();
}

If you are using old cocos2d-x library you have follow guide here.

share|improve this answer
    
I think you misunderstood the platform. I am working on cocos2d android where I don't found anything you said so please give me other information that I can use. Cocos2d-Android is totally based on Java. –  Siddharth Feb 23 '13 at 4:39
    
it is my mistake. you can also remove tag cocos2d-x from the question to reduce confusion. –  neo Feb 23 '13 at 7:08
    
So provide me some detail on how to enable debug draw in cocos2d android. –  Siddharth Feb 23 '13 at 12:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.