Skip to content

Commit 1b26c39

Browse files
committed
set default width/height, fixes #211
1 parent 1868871 commit 1b26c39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/src/processing/core/PApplet.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public class PApplet extends Fragment implements PConstants, Runnable {
7373
// static final public boolean DEBUG = true;
7474
static final public boolean DEBUG = false;
7575

76+
/** Default width and height for sketch when not specified */
77+
static public final int DEFAULT_WIDTH = 100;
78+
static public final int DEFAULT_HEIGHT = 100;
79+
7680
// Convenience public constant holding the SDK version, akin to platform in Java mode
7781
static final public int SDK = android.os.Build.VERSION.SDK_INT;
7882
// static final public int SDK = Build.VERSION_CODES.ICE_CREAM_SANDWICH; // Forcing older SDK for testing
@@ -161,10 +165,10 @@ static public class RendererChangeException extends RuntimeException { }
161165
public int[] pixels;
162166

163167
/** width of this applet's associated PGraphics */
164-
public int width;
168+
public int width = DEFAULT_WIDTH;
165169

166170
/** height of this applet's associated PGraphics */
167-
public int height;
171+
public int height = DEFAULT_HEIGHT;
168172

169173
// can't call this because causes an ex, but could set elsewhere
170174
//final float screenDensity = getResources().getDisplayMetrics().density;

0 commit comments

Comments
 (0)