Performance issue with multiple objects
public int x;
public int y;
public int w;
public int h;
public float o;
public int size;
public PApplet PAPP = Taaa.PAPP;
public boolean fadeOut = false;
public boolean fadeIn = false;
public boolean display = false;
public boolean moveLeft = false;
public int kwadraton;
int i = 0;
public Square(int x, int y, int w, int h, int o){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.o = o;
PAPP.registerDraw(this);
}
public void fadeOut(){
this.o = this.o - 5f;
}
public void fadeIn(){
this.o = this.o + 3f;
}
public void moveLeft(){
this.x = this.x + 10;
}
public void setOpacity(float val){
this.o = val;
}
public float getOpacity(){
return this.o;
}
public void addCol(){
w = w+1;
}
public void addRow(){
h = h+1;
}
public void draw(){
if(fadeOut == true){
fadeOut();
}
if(fadeIn == true){
fadeIn();
}
if(moveLeft == true){
moveLeft();
}
if(addRow == true){
addRow();
}
if(addCol == true){
addCol();
}
displaySquare();
i++;
}
public void displaySquare(){
PAPP.fill(255,250,250,o);
for(int i = 0; i < w; i++){
for(int j = 0; j < h; j++){
//PAPP.fill(this.o,110,10,200);
PAPP.rect(x+10*i, y+10*j, w,h);
}
}
}
public void moveLeft(int val){
this.x = this.x - val;
}
public void moveRight(int val){
this.x = this.x + val;
}
public void moveDown(int val){
this.y = this.y + val;
}
public void moveUp(int val){
this.y = this.y - val;
}
}