标题: 小白问题请教!prefix string too short [打印本页] 作者: SURE轻松 时间: 2011-12-12 00:10 标题: 小白问题请教!prefix string too short 什么情况?……查不出错啊…………
Bubble[] bubbles;
void setup() {
size(800,600);
smooth();
// Load text file as an array of Strings
String [] data = loadStrings("data.txt");
// The size of the array of Bubble objects is determined by the total number of lines in the text file.
bubbles = new Bubble[data.length];
for (int i = 0; i < bubbles.length; i ++ ) {
// Each line is split into an array of floating point numbers.
float[] values = float(split(data[i], "," ));
// The values in the array are passed into the Bubble class constructor.
bubbles[i] = new Bubble(values[0],values[1]);
}
}
void draw() {
background(255);
translate(width/2,height/2);
// Display and move all bubbles
for (int i = 0; i < bubbles.length; i ++ ) {
bubbles[i].display();
// bubbles[i].drift();
if(i0){
stroke(0);
strokeWeight(2);
line(bubbles[i-1].r,bubbles[i-1].g,bubbles[i].r,bubbles[i].g);
}
}
}作者: s.k. 时间: 2011-12-12 14:12
代码什么的看不懂作者: skyonecn 时间: 2012-1-8 05:09
因为文件名称太短了,改个长的就可以了作者: tube_0 时间: 2012-1-13 14:42
我也遇到过。改文件名呗,小问题