not looping draw?
in
Programming Questions
•
1 year ago
hi im making a program to make characters for alphanumeric lcds
however it doesnt seem to redraw after clicking, when clicking, it should invert the alpha channel coefficient of the fill so the rectangle gets transparent, however it does not i cant figure out why
here is the code any ideas?
however it doesnt seem to redraw after clicking, when clicking, it should invert the alpha channel coefficient of the fill so the rectangle gets transparent, however it does not i cant figure out why
here is the code any ideas?
- int[] sqclr = {200, 200, 200};
int seph = 10;
int sepv = 10;
int[] x = new int[5];
int[] y = new int[8];
int value = 0;
int w = 250;
int h = 400;
boolean[][] coeff = new boolean[5][8];
void setup()
{
size(w,h);
noStroke();
rectMode(CENTER);
background(0,0,100);
for(int i = 0; i<5; i++)
{
for(int j = 0; j<8; j++)
{
coeff[i][j] = true;
}
}
}
void draw()
{
for(int i = 0; i<8; i++)
{
y[i] = (h/8)*(i)+h/16;
}
for(int i = 0; i<5; i++)
{
x[i] = (w/5)*(i)+w/10;
}
for (int i = 0; i<5; i++)
{
for (int j = 0; j<8; j++)
{
fill(sqclr[0], sqclr[1], sqclr[2], 255*int(coeff[i][j]));
rect(x[i],y[j],w/5-seph/2,h/8-sepv/2);
}
}
}
void mouseClicked()
{
int posx = (mouseX*5)/w;
int posy = (mouseY*8)/h;
coeff[posx][posy] = !(coeff[posx][posy]);
}
1