sorting out multi-display, fullScreen(), param passing with surface...

This commit is contained in:
Ben Fry
2015-06-05 21:24:28 -04:00
parent f62bbdfb0c
commit eda15abce9
16 changed files with 214 additions and 150 deletions

View File

@@ -249,7 +249,7 @@ public class JavaBuild {
// in the preprocessor. Those are used in preproc.write() so that they
// can be used to add methods (settings() or sketchXxxx())
//String[] sizeParts =
SizeInfo sizeInfo =
SurfaceInfo sizeInfo =
preprocessor.initSketchSize(sketch.getMainProgram(), sizeWarning);
if (sizeInfo == null) {
// An error occurred while trying to pull out the size, so exit here

View File

@@ -151,7 +151,7 @@ public class PdePreprocessor {
protected Mode mode;
Set<String> foundMethods;
SizeInfo sizeInfo;
SurfaceInfo sizeInfo;
/**
@@ -201,7 +201,7 @@ public class PdePreprocessor {
}
public SizeInfo initSketchSize(String code,
public SurfaceInfo initSketchSize(String code,
boolean sizeWarning) throws SketchException {
sizeInfo = parseSketchSize(code, sizeWarning);
return sizeInfo;
@@ -252,7 +252,7 @@ public class PdePreprocessor {
* @param fussy true if it should show an error message if bad size()
* @return null if there was an error, otherwise an array (might contain some/all nulls)
*/
static public SizeInfo parseSketchSize(String code,
static public SurfaceInfo parseSketchSize(String code,
boolean fussy) throws SketchException {
// This matches against any uses of the size() function, whether numbers
// or variables or whatever. This way, no warning is shown if size() isn't
@@ -312,7 +312,7 @@ public class PdePreprocessor {
//String[] matches = split on commas, but not commas inside quotes
StringList args = breakCommas(contents[1]);
SizeInfo info = new SizeInfo();
SurfaceInfo info = new SurfaceInfo();
info.statement = contents[0];
info.width = args.get(0).trim();
info.height = args.get(1).trim();
@@ -347,7 +347,7 @@ public class PdePreprocessor {
// if no size() found, check for fullScreen()
contents = PApplet.match(searchArea, FULL_SCREEN_CONTENTS_REGEX);
if (contents != null) {
SizeInfo info = new SizeInfo();
SurfaceInfo info = new SurfaceInfo();
info.statement = contents[0];
StringList args = breakCommas(contents[1]);
info.renderer = args.get(0).trim();
@@ -360,7 +360,7 @@ public class PdePreprocessor {
// not an error, just no size() specified
//return new String[] { null, null, null, null, null };
return new SizeInfo();
return new SurfaceInfo();
}
@@ -1001,7 +1001,7 @@ public class PdePreprocessor {
out.print("\"" + PApplet.ARGS_FULL_SCREEN + "\", ");
String farbe = Preferences.get("run.present.bgcolor");
out.print("\"" + PApplet.ARGS_BGCOLOR + "=" + farbe + "\", ");
out.print("\"" + PApplet.ARGS_WINDOW_COLOR + "=" + farbe + "\", ");
if (Preferences.getBoolean("export.application.stop")) {
farbe = Preferences.get("run.present.stop.color");

View File

@@ -27,13 +27,16 @@ import processing.app.Base;
import processing.core.PApplet;
public class SizeInfo {
public class SurfaceInfo {
String statement;
String width;
String height;
String renderer;
String path;
String display;
/** null for nothing in setup(), 0 for noSmooth(), N for smooth(N) */
Integer quality;
boolean hasOldSyntax() {

View File

@@ -385,7 +385,7 @@ public class Runner implements MessageConsumer {
// }
params.add(PApplet.ARGS_STOP_COLOR + "=" +
Preferences.get("run.present.stop.color"));
params.add(PApplet.ARGS_BGCOLOR + "=" +
params.add(PApplet.ARGS_WINDOW_COLOR + "=" +
Preferences.get("run.present.bgcolor"));
}