Arrays list of object of float arrays
in
Programming Questions
•
10 months ago
i would to use arraylist of objerct using float arrays
/////////////////////////////////////
ArrayList<Object> obj = new ArrayList<Object>();
boolean go = false;
int nombre;
int currentNombre=0;
void setup(){
size(300,300);
nombre=330;
}
void draw(){
obj.add( new Object(new float[nombre],new float[nombre],30));
obj.mouse();
}
class Object{
public float[] mx;
public float[] my;
int taille=30;
Object(float[] mx_, float[] my_, int taille_){
mx=mx_;
my=my_;
taille=taille_;
}
void mouse(){
if(mousePressed){
mx[currentNombre]=mouseX;
my[currentNombre]=mouseY;
currentNombre+=1;
mousePressed=!mousePressed;
}
}
void displayarrays(){
for(int i = 0; i<currentNombre;i++){
rect(mx[i],my[i],taille,taille);}
}
}
///////////////////////////////
two questions:
why the function move() does not exists?
if i use float array undefined, processing undestand i want to use my two float arrays in the constructor mx and my?
cheers
1