30
30
import processing .core .PApplet ;
31
31
import processing .mode .java .preproc .PdePreprocessor ;
32
32
import processing .mode .java .preproc .PreprocessorResult ;
33
+ import processing .mode .java .preproc .SurfaceInfo ;
33
34
import antlr .RecognitionException ;
34
35
import antlr .TokenStreamException ;
35
36
@@ -53,18 +54,19 @@ public AndroidPreprocessor(final Sketch sketch,
53
54
}
54
55
55
56
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 ) {
59
60
System .err .println ("More about the size() command on Android can be" );
60
61
System .err .println ("found here: http://wiki.processing.org/w/Android" );
61
62
throw new SketchException ("Could not parse the size() command." );
62
63
}
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 ;
68
70
}
69
71
70
72
@@ -213,14 +215,14 @@ protected void writeFooter(PrintWriter out, String className) {
213
215
if ((mode == Mode .STATIC ) || (mode == Mode .ACTIVE )) {
214
216
out .println ();
215
217
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 () + "; }" );
218
220
}
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 () + "; }" );
221
223
}
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 () + "; }" );
224
226
}
225
227
226
228
if (sketchQuality != null ) {
0 commit comments