ifotinos
YaBB Newbies
Offline
Posts: 36
any ideas on how to improove it?
Nov 3rd , 2009, 3:04am
// koubia: r,t,y,f,g,h,q,a : +r,+g,+b,-r,-g,-b,+r+g+b,-r-g-b, kounontas to mouse mesa sto parathiro int possa = 150; float x[][] = new float [possa+3][possa+3]; //x float y[][] = new float [possa+3][possa+3]; //y float r[][] = new float [possa+3][possa+3]; //color float g[][] = new float [possa+3][possa+3]; //color float b[][] = new float [possa+3][possa+3]; //color float m[] = new float [possa+3]; //color int metr = 0; int i; int j; int apostash = 4; float plus = 50000; float misiapostash = apostash/2; int sp = 2; //sinplin void setup(){ noStroke(); rectMode(CENTER); noStroke(); size(possa*apostash,possa*apostash); frameRate(30); for (int i = 0; i < possa; i++) { for (int j = 0; j < possa; j++) { x[i][j] = +i*apostash; y[i][j] = +j*apostash; r[i][j] = 0; g[i][j] = 0; b[i][j] = 0; } } } void draw(){ background(0); for (i = 2; i < possa-2; i++) { for (j = 2; j < possa-2; j++) { fill(r[i][j],g[i][j],b[i][j],255); col(); float megethos = apostash;//map((r[i][j]+g[i][j]+b[i][j])/3,0,plus,apostash,apostash+2); //if (megethos>50){megethos = apostash;} if (r[i][j] > 0 || g[i][j]>0 ||b[i][j] > 0){ rect(x[i][j],y[i][j],megethos,megethos); } } } } void col(){ if ((mouseX > x[i][j]-sp-misiapostash) && (mouseX < x[i][j]+misiapostash+sp) && (mouseY > y[i][j]-sp-misiapostash) && (mouseY < y[i][j]+misiapostash+sp)) { if (key == 'a') { r[i][j] = -plus; g[i][j] = -plus; b[i][j] = -plus; } if (key == 'q') { r[i][j] = plus; g[i][j] = plus; b[i][j] = plus; } if (key == 'r') { r[i][j] = plus; } if (key == 't') { g[i][j] = plus; } if (key == 'y') { b[i][j] = plus; } if (key == 'f') { r[i][j] = -plus; } if (key == 'g') { g[i][j] = -plus; } if (key == 'h') { b[i][j] = -plus; } } r[i][j] = (r[i][j] + r[i][j+1] +r[i][j-1] +r[i+1][j] +r[i-1][j])/5; g[i][j] = (g[i][j] + g[i][j+1] +g[i][j-1] +g[i+1][j] +g[i-1][j])/5; b[i][j] = (b[i][j] + b[i][j+1] +b[i][j-1] +b[i+1][j] +b[i-1][j])/5; }