sw01 wrote on Jan 17th, 2009, 9:38pm:Here's one way to do it without a limit:
Quote:ArrayList vectors;
void setup()
{
size(200, 200);
vectors = new ArrayList();
}
void draw()
{
for (int i = 0; i < vectors.size(); i++) {
PVector v= (PVector)vectors.get(i);
print(" " + (int)v.x);
}
println("");
}
void mousePressed(){
vectors.add( new PVector(mouseX, mouseY));
}
thanks
instead of a mouse i use the wii controler via glovepie an osc.
now i search for an alterntive of "void mousePressed".
Code: if (b==1) {
vectors.add( new PVector(wii1x, wii1y));
}
doesn´t works
//OSC
import oscP5.*;
import netP5.*;
int wii1x, wii1y, b;
OscP5 oscP5;
NetAddress myRemoteLocation;
void setup()
{
size(200, 200);
vectors = new ArrayList();
//OSC
oscP5 = new OscP5(this,3000);
myRemoteLocation = new NetAddress("127.0.0.1",3000);
}
void oscEvent(OscMessage theOscMessage) {
wii1x = int(map(theOscMessage.get(0).intValue(),0,1000,width,0));
wii1y = int(map(theOscMessage.get(1).intValue(),0,800,0,height));
b = theOscMessage.get(2).intValue();
}
void draw()
{
background(0);
for (int i = 0; i < vectors.size(); i++) {
PVector v= (PVector)vectors.get(i);
ellipse(v.x,v.y,10,10);
}
println("");
}
void mousePressed(){ vectors.add( new PVector(wii1x, wii1y));
} [/code]