We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I found the following here: https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java
/** * main() method for running this class from the command line. *
<
p> * The options shown here are not yet finalized and will be * changing over the next several releases. *
* The simplest way to turn and applet into an application is to * add the following code to your program: *
static public void main(String args[]) { * PApplet.main("YourSketchName", args); * }* This will properly launch your applet from a double-clickable * .jar or from the command line. *
* Parameters useful for launching or also used by the PDE: * * --location=x,y upper-lefthand corner of where the applet * should appear on screen. if not used, * the default is to center on the main screen. * * --full-screen put the applet into full screen "present" mode. * * --hide-stop use to hide the stop button in situations where * you don't want to allow users to exit. also * see the FAQ on information for capturing the ESC * key when running in presentation mode. * * --stop-color=#xxxxxx color of the 'stop' text used to quit an * sketch when it's in present mode. * * --bgcolor=#xxxxxx background color of the window. * * --sketch-path location of where to save files from functions * like saveStrings() or saveFrame(). defaults to * the folder that the java application was * launched from, which means if this isn't set by * the pde, everything goes into the same folder * as processing.exe. * * --display=n set what display should be used by this sketch. * displays are numbered starting from 0. * * Parameters used by Processing when running via the PDE * * --external set when the applet is being used by the PDE * * --editor-location=x,y position of the upper-lefthand corner of the * editor window, for placement of applet window **/
I want to use the --display=n command. I tried it with a 0 and a 1 but both give a result on the same window.
static final void main(String[] args) {
final String sketch = Thread.currentThread()
.getStackTrace()[1].getClassName();
PApplet.main(sketch, append(args, "--display=0"));
}
Am i doing something wrong?
I know i can set the prefered window from preferences, but i have to get around that.
Answers
I did found this: http://wiki.processing.org/w/Command_Line
However, i did 'install "processing-java"' and restarted processing but i can not type in the console. :S
The question is if those comments in the source code are still up to date.
Maybe this works...
@ammon -> I'm puzzled, why "SketchName" gotta be the last array entry?
Why the format below w/ split "SketchName" & args doesn't work?
forum.processing.org/two/discussion/4121/make-2nd-papplet-window-fullscreen
No reason, I just copy-pasted the way I do it from my own application I am writing in the IntelliJ IDEA as another option that could be tried out...
PApplet.runSketch()'s parsing doesn't seem too smart iMO:
1st time equals() fails w/ its parameter list while iterating over
args[]
, it assumes that failed entry is the sketch's name!And
break
outta thewhile
loop completely! Thus any further entries are ignored by the bigif
parser block @-)https://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L10581
Also, the "convenient" 2-parameter PApplet.main() version is highly deceptive!
It concat() the sketch's name before
passedArgs[]
, rendering the latter void for the parser ahead: :-whttps://github.com/processing/processing/blob/master/core/src/processing/core/PApplet.java#L10455
And that's the reason why I was tripping out! :-<
But in the end, thx for the provided extra info, I've redone "Cursor Keys" as the brand new "Parameterized PApplet Instances"!
Now it dictates any desired parameters for each
new
PApplet instantiation! \m/I moved to intelliJ, this works like a champ:
Very nice indeed! :D Just a little redundancy note:
Local variable sketch inside
static
main() was supposed to automatically get the class' name thx to that expression hack!If you're not using it, just remove that line or replace literal "MarkerMusic" by variable sketch! :(|)
P.S.: I had no idea that conversion functions int() & float() had to be replaced as parseInt() & parseFloat() by the preprocessor!
How dumb of me, since they're both keywords after all! b-(
Processing's reference, of course, doesn't mention that at all.
Neither that they can have 2 parameters by using their real method names! X(
Ah! 1 more tip: We can still use the shorter println() even on other IDEs aFaIK! o->
I didn't notice i wasn't using sketch anymore. PApplet.println works.
hi there,
i'm using
in order to position applet window in the other display, but that somehow invalidates loading od images with
loadImage()
. it just doesn't find the image anymore.any ideas what am i doing wrong here?
What does this report?
println(sketchPath());
http://forum.processing.org/two/discussion/11304/multiple-monitors-primary-dragable-secondary-fullscreen