I'm trying to make a class that would draw objects of my JBox2d's world onto a canvas.
On update I have a call to
render.draw(canvas,world);
which passes the world and the canvas to the drawing class, which will be supposed to cycle through the world's objects and draw them into a canvas.
public void draw(Canvas canvas, World world)
{
canvas.drawColor(0xFF6699FF);
for ( Body b = world.getBodyList(); b!=null; b.getNext() )
{
Log.e("xy", String.valueOf( b.getPosition().x )+" "+String.valueOf( b.getPosition().y ) );
}
}
yet it seems to go into an infinite loop, back button doesn't work, then it says "not responding" and offers to forceclose.
Any ideas what's the right way to cycle through the bodies in this case?
Thanks!