> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://dflab.sketchpad.cc/sp/pad/view/ro.kV1WI7RLP$3/rev.1327
 * 
 * authors: 
 *   Ruben.Martins
 *   

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



// PIXEL ART PAINTING

//Tecla 1 - Branco
//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

float n = 25;
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(0);
}

void draw () {
  if (keyPressed) {
     switch(key) {
         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;
     }
  }
 
  if (mousePressed) {
    noStroke ();
    float x = step * floor (mouseX / step);
    float y = step * floor (mouseY / step);
    rect (x, y, step, step);
  }
}