Simple reference updates

This commit is contained in:
Casey Reas
2012-12-12 04:01:33 +00:00
parent 2e92b0eabc
commit 289f46ff61
11 changed files with 55 additions and 53 deletions
+3 -3
View File
@@ -234,7 +234,7 @@ editor.laf.linux = com.sun.java.swing.plaf.gtk.GTKLookAndFeel
editor.token.function1.style = #006699,plain
editor.token.function2.style = #006699,plain
editor.token.function3.style = #669933,plain
editor.token.function4.style = #669933,plain
editor.token.function4.style = #006699,bold
editor.token.keyword1.style = #996633,plain
editor.token.keyword2.style = #996633,plain
@@ -249,8 +249,8 @@ editor.token.operator.style = #006699,plain
editor.token.label.style = #7e7e7e,bold
editor.token.comment1.style = #7e7e7e,plain
editor.token.comment2.style = #7e7e7e,plain
editor.token.comment1.style = #7e7e7e,italic
editor.token.comment2.style = #7e7e7e,italic
editor.token.invalid.style = #7e7e7e,bold
+4 -1
View File
@@ -5277,7 +5277,7 @@ public class PApplet extends Applet
// }
/**
* @nowebref
* @param extension type of image to load, for example "png", "gif", "jpg"
*/
public PImage loadImage(String filename, String extension) { //, Object params) {
if (extension == null) {
@@ -14303,6 +14303,9 @@ public class PApplet extends Applet
}
/**
* @webref color:setting
*/
public void clear() {
if (recorder != null) recorder.clear();
g.clear();
+3 -1
View File
@@ -6904,7 +6904,9 @@ public class PGraphics extends PImage implements PConstants {
backgroundFromCalc();
}
/**
* @webref color:setting
*/
public void clear() {
background(0, 0, 0, 0);
}
@@ -4,8 +4,6 @@
* The current time can be read with the second(), minute(),
* and hour() functions. In this example, sin() and cos() values
* are used to set the position of the hands.
*
* Updated 27 February 2010 to handle size() changes.
*/
int cx, cy;
@@ -3,9 +3,8 @@
* by Daniel Shiffman.
*
* This example demonstrates how to use a HashMap to store
* a collection of objects referenced by a key.
* This is much like an array, only instead of accessing elements
* with a numeric index, we use a String.
* a collection of objects referenced by a key. This is much like an array,
* only instead of accessing elements with a numeric index, we use a String.
* If you are familiar with associative arrays from other languages,
* this is the same idea.
*
@@ -23,6 +22,7 @@ int counter;
void setup() {
size(640, 360);
words = new HashMap();
// Load file and chop it up
@@ -51,8 +51,7 @@ void draw() {
} else {
// Otherwise make a new word
Word w = new Word(s);
// And add to the HashMap
// put() takes two arguments, "key" and "value"
// And add to the HashMap put() takes two arguments, "key" and "value"
// The key for us is the String and the value is the Word object
words.put(s, w);
}
@@ -74,7 +73,7 @@ void draw() {
x += textWidth(w.word + " ");
}
// If x gets to the end, move Y
// If x gets to the end, move y
if (x > width) {
x = 0;
y -= 100;
@@ -25,7 +25,9 @@ void setup()
// Set random cells to 'on'
for (int i = 0; i < sx * sy * density; i++) {
world[(int)random(sx)][(int)random(sy)][1] = 1;
int x = int(random(sx));
int y = int(random(sy));
world[x][y][1] = 1;
}
}
+6 -6
View File
@@ -35,7 +35,7 @@ void draw() {
update(mouseX, mouseY);
background(currentColor);
if(rectOver) {
if (rectOver) {
fill(rectHighlight);
} else {
fill(rectColor);
@@ -43,7 +43,7 @@ void draw() {
stroke(255);
rect(rectX, rectY, rectSize, rectSize);
if(circleOver) {
if (circleOver) {
fill(circleHighlight);
} else {
fill(circleColor);
@@ -53,7 +53,7 @@ void draw() {
}
void update(int x, int y) {
if( overCircle(circleX, circleY, circleSize) ) {
if ( overCircle(circleX, circleY, circleSize) ) {
circleOver = true;
rectOver = false;
} else if ( overRect(rectX, rectY, rectSize, rectSize) ) {
@@ -65,10 +65,10 @@ void update(int x, int y) {
}
void mousePressed() {
if(circleOver) {
if (circleOver) {
currentColor = circleColor;
}
if(rectOver) {
if (rectOver) {
currentColor = rectColor;
}
}
@@ -85,7 +85,7 @@ boolean overRect(int x, int y, int width, int height) {
boolean overCircle(int x, int y, int diameter) {
float disX = x - mouseX;
float disY = y - mouseY;
if(sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
if (sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
return true;
} else {
return false;
+17 -18
View File
@@ -5,14 +5,13 @@
*/
Handle[] handles;
int num;
void setup() {
size(640, 360);
num = height/15;
int num = height/15;
handles = new Handle[num];
int hsize = 10;
for(int i=0; i<num; i++) {
for (int i = 0; i < handles.length; i++) {
handles[i] = new Handle(width/2, 10+i*15, 50-hsize/2, 10, handles);
}
}
@@ -20,7 +19,7 @@ void setup() {
void draw() {
background(153);
for(int i=0; i<num; i++) {
for (int i = 0; i < handles.length; i++) {
handles[i].update();
handles[i].display();
}
@@ -30,7 +29,7 @@ void draw() {
}
void mouseReleased() {
for(int i=0; i<num; i++) {
for (int i = 0; i < handles.length; i++) {
handles[i].releaseEvent();
}
}
@@ -39,7 +38,7 @@ class Handle {
int x, y;
int boxx, boxy;
int length;
int stretch;
int size;
boolean over;
boolean press;
@@ -50,19 +49,19 @@ class Handle {
Handle(int ix, int iy, int il, int is, Handle[] o) {
x = ix;
y = iy;
length = il;
stretch = il;
size = is;
boxx = x+length - size/2;
boxx = x+stretch - size/2;
boxy = y - size/2;
others = o;
}
void update() {
boxx = x+length;
boxx = x+stretch;
boxy = y - size/2;
for(int i=0; i<others.length; i++) {
if(others[i].locked == true) {
for (int i=0; i<others.length; i++) {
if (others[i].locked == true) {
otherslocked = true;
break;
} else {
@@ -70,18 +69,18 @@ class Handle {
}
}
if(otherslocked == false) {
if (otherslocked == false) {
overEvent();
pressEvent();
}
if(press) {
length = lock(mouseX-width/2-size/2, 0, width/2-size-1);
if (press) {
stretch = lock(mouseX-width/2-size/2, 0, width/2-size-1);
}
}
void overEvent() {
if(overRect(boxx, boxy, size, size)) {
if (overRect(boxx, boxy, size, size)) {
over = true;
} else {
over = false;
@@ -89,7 +88,7 @@ class Handle {
}
void pressEvent() {
if(over && mousePressed || locked) {
if (over && mousePressed || locked) {
press = true;
locked = true;
} else {
@@ -102,11 +101,11 @@ class Handle {
}
void display() {
line(x, y, x+length, y);
line(x, y, x+stretch, y);
fill(255);
stroke(0);
rect(boxx, boxy, size, size);
if(over || press) {
if (over || press) {
line(boxx, boxy, boxx+size, boxy+size);
line(boxx, boxy+size, boxx+size, boxy);
}
@@ -10,7 +10,7 @@
HScrollbar hs1, hs2; // Two scrollbars
PImage img1, img2; // Two image to load
PImage img1, img2; // Two images to load
void setup() {
size(640, 360);
@@ -74,21 +74,21 @@ class HScrollbar {
}
void update() {
if(overEvent()) {
if (overEvent()) {
over = true;
} else {
over = false;
}
if(mousePressed && over) {
if (mousePressed && over) {
locked = true;
}
if(!mousePressed) {
if (!mousePressed) {
locked = false;
}
if(locked) {
if (locked) {
newspos = constrain(mouseX-sheight/2, sposMin, sposMax);
}
if(abs(newspos - spos) > 1) {
if (abs(newspos - spos) > 1) {
spos = spos + (newspos-spos)/loose;
}
}
@@ -98,7 +98,7 @@ class HScrollbar {
}
boolean overEvent() {
if(mouseX > xpos && mouseX < xpos+swidth &&
if (mouseX > xpos && mouseX < xpos+swidth &&
mouseY > ypos && mouseY < ypos+sheight) {
return true;
} else {
@@ -110,7 +110,7 @@ class HScrollbar {
noStroke();
fill(204);
rect(xpos, ypos, swidth, sheight);
if(over || locked) {
if (over || locked) {
fill(0, 0, 0);
} else {
fill(102, 102, 102);
+1 -2
View File
@@ -224,6 +224,7 @@ Thread KEYWORD5
boolean KEYWORD5 boolean
byte KEYWORD5 byte
char KEYWORD5 char
color KEYWORD5 color_datatype
double KEYWORD5 double
float KEYWORD5 float
int KEYWORD5 int
@@ -256,8 +257,6 @@ try FUNCTION3 try
# These items are a part of Processing but, but pages don't generate
color KEYWORD1 color_datatype
boolean FUNCTION1 booleanconvert_
byte FUNCTION1 byteconvert_
cache FUNCTION2
@@ -31,7 +31,7 @@ void captureEvent(Capture camera) {
frames.add(img);
//once there are enough frames, remove the oldest one when adding a new one
if(frames.size() > height/4) {
if (frames.size() > height/4) {
frames.remove(0);
}
}
@@ -43,16 +43,16 @@ void draw() {
loadPixels();
//begin a loop for displaying pixel rows of 4 pixels height
for(int y = 0; y < video.height; y+=4) {
for (int y = 0; y < video.height; y+=4) {
//go through the frame buffer and pick an image, starting with the oldest one
if(currentImage < frames.size()) {
if (currentImage < frames.size()) {
PImage img = (PImage)frames.get(currentImage);
if(img != null) {
if (img != null) {
img.loadPixels();
//put 4 rows of pixels on the screen
for(int x = 0; x < video.width; x++) {
for (int x = 0; x < video.width; x++) {
pixels[x + y * width] = img.pixels[x + y * video.width];
pixels[x + (y + 1) * width] = img.pixels[x + (y + 1) * video.width];
pixels[x + (y + 2) * width] = img.pixels[x + (y + 2) * video.width];