processing/processing — pull request #2895 by GoToLoop (2014-10-10 12:03:09+00:00)
Title: Another convenient main() method to ease sketch instantiation w/ extra a...

...rgs

There are times we need to instantiate the sketch w/ diff. behaviors like:

* "--full screen"
* "--hide-stop"
* "--location=x,y"
* "--display=n"
* etc.

For example, this request from Processing's forum:
http://forum.Processing.org/two/discussion/7519/how-to-change-background-color-of-present-mode-and-remove-graphical-stop-option

```Processing
static final void main(String[] args) {
String sketch = Thread.currentThread()
.getStackTrace()[1].getClassName();

main(sketch, args
, "--full-screen"
, "--hide-stop"
, "--bgcolor=#000000"
, "--stop-color=#000000"
);
}

static public void main(String mainClass, String[] passedArgs, String... extraArgs) {
runSketch(concat(append(extraArgs, mainClass), passedArgs), null);
}

void setup() {
size(displayWidth, displayHeight, JAVA2D);
smooth(4);
noLoop();
frameRate(10);

textSize(0200);
textAlign(CENTER, CENTER);

keyPressed();
println(args);
}

void draw() {
background(-1);
text(width + " x " + height, width>>1, height>>1);
}

void keyPressed() {
fill((color) random(#000000));
redraw();
}

void mousePressed() {
keyPressed();
}
```