From 91bb309f3aa1634793db0f48b2c13493a0c528cb Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 4 Mar 2010 14:03:19 +0000 Subject: [PATCH] oh yeah, *that's* why screen isn't static --- android/core/src/processing/core/PApplet.java | 21 +++++++------------ core/src/processing/core/PApplet.java | 17 +++++++++++++-- core/todo.txt | 1 + 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index 417561922..04339a1c2 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -57,24 +57,17 @@ public class PApplet extends Activity implements PConstants, Runnable { // public Frame frame; /** - * The screen size when the applet was started. - *

- * Access this via screen.width and screen.height. To make an applet - * run at full screen, use size(screen.width, screen.height). - *

- * If you have multiple displays, this will be the size of the main - * display. Running full screen across multiple displays isn't - * particularly supported, and requires more monkeying with the values. - * This probably can't/won't be fixed until/unless I get a dual head - * system. - *

+ * The screen size when the sketch was started. This is initialized inside + * onCreate(). + *

* Note that this won't update if you change the resolution * of your screen once the the applet is running. *

- * This variable is not static, because future releases need to be better - * at handling multiple displays. + * This variable is not static because in the desktop version of Processing, + * not all instances of PApplet will necessarily be started on a screen of + * the same size. */ - static public int screenW, screenH; + public int screenW, screenH; // public Dimension screen = // Toolkit.getDefaultToolkit().getScreenSize(); diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index a9ccf89b9..99f4c419e 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -269,8 +269,21 @@ public class PApplet extends Applet * Note that this won't update if you change the resolution * of your screen once the the applet is running. *

- * This variable is not static, because future releases need to be better - * at handling multiple displays. + * This variable is not static because in the desktop version of Processing, + * not all instances of PApplet will necessarily be started on a screen of + * the same size. + */ + static public int screenW; + static public int screenH; + static { + Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); + screenW = size.width; + screenH = size.height; + } + + /** + * Use screenW and screenH instead. + * @deprecated */ public Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); diff --git a/core/todo.txt b/core/todo.txt index c34bf46c4..d3bb5e5ae 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -2,6 +2,7 @@ X filter(DILATE/ERODE) X dilate(boolean) has bug in clamping of top kernel coordinate X http://dev.processing.org/bugs/show_bug.cgi?id=1477 +X deprecated 'screen', adding screenW and screenH big ones