mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 01:50:44 +01:00
changed to splitTokens, ellipseMode(RADIUS), and cursor(PImage) with a default hotspot
This commit is contained in:
@@ -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.
|
||||
* <p/>
|
||||
* 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.
|
||||
* <PRE>
|
||||
@@ -112,8 +114,8 @@ import java.util.zip.*;
|
||||
* </PRE>
|
||||
*
|
||||
* <H2>Processing on multiple displays</H2>
|
||||
* <P>I was asked about P5 with multiple displays, and for lack of a better
|
||||
* place to document it, things will go here.</P>
|
||||
* <P>I was asked about Processing with multiple displays, and for lack of a
|
||||
* better place to document it, things will go here.</P>
|
||||
* <P>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).
|
||||
* <PRE>
|
||||
* i.e. split("a b") -> { "a", "b" }
|
||||
* split("a b") -> { "a", "b" }
|
||||
* split("a\tb") -> { "a", "b" }
|
||||
* split("a \t b ") -> { "a", "b" }</PRE>
|
||||
* i.e. splitTokens("a b") -> { "a", "b" }
|
||||
* splitTokens("a b") -> { "a", "b" }
|
||||
* splitTokens("a\tb") -> { "a", "b" }
|
||||
* splitTokens("a \t b ") -> { "a", "b" }</PRE>
|
||||
*/
|
||||
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.
|
||||
* <PRE>
|
||||
* i.e. split("a, b", " ,") -> { "a", "b" }
|
||||
* i.e. splitTokens("a, b", " ,") -> { "a", "b" }
|
||||
* </PRE>
|
||||
* To include all the whitespace possibilities, use the variable
|
||||
* WHITESPACE, found in PConstants:
|
||||
* <PRE>
|
||||
* i.e. split("a | b", WHITESPACE + "|"); -> { "a", "b" }</PRE>
|
||||
* i.e. splitTokens("a | b", WHITESPACE + "|"); -> { "a", "b" }</PRE>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
2
todo.txt
2
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
|
||||
|
||||
Reference in New Issue
Block a user