Example usage for com.badlogic.gdx.physics.box2d World getJoints

List of usage examples for com.badlogic.gdx.physics.box2d World getJoints

Introduction

In this page you can find the example usage for com.badlogic.gdx.physics.box2d World getJoints.

Prototype

public void getJoints(Array<Joint> joints) 

Source Link

Usage

From source file:com.me.mygdxgame.Entities.MydebugRenderer.java

License:Apache License

private void renderBodies(World world) {
    renderer.begin(ShapeType.Line);

    if (drawBodies || drawAABBs) {
        world.getBodies(bodies);/*ww  w  . j  a v  a  2  s  .c om*/
        for (Iterator<Body> iter = bodies.iterator(); iter.hasNext();) {
            Body body = iter.next();
            if (body.isActive() || drawInactiveBodies)
                renderBody(body);
        }
    }

    if (drawJoints) {
        world.getJoints(joints);
        for (Iterator<Joint> iter = joints.iterator(); iter.hasNext();) {
            Joint joint = iter.next();
            drawJoint(joint);
        }
    }
    renderer.end();
    if (drawContacts) {
        if (Gdx.gl10 != null)
            Gdx.gl10.glPointSize(3);
        renderer.begin(ShapeType.Point);
        for (Contact contact : world.getContactList())
            drawContact(contact);
        renderer.end();
        if (Gdx.gl10 != null)
            Gdx.gl10.glPointSize(1);
    }
}

From source file:org.box2d.r3.gdx.GDXBox2DDebugRenderer.java

License:Apache License

private void renderBodies(final World world) {
    this.renderer.begin(ShapeType.Line);

    if (this.drawBodies || this.drawAABBs) {
        world.getBodies(bodies);/*from   w  ww .  j  av  a2  s . c  o  m*/
        for (final Iterator<Body> iter = bodies.iterator(); iter.hasNext();) {
            final Body body = iter.next();
            if (body.isActive() || this.drawInactiveBodies) {
                this.renderBody(body);
            }
        }
    }

    if (this.drawJoints) {
        world.getJoints(joints);
        for (final Iterator<Joint> iter = joints.iterator(); iter.hasNext();) {
            final Joint joint = iter.next();
            this.drawJoint(joint);
        }
    }
    this.renderer.end();
    if (this.drawContacts) {
        this.renderer.begin(ShapeType.Point);
        for (final Contact contact : world.getContactList()) {
            this.drawContact(contact);
        }
        this.renderer.end();
    }
}