and i’ve done everything listed in it. i downloaded sample code and everything is working in theory, i stepped over every instruction through debugging and it does what it is supposed to do, but nothing shows on screen
GLESDebugDraw::DrawSolidCircle is called, it does what it is supposed to do but nothing comes up on the screen
unfortunately, that doesn’t fix the problem we’re having. this flag draws a square border for each sprite, and it works perfectly in doing that
however what we are trying to figure out is how to show the bodies created in box2d. these are not necessarily square. if you want to check out what i mean, you can run the “tests” project in cocos2d-x and select the box2d testbed (http://i.imgur.com/2PDHp.png)
you’ll see samples of box2d’s drawDebugData feature. (http://i.imgur.com/ItfYz.png) it draws the bodies created in box2d using the GLESDebugDraw class, found in file GLES-Render.cpp
what i’m trying to do here is to have the bodies drawn on top of my sprites, so i can see how they relate in my gameplay screen
i’ve done that before in cocos2d for iPhone, but i have since quit the studio i used to work for and i don’t have access to the code
after a lot of trial and error the one thing that was messing it up was the parameter in the GLESDebugDraw initialization.
turns out if you do this m_b2dDebugDraw = new GLESDebugDraw( PTM_RATIO ); it’ll create VERY small bodies, who are by all means invisible
does the debugdraw layer show over or under the sprites? i got them to show but they’re behind the sprites so i can’t really see what i want to see unless it’s a transparent sprite
what i wanted was for the box2d debugdrawdata to show on top of my sprite. right now, i can’t tell where the actual box2d bodies are because the debug draw data is behind the sprites
like this
there are 2 bodies in this picture, a circle and a square. however, only half of the circle is show because the sprite for the square is on top of the body for the square
i wanted the pink circle to be drawn ON TOP of everything, so i could see when they collided
I think on my view of perspective i dont think u can draw debug on top of sprite. But there is only one way out u can try setting alpha for sprite and u can see both.
And about the color for draw debug data, u can go look into DrawDebugData() in b2World.cpp, u will find lots of if conditions like e_shapeBit, e_jointBit, e_pairBit, etc. there u will be seeing line
DrawShape(f, xf, b2Color(0.5f, 0.5f, 0.3f)); try to change the values in 3rd parameter in the function to get the exact color u want.
hi again. which version of cocos2d-x are you using ? i am getting errors even after including those files. i am using version 11 with visual studio 10.
now, i got to know that the draw method gets called automatically.
i was thinking where is it being called. and so i was not implementing it thanks for all the help
one thing is missing