> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.RoyW-35Acj5/rev.405
 * 
 * authors: 
 *   
 *   Joao Berga
 *   
 *   
 *   

 * license (unless otherwise specified): 
 *   creative commons attribution-share alike 3.0 license.
 *   https://creativecommons.org/licenses/by-sa/3.0/ 
 */ 



//Este sketch foi alterado apartir do trabalho no link seguinte:

//http://dflab.sketchpad.cc/sp/pad/view/ro.9yGhFv1GkOBHdD/rev.1327;

//realizado por Ruben Martins

//upgrade de Pixel art painitng to ProcessingShop

// PIXEL ART PAINTING
 
//Tecla Wo2 - Branco (branco/borracha)
//Tecla R - Vermelho
//Tecla G - Verde
//Tecla B - Azul
//Tecla Y - Amarelo
//Tecla O - Laranja
//Tecla P - Rosa
//Tecla 2 - Preto
//Tecla C - Cinzento
//Tecla E - sombra
//Tecla A - Luz
//Tecla Q - Castanho
//Tecla L - Aleatório
 
noStroke ();
float n = 100;
float step;
 
void setup() {
 
  size(500, 500);
  
  step = width / n;
  
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      rect(i*step, j*step, step, step);
    }
  }
  
  fill(10);
}
 
void draw () {
  if (keyPressed) {
     switch(key) {
         case 'w':
             fill(255,255,255);
             break;
         case 'r':
             fill(220,0,0);
             break;
         case 'g':
             fill(0,180,0);
             break;
        case 'b':
             fill(0,0,200);
             break;
        case 'y':
             fill(255,220,30);
            break;
        case 'p':
             fill(255,150,200);
             break;
        case '1':
             fill(255);
             break;
        case 'o':
             fill(255,180,20);
             break;
        case '2':
             fill(0);
             break;
        case 'c':
             fill(170,170,170);
             break;
        case 'e':
             fill(0,10);
             break;
        case 'a':
             fill(255,10);
             break;
        case 'q':
             fill(150,100,30);
             break;
        case 'l':
             fill( random(255), random(255), random(255));
             break;

     }
  }
 
  if (mousePressed) {
    
    float x = step * floor (mouseX / step);
    float y = step * floor (mouseY / step);
    rect (x, y, step, step);
  }
}