> show canvas only <


/* built with Studio Sketchpad: 
 *   https://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   https://designuniandes.sketchpad.cc/sp/pad/view/ro.S$SCUDsu1mF/rev.2
 * 
 * authors: 
 *   Juan Diego Santos

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



int boton1x=20, boton1y=20, boton1w=20;
int boton2x=60, boton2y=20, boton2w=20;
int boton3x=100, boton3y=20, boton3w=20;
int boton6x=140, boton6y=20, boton6w=20;
int boton7x=180, boton7y=20, boton7w=20;
int boton8x= 220, boton8y=20, boton8w=20;

int colorcito = 0;

int boton4x=20, boton4y=80, boton4w=20;
int boton5x=20, boton5y=120, boton5w=20;
int boton9x=27, boton9y=140, boton9w=20;
int boton10x=30, boton10y=170, boton10w=20;

int herramientica = 0;


void setup() 
{
  background(255);
  size(400, 400);
  
}


void draw() 
{
  // verifica el boton 1 y borra y resetea color y herramienta
  if (mousePressed == true) {
    if ((mouseX>boton1x)&&(mouseX<boton1x+boton1w)&&
      (mouseY>boton1y)&&(mouseY<boton1y+boton1w)) 
      {
      background(255);
      colorcito = 0;
      herramientica = 0;
    }
  }
  // verifica el boton 2 y escoje el color 1
  if (mousePressed == true) {
    if ((mouseX>boton2x)&&(mouseX<boton2x+boton2w)&&
      (mouseY>boton2y)&&(mouseY<boton2y+boton2w)) {
      colorcito = 1;
    }
  }
  // verifica el boton 3 y escoje el color 2
  if (mousePressed == true) {
    if ((mouseX>boton3x)&&(mouseX<boton3x+boton3w)&&
      (mouseY>boton3y)&&(mouseY<boton3y+boton3w)) {
      colorcito = 2;
    }
  }
  
  // verifica el boton 6 y escoje el color 3
  if (mousePressed == true) {
    if ((mouseX>boton6x)&&(mouseX<boton6x+boton6w)&&
      (mouseY>boton6y)&&(mouseY<boton6y+boton6w)) {
      colorcito = 3;
    }
  }
  
  // verifica el boton 7 y escoje el color 4
  if (mousePressed == true) {
    if ((mouseX>boton7x)&&(mouseX<boton7x+boton7w)&&
      (mouseY>boton7y)&&(mouseY<boton7y+boton7w)) {
      colorcito = 4;
    }
  }
  
   // verifica el boton 8 y escoje el color 5
  if (mousePressed == true) {
    if ((mouseX>boton8x)&&(mouseX<boton8x+boton8w)&&
      (mouseY>boton8y)&&(mouseY<boton8y+boton8w)) {
      colorcito = 5;
    }
  }
  
  // verifica el boton 4 y escoje la herramienta 1
  if (mousePressed == true) {
    if ((mouseX>boton4x)&&(mouseX<boton4x+boton4w)&&
      (mouseY>boton4y)&&(mouseY<boton4y+boton4w)) {
      herramientica = 1;
    }
  }
  // verifica el boton 5 y escoje la herramienta 2
  if (mousePressed == true) {
    if ((mouseX>boton5x)&&(mouseX<boton5x+boton5w)&&
      (mouseY>boton5y)&&(mouseY<boton5y+boton5w)) {
      herramientica = 2;
    }
  }
  
  // verifica el boton 9 y escoje la herramienta 3
  if (mousePressed == true) {
    if ((mouseX>boton9x)&&(mouseX<boton9x+boton9w)&&
      (mouseY>boton9y)&&(mouseY<boton9y+boton9w)) {
      herramientica = 3;
    }
  }
  
 // verifica el boton 10 y escoje la herramienta 4
  if (mousePressed == true) {
    if ((mouseX>boton10x)&&(mouseX<boton10x+boton10w)&&
      (mouseY>boton10y)&&(mouseY<boton10y+boton10w)) {
      herramientica = 4;
    }
  }

  // escoje color para pintar
  if(colorcito==1) {
    stroke(255, 0, 0);
    fill(255, 0, 0);
  } else if (colorcito==2) {
    stroke(0,0,255);
    fill(0,0,255);
  }  else if (colorcito==3) {
    stroke(19,167,84);
    fill(19,167,84);
  }  else if (colorcito==4) {
    stroke(255,240,98);
    fill(255,240,98);
  }  else if (colorcito==5) {
    stroke(172,48,240);
    fill(172,48,240);
  }  
  
  
  // escoje herramienta para pintar
  if(herramientica==1 && mousePressed==true) {
    rect(mouseX, mouseY, 10, 10);
  } else if(herramientica==2 && mousePressed==true) {
    ellipse(mouseX, mouseY, 5, 5);
  }else if(herramientica==3 && mousePressed==true) {
    line(mouseX, mouseY, mouseX+40, mouseY-40);
  }else if(herramientica==4 && mousePressed==true) {
    ellipse(mouseX, mouseY, 2,2);
  }
  
  //PINTA BOTONES!
  
   
  //Casilla colores
  fill(255);
  stroke(0);
  rect(10,10,240,40);
  //blanco
  fill(255);
  stroke(0);
  rect(boton1x, boton1y, boton1w, boton1w);
  //rojo
  fill(255, 0, 0);
  stroke(0);
  rect(boton2x, boton2y, boton2w, boton2w);
  //azul
  fill(0, 0, 255);
  stroke(0);
  rect(boton3x, boton3y, boton3w, boton3w);
  //verde
  fill(19,167,84);
  stroke(0);
  rect(boton6x, boton6y, boton6w, boton6w);
  //amarillo
  fill(255,240,98);
  stroke(0);
  rect(boton7x, boton7y, boton7w, boton7w);
  //morado
  fill(172,48,240);
  stroke(0);
  rect(boton8x,boton8y,boton8w,boton8w);
  
  
  //Casilla Herramientas
  fill(255);
  stroke(0);
  rect(10,70,40,110);
  //cuadrado
  fill(0);
  stroke(0);
  rect(boton4x, boton4y, boton4w, boton4w);
  //circulo grande
  fill(0);
  stroke(0);
  ellipse(boton5x+9, boton5y, boton5w, boton5w);
  //raya
  fill(0);
  stroke(0);
  rect(boton9x,boton9y,5,boton9w);
  //circulo pequeño
  fill(0);
  stroke(0);
  ellipse(boton10x,boton10y,boton10w-15,boton10w-15);

}