java - Processing with JBox2d Hellow World issue -


using eclipse, i'm trying write simple hello world program in processing draws rectangle on screen has gravity drop seen in this tutorial.

the problem when try import p5 package, it's not resolving can't declare physics object. tried 2 things.

  1. download zip, unzip it, import 3 jars (library, serialization, & testbed)

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

    b. physics physics; doesn't resolve

  2. download older standalone testbed jar import it

    a. physics physics; doesn't resolve;

here 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         physics.destroy();         initscene();       }      }      public void initscene() {       physics = new physics(this, width, height);       physics.setdensity(1.0f);       physics.createrect(300,200,340,300);     } } 

everything in zip file tutorial.

all classes in org.jbox2d.p5 contained in boxwrap2d.jar. add physics.java (plus other dependent java files) source path.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -