From f2cda59686b9c7ffb093b84196a95e5ba183fda4 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 4 Mar 2007 20:01:32 +0000 Subject: [PATCH] changed to splitTokens, ellipseMode(RADIUS), and cursor(PImage) with a default hotspot --- core/src/processing/core/PApplet.java | 55 ++++++++++++++++-------- core/src/processing/core/PConstants.java | 11 ++++- core/todo.txt | 6 +++ todo.txt | 2 + 4 files changed, 54 insertions(+), 20 deletions(-) diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index d833ca97a..a2acb7e56 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -61,14 +61,16 @@ import java.util.zip.*; * this also allows you to embed a Processing drawing area into another Java * application. This means you can use standard GUI controls with a Processing * sketch. Because AWT and Swing GUI components cannot be used on top of a - * PApplet, you can instead embed the Component inside another GUI the way - * you would any other Component. + * PApplet, you can instead embed the PApplet inside another GUI the wayyou + * would any other Component. *

- * By default, the animation thread will run at 60 frames per second, - * which can make the parent applet sluggish. If you want to only update the - * sketch intermittently, use noLoop() inside setup(), and redraw() whenever - * the screen needs to be updated once, or loop() to re-enable the animation - * thread. The following example embeds a sketch and also uses the noLoop() + * Because the default animation thread will run at 60 frames per second, + * an embedded PApplet can make the parent sluggish. You can use frameRate() + * to make it update less often, or you can use noLoop() and loop() to disable + * and then re-enable looping. If you want to only update the sketch + * intermittently, use noLoop() inside setup(), and redraw() whenever + * the screen needs to be updated once (or loop() to re-enable the animation + * thread). The following example embeds a sketch and also uses the noLoop() * and redraw() methods. You need not use noLoop() and redraw() when embedding * if you want your application to animate continuously. *

@@ -112,8 +114,8 @@ import java.util.zip.*;
  * 
* *

Processing on multiple displays

- *

I was asked about P5 with multiple displays, and for lack of a better - * place to document it, things will go here.

+ *

I was asked about Processing with multiple displays, and for lack of a + * better place to document it, things will go here.

*

You can address both screens by making a window the width of both, * and the height of the maximum of both screens. In this case, do not use * present mode, because that's exclusive to one screen. Basically it'll @@ -2471,6 +2473,15 @@ public class PApplet extends Applet } + /** + * Replace the cursor with the specified PImage. The x- and y- + * coordinate of the center will be the center of the image. + */ + public void cursor(PImage image) { + cursor(image, image.width/2, image.height/2); + } + + /** * Set a custom cursor to an image with a specific hotspot. * Only works with JDK 1.2 and later. @@ -5407,13 +5418,13 @@ public class PApplet extends Applet * character, which is found commonly on files created by or used * in conjunction with Mac OS X (character 160, or 0x00A0 in hex). *

-   * i.e. split("a b") -> { "a", "b" }
-   *      split("a    b") -> { "a", "b" }
-   *      split("a\tb") -> { "a", "b" }
-   *      split("a \t  b  ") -> { "a", "b" }
+ * i.e. splitTokens("a b") -> { "a", "b" } + * splitTokens("a b") -> { "a", "b" } + * splitTokens("a\tb") -> { "a", "b" } + * splitTokens("a \t b ") -> { "a", "b" } */ - static public String[] split(String what) { - return split(what, WHITESPACE); + static public String[] splitTokens(String what) { + return splitTokens(what, WHITESPACE); } @@ -5424,14 +5435,14 @@ public class PApplet extends Applet * as a separator. The delimeter characters won't appear in * the returned String array. *
-   * i.e. split("a, b", " ,") -> { "a", "b" }
+   * i.e. splitTokens("a, b", " ,") -> { "a", "b" }
    * 
* To include all the whitespace possibilities, use the variable * WHITESPACE, found in PConstants: *
-   * i.e. split("a   | b", WHITESPACE + "|");  ->  { "a", "b" }
+ * i.e. splitTokens("a | b", WHITESPACE + "|"); -> { "a", "b" } */ - static public String[] split(String what, String delim) { + static public String[] splitTokens(String what, String delim) { StringTokenizer toker = new StringTokenizer(what, delim); String pieces[] = new String[toker.countTokens()]; @@ -5494,6 +5505,14 @@ public class PApplet extends Applet } + /** + * FIXME this is only temporary + */ + static public String split(String what, String delim) { + return what.split(delim); + } + + ////////////////////////////////////////////////////////////// diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java index 03027962d..81bfe694f 100644 --- a/core/src/processing/core/PConstants.java +++ b/core/src/processing/core/PConstants.java @@ -187,12 +187,19 @@ public interface PConstants { static final int CLOSE = 2; - // shape modes + // shape drawing modes + /** Draw mode convention to use (x, y) to (width, height) */ static final int CORNER = 0; + /** Draw mode convention to use (x1, y1) to (x2, y2) coordinates */ static final int CORNERS = 1; + /** @deprecated Use RADIUS instead (as of 0125) */ static final int CENTER_RADIUS = 2; - static final int CENTER = 3; // former CENTER_DIAMETER + /** Draw mode from the center, and using the radius */ + static final int RADIUS = 2; + /** Draw from the center, using second pair of values as the diameter. + Formerly called CENTER_DIAMETER in alpha releases */ + static final int CENTER = 3; // uv texture orientation modes diff --git a/core/todo.txt b/core/todo.txt index 7965db45d..120203ddc 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -24,6 +24,12 @@ X HARD_LIGHT: C = A < 128 ? (2*A*B/255) : 255-2*(255-A)*(255-B)/255 X SOFT_LIGHT: C = B < 128 ? 2*((A>>1)+64)*B/255 : 255-(2*(255-((A>>1)+64))*(255-B)/255) X jre 1.5.0_10 is still default at java.com.. blech X http://dev.processing.org/bugs/show_bug.cgi?id=513 +X constant CENTER_RADIUS will be changed to just RADIUS +X CENTER_RADIUS is being deprecated, not removed +X splitTokens() added +_ need to add reference for splitTokens +_ need to edit reference for split (regexp?) +_ should we mention String.split? X ironed out more of the preproc parseXxxx() functions _ update the reference to cover these decisions _ also add notes about parseInt/Float(blah, otherwise) diff --git a/todo.txt b/todo.txt index 30eaf969e..772faebd1 100644 --- a/todo.txt +++ b/todo.txt @@ -21,6 +21,8 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=492 X change constructors for Capture, also framerate to frameRate _ need to update reference +_ the first time someone hides a tab, put up a msg explaining what it does + _ archive sketch shouldn't include applet or application dirs _ add to mac reference for present mode