Java Code Examples for processing.core.PApplet#runSketch()

The following examples show how to use processing.core.PApplet#runSketch() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlaneCalibrationTest.java    From PapARt with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void checkXML() {
    sketch = new Sketch();         String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"};         PApplet.runSketch(args, sketch);
    instance = new PlaneCalibration();

    XML root = sketch.loadXML(Common.currentPath + Common.PlaneCalibration);
    assertTrue(root.getName() == Calibration.CALIBRATION_XML_NAME);

    XML planeNode = root.getChild(PlaneCalibration.PLANE_XML_NAME);
    assertNotNull(planeNode);

    XML posNode = planeNode.getChild(PlaneCalibration.PLANE_POS_XML_NAME);
    assertNotNull(posNode);
    XML normalNode = planeNode.getChild(PlaneCalibration.PLANE_NORMAL_XML_NAME);
    assertNotNull(normalNode);
    XML heightNode = planeNode.getChild(PlaneCalibration.PLANE_HEIGHT_XML_NAME);
    assertNotNull(heightNode);

    assertTrue(heightNode.getFloat(PlaneCalibration.PLANE_HEIGHT_XML_NAME) == DEFAULT_PLANE_HEIGHT);
}
 
Example 2
Source File: ProjectiveCalibrationTest.java    From PapARt with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void CreateValues() {
    sketch = new Sketch();         String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"};         PApplet.runSketch(args, sketch);

    ProjectiveDeviceCalibration calibNoExtr;
    calibNoExtr = new ProjectiveDeviceCalibration();
    calibNoExtr.setIntrinsics(createDummyValues());
    calibNoExtr.setExtrinsics(identity());
    calibNoExtr.saveTo(sketch, Common.currentPath + Common.ProjectiveCalibrationNoExtrinsics);

    ProjectiveDeviceCalibration calibExtr;
    calibExtr = new ProjectiveDeviceCalibration();
    calibExtr.setIntrinsics(createDummyValues());
    calibExtr.setExtrinsics(createDummyValues());
    calibExtr.saveTo(sketch, Common.currentPath + Common.ProjectiveCalibrationExtrinsics);
}
 
Example 3
Source File: ProjectiveCalibrationTest.java    From PapARt with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void checkLoad() {
    sketch = new Sketch();
    String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"};
    PApplet.runSketch(args, sketch);
    
    instance = new ProjectiveDeviceCalibration();
    instance.loadFrom(sketch, Common.currentPath + Common.ProjectiveCalibrationNoExtrinsics);

    assertFalse(instance.hasExtrinsics());
    checkValuesOf(instance.getIntrinsics());

    instance.loadFrom(sketch, Common.currentPath + Common.ProjectiveCalibrationExtrinsics);

    assertTrue(instance.hasExtrinsics());
    checkValuesOf(instance.getIntrinsics());
    checkValuesOf(instance.getExtrinsics());
}
 
Example 4
Source File: ControlWindow.java    From sketch-mapper with MIT License 6 votes vote down vote up
public ControlWindow(PApplet parent, int w, int h, SurfaceMapper surfaceMapper, SketchMapper sketchMapper) {
	super();
	this.parent = parent;
	this.w = w;
	this.h = h;
	this.surfaceMapper = surfaceMapper;
	this.sketchMapper = sketchMapper;
	PApplet.runSketch(new String[] { this.getClass().getName() }, this);
	
	noLoop(); //Stop draw. ControlP5 throws an exception when dynamically adds controls and draw at the same time.
	controlP5 = new ControlP5(this);
	programOptions = new ProgramOptionsMenu(this, controlP5);
	quadOptions = new QuadOptionsMenu(sketchMapper, this, controlP5);
	bezierOptions = new BezierOptionsMenu(sketchMapper, this, controlP5);
	controlP5.addListener((ControlListener) this::controlEventDelegate);
	loop(); //Continue drawing.
}
 
Example 5
Source File: MultipleWindows.java    From PixelFlow with MIT License 5 votes vote down vote up
public ChildApplet(int window_id, int vx, int vy, int vw, int vh) {
  super();
  this.window_id = window_id;
  this.vx = vx;
  this.vy = vy;
  this.vw = vw;
  this.vh = vh;
  
  PApplet.runSketch(new String[] { this.getClass().getName() }, this);
}
 
Example 6
Source File: PlaneCalibrationTest.java    From PapARt with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void checkLoad() {
    sketch = new Sketch();         String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"};         PApplet.runSketch(args, sketch);
    instance = new PlaneCalibration();
    instance.loadFrom(sketch, Common.currentPath + Common.PlaneCalibration);
    checkPlane(instance);
}
 
Example 7
Source File: RLangPApplet.java    From Processing.R with GNU General Public License v3.0 4 votes vote down vote up
public void runBlock(final String[] arguments) throws RSketchError {
  log("runBlock");
  PApplet.runSketch(arguments, this);
  try {
    finishedLatch.await();
    log("RunSketch done.");
  } catch (final InterruptedException interrupted) {
    // Treat an interruption as a request to the applet to terminate.
    exit();
    try {
      finishedLatch.await();
      log("RunSketch interrupted.");
    } catch (final InterruptedException exception) {
      log(exception.toString());
    }
  } finally {
    Thread.setDefaultUncaughtExceptionHandler(null);
    if (PApplet.platform == PConstants.MACOSX
        && Arrays.asList(arguments).contains("fullScreen")) {
      // Frame should be OS-X fullscreen, and it won't stop being that unless the jvm
      // exits or we explicitly tell it to minimize.
      // (If it's disposed, it'll leave a gray blank window behind it.)
      log("Disabling fullscreen.");
      macosxFullScreenToggle(frame);
    }
    if (surface instanceof PSurfaceFX) {
      // Sadly, JavaFX is an abomination, and there's no way to run an FX sketch more than once,
      // so we must actually exit.
      log("JavaFX requires SketchRunner to terminate. Farewell!");
      System.exit(0);
    }
    final Object nativeWindow = surface.getNative();
    if (nativeWindow instanceof com.jogamp.newt.Window) {
      ((com.jogamp.newt.Window) nativeWindow).destroy();
    } else {
      surface.setVisible(false);
    }
  }
  // log(terminalException.toString());
  if (terminalException != null) {
    log("Throw the exception to PDE.");
    throw terminalException;
  }
}
 
Example 8
Source File: PlaneCalibrationTest.java    From PapARt with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void createInstanceAndSketch() {
    sketch = new Sketch();         String[] args = new String[]{"--present", "test.fr.inria.papart.calibration.ProjectiveCalibrationTest"};         PApplet.runSketch(args, sketch);
    instance = createPlane();
}