Which jar has JBox2d's p5 package

Posted by Brantley Blanchard on Game Development See other posts from Game Development or by Brantley Blanchard
Published on 2013-10-06T16:24:31Z Indexed on 2013/11/06 22:11 UTC
Read the original article Hit count: 186

Filed under:
|

Using eclipse, I'm trying to write a simple hello world program in processing that simply draws a rectangle on the screen then has gravity drop it as seen in this Tutorial.

The problem is that when I try to import the p5 package, it's not resolving so I can't declare my Physics object. I tried two things.

  1. Download the zip, unzip it, then import the 3 jars (library, serialization, & testbed)

    a. import org.jbox2d.p5.*; doesn't resolve but the others do

    b. Physics physics; doesn't resolve

  2. Download the older standalone testbed jar then import it

    a. Physics physics; doesn't resolve;

Here is basically where I'm starting

import org.jbox2d.util.nonconvex.*;
import org.jbox2d.dynamics.contacts.*;
import org.jbox2d.testbed.*;
import org.jbox2d.collision.*;
import org.jbox2d.common.*;
import org.jbox2d.dynamics.joints.*;
import org.jbox2d.p5.*;
import org.jbox2d.dynamics.*;

import processing.core.PApplet;

public class MyFirstJBox2d extends PApplet  {

    Physics physics;

    public void setup() {
      size(640,480);
      frameRate(60);
      initScene();
    }

    public void draw() {
      background(0);

      if (keyPressed) {
        //Reset everything
        physics.destroy();
        initScene();
      }

    }

    public void initScene() {
      physics = new Physics(this, width, height);
      physics.setDensity(1.0f);
      physics.createRect(300,200,340,300);
    }
}

© Game Development or respective owner

Related posts about java

Related posts about jbox2d