1
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ 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. \$\endgroup\$
    – Siddharth
    Commented Feb 23, 2013 at 4:39
  • \$\begingroup\$ it is my mistake. you can also remove tag cocos2d-x from the question to reduce confusion. \$\endgroup\$
    – neo
    Commented Feb 23, 2013 at 7:08
  • \$\begingroup\$ So provide me some detail on how to enable debug draw in cocos2d android. \$\endgroup\$
    – Siddharth
    Commented Feb 23, 2013 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .