4 of the examples stopped compiling (for the same reason) with their port to version 47/48 the error is: Cannot find class "color" [JLS 8] it has something to do with confusion in passing colors into methods and classes. the examples affected: drawing 02 input09 input08 transform05 / / / / / / / / / / / / also that pesky pmouseX, pmouseY seems to be behaving oddly again. it's skipping beats. try this: void setup() { size(200, 200); noBackground(); refresh(); } void loop() { stroke(255); if(mousePressed && pmouseX != 0 && pmouseY != 0) { line(mouseX, mouseY, pmouseX, pmouseY); } } // the kludge with pmouseX != 0 etc. has to do with their default to 0. // would it be possible to automatically have P5 set the pmouseX and // pmouseY to mouseX and mouseY on the first frame? // comment that line out to see what i'm talking about .................................................... Gizmo[][] life = new Gizmo[30][30]; void setup() { size(300, 300); background(255, 255, 255); stroke(0, 0, 0); for (int a = 0; a < 30; a++) for (int b = 0; b < 30; b++) { life[a][b] = new Gizmo(a, b); life[a][b].init(); } } void loop() { if (mouseX >= 0 && mouseX <= 300 && mouseY >= 0 && mouseY <= 300) { int ex = (mouseX - (mouseX % 10)) / 10; int why = (mouseY - (mouseY % 10)) / 10; } else { ex = 0; why = 0; } if (life[ex][why].alive == false && mousePressed) life[ex][why].make(); else if (life[ex][why].alive == true && mousePressed) life[ex][why].kill(); drawbg(); } void drawbg() { for (int why = 0; why < 30; why++) for (int ex = 0; ex < 30; ex++) { if (life[ex][why].alive == true) { fill(150, 20, 20); rect(ex * 10, why * 10, 10, 10); } else { fill(0, 0, 0); rect(ex * 10, why * 10, 10, 10); } } class Gizmo { int x; int y; boolean alive; Point[] neighbours = new Point[8]; Gizmo (int ex, int why) { x = ex; y = why; } void init(); { for (int i = 0; i < 8; i++) neighbours[i] = new Point(0,0); } void make() { alive == true; } void kill() { alive == false; } } class Point { int x; int y; Point (int ex, int why) { x = ex; y = why; } void set(int ex, int why) { x = ex; y = why; } } ................................................................ _ can't used random() inside constructor.. (Glen Murphy) _ maybe related to problems loading images in constructors _ check output from file that's created.. seems to fail silently(?) While I've used random() in other projects often without fail, if I uncomment the 'float r = random(50);', the applet window fails to appear, with no error messages. (this code is a mutilated version of working code, just to show the error). int WIDTH = 500; int HEIGHT = 500; int NUMMINES = 6; Mine mine[] = new Mine[NUMMINES]; class Mine { int NUMSPOKES = 12; float x, y, size; Spoke spoke[] = new Spoke[NUMSPOKES]; Mine(float xIn, float yIn, float sizeIn) { x = xIn; y = yIn; size = sizeIn; for(int i = 0; i < NUMSPOKES; i++) { //float r = random(50); spoke[i] = new Spoke(size+i, i*5, i); } } } class Spoke { float dist, dir, dirVel; Spoke(float distIn, float dirIn, float dirVelIn) { } } void setup() { size(500,500); ellipseMode(CENTER_DIAMETER); for(int i = 0; i < NUMMINES; i++) { mine[i] = new Mine(random(0,WIDTH), random(0,HEIGHT), random(10,30)); } } void loop() { } ........................................................................ From mike@lightcycle.org Wed Nov 27 09:48:09 2002 Date: Tue, 26 Nov 2002 22:26:35 -0800 From: To: bugs@proce55ing.net Subject: Error during export. During export, I've recieved the message "Error while compiling, please send code to bugs@proce55ing.net". The following code runs, but doesn't export in 0044 or 0046. I wonder if it has anything to do with my vector2d class - Java has a class Vector2d, but it is in javax.vecmath.Vector2d and the case is differant. Thanks, Mike Davis int n = 8; swimmer[] s; float viscousness = 0.3; float drag = 0.1; void setup() { size(300, 300); background(255); stroke(0); noFill(); s = new swimmer[n]; for (int i = 0; i < n; i++) s[i] = new swimmer((float)(i + 1)/(n+1) * width, 7*height/8, (i+1) * 0.05); } void loop() { for (int i = 0; i < n; i++) s[i].step(); } class vector2d { float x, y; vector2d(float x, float y) { this.x = x; this.y = y; } } vector2d addv(vector2d a, vector2d b) { return new vector2d(a.x + b.x, a.y + b.y); } vector2d unitv(vector2d a) { vector2d b = a; float length = sqrt(sq(b.x)+sq(b.y)); b.x = b.x / length; b.y = b.y / length; return b; } vector2d scalev(vector2d a, float scalar) { vector2d b = a; b.x = b.x * scalar; b.y = b.y * scalar; return b; } vector2d perpv(vector2d a) { vector2d b = new vector2d(a.y, -a.x); return b; } class paddle { float x1, y1, x2, y2; vector2d force, forceat; paddle(float x1, float y1, float x2, float y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; force = new vector2d(0, 0); forceat = new vector2d(0, 0); } void moveto(float x1, float y1, float x2, float y2) { float f = viscousness * 0.5*((this.x1*this.y2+this.x2*y2+x2*y1+x1*this.y1)-(this.y1*this.x2+this.y2*x2+y2*x1+y1*this.x1)); float midx1 = (this.x1 + x1) / 2; float midy1 = (this.y1 + y1) / 2; float midx2 = (this.x2 + x2) / 2; float midy2 = (this.y2 + y2) / 2; forceat = new vector2d((midx1 + midx2) / 2, (midy1 + midy2) / 2); vector2d m = new vector2d(midx2-midx1, midy2-midy1); force = scalev(unitv(perpv(m)), f); this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } void draw() { line(this.x1, this.y1, this.x2, this.y2); } void drawforce() { line(forceat.x, forceat.y, forceat.x + force.x, forceat.y + force.y); } } class swimmer { paddle p1, p2; float t = 0; float mass = 10; float angle; float speed; vector2d position, velocity, acceleration; swimmer(float x, float y, float s) { speed = s; p1 = new paddle(0, 0, 10, 0); p2 = new paddle(0, 0, -10, 0); position = new vector2d(x, y); velocity = new vector2d(0, 0); acceleration = new vector2d(0, 0); } void step() { t += speed; p1.moveto(0, 0, -20 * abs(cos(t)/2 + 0.5), 20 * sin(t)); p2.moveto(0, 0, 20 * abs(cos(t)/2 + 0.5), 20 * sin(t)); push(); translate(position.x, position.y); p1.draw(); p2.draw(); acceleration = scalev(addv(p1.force, p2.force), 1/mass); velocity = addv(velocity, acceleration); position = addv(position, velocity); velocity = scalev(velocity, drag); if (mousePressed) { stroke(255, 0, 0); p1.drawforce(); p2.drawforce(); stroke(0); } while (position.x < 0) position.x += width; while (position.x >= width) position.x -= width; while (position.y < 0) position.y += height; while (position.y >= height) position.y -= height; pop(); } } ........................................................................ bug in comments rev: 0046, w2k sometimes (never when creating a new sketch, only when an old one has been loaded), if I try to add a comment to identify the end of a method class, ie like void Sample () { } // end of Sample handler P5 return me an unexpected 'handler' token error! And when I change this comment to } /* end of Sample handler */ everything comes back to normal?! This don't happen everytimes.. but once it started, the error stay there! Just try it in your next sketchbook, add some comments at the end of your methods, and see what happen