Skip to content

Commit 6388cf2

Browse files
committed
Use SizeInfo class instead of the separate variables
Signed-off-by: Umair Khan <[email protected]>
1 parent 9d075b4 commit 6388cf2

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/processing/mode/android/AndroidPreprocessor.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import processing.core.PApplet;
3131
import processing.mode.java.preproc.PdePreprocessor;
3232
import processing.mode.java.preproc.PreprocessorResult;
33+
import processing.mode.java.preproc.SurfaceInfo;
3334
import antlr.RecognitionException;
3435
import antlr.TokenStreamException;
3536

@@ -53,18 +54,19 @@ public AndroidPreprocessor(final Sketch sketch,
5354
}
5455

5556

56-
public String[] initSketchSize(String code) throws SketchException {
57-
String[] info = parseSketchSize(code, true);
58-
if (info == null) {
57+
public SurfaceInfo initSketchSize(String code) throws SketchException {
58+
SurfaceInfo surfaceInfo = parseSketchSize(code, true);
59+
if (surfaceInfo == null) {
5960
System.err.println("More about the size() command on Android can be");
6061
System.err.println("found here: http://wiki.processing.org/w/Android");
6162
throw new SketchException("Could not parse the size() command.");
6263
}
63-
sizeStatement = info[0];
64-
sketchWidth = info[1];
65-
sketchHeight = info[2];
66-
sketchRenderer = info[3];
67-
return info;
64+
/*
65+
sizeStatement = surfaceInfo.getStatement();
66+
sketchWidth = surfaceInfo.getWidth();
67+
sketchHeight = surfaceInfo.getHeight();
68+
sketchRenderer = surfaceInfo.getRenderer();*/
69+
return surfaceInfo;
6870
}
6971

7072

@@ -213,14 +215,14 @@ protected void writeFooter(PrintWriter out, String className) {
213215
if ((mode == Mode.STATIC) || (mode == Mode.ACTIVE)) {
214216
out.println();
215217

216-
if (sketchWidth != null) {
217-
out.println(indent + "public int sketchWidth() { return " + sketchWidth + "; }");
218+
if (sizeInfo.getWidth() != null) {
219+
out.println(indent + "public int sketchWidth() { return " + sizeInfo.getWidth() + "; }");
218220
}
219-
if (sketchHeight != null) {
220-
out.println(indent + "public int sketchHeight() { return " + sketchHeight + "; }");
221+
if (sizeInfo.getHeight() != null) {
222+
out.println(indent + "public int sketchHeight() { return " + sizeInfo.getHeight() + "; }");
221223
}
222-
if (sketchRenderer != null) {
223-
out.println(indent + "public String sketchRenderer() { return " + sketchRenderer + "; }");
224+
if (sizeInfo.getRenderer() != null) {
225+
out.println(indent + "public String sketchRenderer() { return " + sizeInfo.getRenderer() + "; }");
224226
}
225227

226228
if (sketchQuality != null) {

0 commit comments

Comments
 (0)