logo
down
shadow

In a Processing sketch, can I control the position of the display window?


In a Processing sketch, can I control the position of the display window?

By : charith
Date : November 17 2020, 01:00 AM
it should still fix some issue Assuming you're talking about Java mode, then you have access to a variable called frame.
However, the frame variable does not seem to be available until after the setup() function finishes, so you have to access it after that. This works for me:
code :
boolean frameMoved = false;

void setup() {
  size(500, 500);
}

void draw() {

  if(!frameMoved){
    frame.setLocation(100, 100);
    frameMoved = true;
  }

  background(0);
}


Share : facebook icon twitter icon
Load processing.js sketch after window is fully loaded with innerHTML?

Load processing.js sketch after window is fully loaded with innerHTML?


By : Trọng Đại Tran
Date : March 29 2020, 07:55 AM
Any of those help it's not so much canvas not working as it's Processing.js not looking for DOM insertions for canvas to load sketches; it only does a general pass for sketches to load on DOM content loaded. Since you want your sketch injected after that, you can either trigger a reparse (by calling Processing.reload(), which will reset everything, so if you have other sketches on the same page that should not be reset, don't use that) or you can call
code :
var sourceList = ['file1.pde','file2.pde','...',...];
var canvas = document.querySelector("#mycanvas");
Processing.loadSketchFromSources(canvas, sourceList);
Create more than one window of a single sketch in Processing

Create more than one window of a single sketch in Processing


By : Brendoni
Date : March 29 2020, 07:55 AM
hop of those help? You need to create a new frame and a new PApplet... here's a sample sketch:
code :
import javax.swing.*; 
SecondApplet s;
void setup() {
  size(640, 480);
  PFrame f = new PFrame(width, height);
  frame.setTitle("first window");
  f.setTitle("second window");
  fill(0);
}
void draw() {
  background(255);
  ellipse(mouseX, mouseY, 10, 10);
  s.setGhostCursor(mouseX, mouseY);
}
public class PFrame extends JFrame {
  public PFrame(int width, int height) {
    setBounds(100, 100, width, height);
    s = new SecondApplet();
    add(s);
    s.init();
    show();
  }
}
public class SecondApplet extends PApplet {
  int ghostX, ghostY;
  public void setup() {
    background(0);
    noStroke();
  }

  public void draw() {
    background(50);
    fill(255);
    ellipse(mouseX, mouseY, 10, 10);
    fill(0);
    ellipse(ghostX, ghostY, 10, 10);
  }
  public void setGhostCursor(int ghostX, int ghostY) {
    this.ghostX = ghostX;
    this.ghostY = ghostY;
  }
}
Hide Print Queue window during Processing sketch (present mode) in Mac OS X 10.10.3

Hide Print Queue window during Processing sketch (present mode) in Mac OS X 10.10.3


By : user3681984
Date : March 29 2020, 07:55 AM
seems to work fine I solved this with the help of a great little article in CNET - "Keep applications from stealing focus when opening in OS X." Followed the steps for launching programmes behind others with the print driver and it works a charm.
http://www.cnet.com/uk/news/keep-applications-from-stealing-focus-when-opening-in-os-x/
How to create more than one window of a single sketch in Processing?

How to create more than one window of a single sketch in Processing?


By : ConstantineMaximus
Date : March 29 2020, 07:55 AM
wish helps you The reason for the error message is pretty self-explanatory: the add() function is expecting a Component, and PApplet is not a Component. This is because PApplet no longer extends Applet as of Processing 3, so old code that uses it as a Component will no longer work.
Instead, consider my answer to this question. Basically, just create a class that extends PApplet for your second window, and then call PApplet.runSketch() using that second PApplet as a parameter:
code :
void setup() {
  size(100, 100);

  String[] args = {"TwoFrameTest"};
  SecondApplet sa = new SecondApplet();
  PApplet.runSketch(args, sa);
}

void draw() {
  background(0);
  ellipse(50, 50, 10, 10);
}     

public class SecondApplet extends PApplet {

  public void settings() {
    size(200, 100);
  }
  public void draw() {
    background(255);
    fill(0);
    ellipse(100, 50, 10, 10);
  }
}
Convert Processing sketch to ruby-processing sketch

Convert Processing sketch to ruby-processing sketch


By : Aardappel
Date : March 29 2020, 07:55 AM
I wish this help you Short answer: no.
This kind of translation is not trivial. Generally, you can't really translate the syntax of one language into the syntax of a different language. You don't go line-by-line and simply change the code one line at a time. That makes what you're asking pretty difficult, so you probably won't find many tools that do stuff like that.
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org