Using Processing libraries - in a Java file in a Processing sketch? -
somewhat of followup how utilize public class frome .java file in other processing tabs?; using illustration usage class .java file - there total doc that? - processing 2.x , 3.x forum, have this:
/tmp/sketch/sketch.pde
// forum.processing.org/two/discussion/3677/ // usage-class-from-java-file-is-there-a-full-doc-for-that foo tester; void setup() { size(600, 400, java2d); smooth(4); noloop(); clear(); rectmode(foo.mode); fill(#0080ff); stroke(#ff0000); strokeweight(3); tester = new foo(this); tester.drawbox(); }
/tmp/sketch/foo.java
import java.io.serializable; //import peasy.org.apache.commons.math.geometry.rotation; //import peasy.org.apache.commons.math.geometry.vector3d; import processing.core.papplet; import processing.core.pgraphics; public class foo implements serializable { static final int gap = 15; static final int mode = papplet.corner; final papplet p; foo(papplet pa) { p = pa; } void drawbox() { p.rect(gap, gap, p.width - gap*2, p.height - gap*2); } }
the illustration runs fine - if uncomment import peasy.org...
lines, compilation fails with:
the bundle "peasy" not exist. might missing library. libraries must installed in folder named 'libraries' within 'sketchbook' folder.
of course, have peasycam installed, under /path/to/processing-2.1.1/modes/java/libraries/peasycam/
- , works fine, if import peasy.*;
.pde
sketch.
i guess, has paths - apparently pure java files in sketch, not refer same library paths .pde files in sketch.
is possible sketch compile import peasy.org...
lines (other than, guess, copying/symlinking peasycam
library in sketch folder, here /tmp/sketch/
<--- edit: tried symlinking described, doesn't work; same error reported)?
this larn processing isn't actually java, has similar(ish) syntax , can run code in jvm aggregating .pde files single class can compiled running on jvm. processing has own rules dealing imports , like.
why not exclusively in processing instead?
class foo { static int mode = ...; static int gap = ...; papplet sketch; public foo(papplet _sketch) { sketch = _sketch; ... } void drawbox() { sketch.rect(gap, gap, p.width - gap*2, p.height - gap*2); } ... }
and create sure have in file foo.pde
or in same dir sketch, sketch loading in peasy library through regular processing import mechanism?
java processing
No comments:
Post a Comment