/* IN HERE IS STUFF I WROTE */ // very rusty... need to create a box object which will be initialized to an array. // The Cell object needs to contain when it is, and what colors it needs to be. class Cell { //Declarations //initialize a couple counters int hits; int redhits; int bluehits; int greenhits; int rednessS; int bluenessS; int greennessS; int rednessG; int bluenessG; int greennessG; int brightliness; int wu; boolean antistrobe; boolean topOthe; boolean splitit; double ckotimestart; double ckotimefinish; String dispckotimestart; String dispckotimefinish; Integrator shinyness; //Constructor Cell() { hits = 0; redhits= 0; bluehits= 0; greenhits= 0; ckotimestart = 1.0; ckotimefinish = 0; dispckotimestart = " "; dispckotimefinish = " "; antistrobe = true; shinyness = new Integrator(); } void drawCell(float x, float y, float wx, float wy) { //Set colormode for this code. colorMode(HSB,100); brightliness = floor(shinyness.value); // brightliness = floor(100 * ((float)hits / (float)maxhits)); shinyness.update(); /* if (topOthe == true) { stroke(0,0,70); } else { noStroke(); } */ //Check to reset strobing if (!mousePressed && !antistrobe) antistrobe = true; //If the mouse is over, check for a click and toggle and update variables if (checkover(x,y,wx,wy) == true) { //Lightup or some shit Shine(); //Do global variables dispred = redhits; dispblue = bluehits; dispgreen = greenhits; disphits = hits; dispredperc = ( 100 * ( (float)redhits/hits) ); dispblueperc = ( 100 * ( (float)bluehits/hits) ); dispgreenperc = ( 100 * ( (float)greenhits/hits) ); disptimestart = dispckotimestart; disptimefinish = dispckotimefinish; if (mousePressed && antistrobe) { antistrobe = false; if (splitit == false) { splitit = true; pressed = false; } else if (splitit == true) { splitit = false; pressed = false; } } } if (splitit == true) { wu = ceil(wx/3) ; //RED fill(0,rednessG,rednessG,100); rect(x,y,wu,wy); //GREEN fill(33,greennessG,greennessG,100); rect(x + wu,y,wu,wy); //BLUE fill(66,bluenessG,bluenessG,100); rect(x + 2*wu,y,wu,wy); } else { fill(0,rednessS,brightliness,100); rect(x,y,wx,wy); //GREEN fill(33,greennessS,brightliness,50); rect(x,y,wx,wy); //BLUE fill(66,bluenessS,brightliness,33); rect(x,y,wx,wy); } //Set colormode back for compatibility colorMode(RGB,255); } boolean checkover(float xpos, float ypos, float swidth, float sheight) { if(mouseX > xpos && mouseX < xpos+swidth && mouseY > ypos && mouseY < ypos+sheight) { return true; } else { return false; } } void Shine() { shinyness.set(100); // brightliness = 100; } void updateCell() { //Set colornesses. ColornessG is general, ColornessS is specific. if (hits != 0) { rednessG = (100 * redhits / maxredhits ); bluenessG = (100 * bluehits / maxbluehits); greennessG = (100 * greenhits / maxgreenhits); rednessS = (((maxhits / maxredhits)* 100 * redhits / hits) ) ; bluenessS = (((maxhits / maxbluehits) * 100 * bluehits / hits) ) ; greennessS = (((maxhits / maxgreenhits) *100 * greenhits / hits) ) ; shinyness.target( floor(100 * ((float)hits / (float)maxhits)) ) ; } else{ rednessS = 0; bluenessS = 0; greennessS = 0; rednessG = 0; bluenessG = 0; greennessG = 0; brightliness = 0; shinyness.target(0) ; } } }