At the beginning of my code, I declare a new array of objects of the class 'drawing', but I want it to be empty:
Code:
drawing drawings[] = new drawing[0];
Later on, I want to add drawings. With arrays of integers or floats, I can just use the expand function to add one to the index of the array, and using the array.length I can than fill that new space.
But with objects it doesn't seem to work:
Code:
drawings = expand(drawings, drawings.length+1);
drawings[drawings.length] = new drawing();
"The type of right sub-expression, "java.lang.Object", is not assignable to the variable, of type "Temporary_6098_398$drawing[]"
This is the code for my class (no real contents yet, I just started converting some 'normal' code to this class):
Code:
class drawing{
float aX, bX, aY, bY;
float xPoints[] = new float[]{
};
float yPoints[] = new float[]{
};
boolean beingDrawn = true;
drawing(){
}
void display(){
for (int i = 1; i< xPoints.length; i++){
strokeWeight(3);
stroke(255);
line(xPoints[i-1], yPoints[i-1],xPoints[i],yPoints[i]);
}
}
}
Can someone tell me how I can get this to work? I just want a dynamic array of objects.