> show canvas only <


/* built with Studio Sketchpad: 
 *   http://sketchpad.cc
 * 
 * observe the evolution of this sketch: 
 *   http://studio.sketchpad.cc/sp/pad/view/ro.vT6HNVifIzz/rev.16
 * 
 * authors: 
 *   GoToLoop
 *   

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



/** 
 * Stamp-a-Pup (v3.04)
 * by  ChalupaBatmans (2014/Jan)
 * mod Asimes & GoToLoop
 *
 * Forum.Processing.org/two/discussion/2396/how-to-turn-this-into-an-arraylist
 * Forum.Processing.org/two/discussion/3919/confusion-with-the-pvector#Item_5
 *
 * Studio.ProcessingTogether.com/sp/pad/export/ro.9jCT0UHalHCI3
 * Studio.ProcessingTogether.com/sp/pad/export/ro.93n3OpWs89REU
 */

import java.util.List;
final List<Dog> puppies = new ArrayList<Dog>();

static final color BG = #4168F0;

void setup() {
  size(1000, 650);
  noLoop();
  smooth(3);
  noStroke();
  ellipseMode(CENTER);
}

void draw() {
  background(BG);
  for (final Dog p : puppies)  p.render();
}

void mousePressed() {
  if (mouseButton == LEFT)  puppies.add(new Dog(mouseX, mouseY));
  else if (!puppies.isEmpty())  puppies.remove(0);

  redraw();
}

class Dog {
  static final color FUR = #7E2C06;
  static final short DIM = 0100;

  final short x, y;

  Dog(final int xx, final int yy) {
    x = (short) xx;
    y = (short) yy;
  }

  void render() {
    // Head & Body:
    fill(FUR);
    ellipse(x, y, DIM, DIM);
    ellipse(x, y + DIM, DIM*1.2, DIM*1.2);

    // Ears:
    fill(0);
    ellipse(x - DIM*.44, y + DIM*.1, DIM*.3, DIM*.8);
    ellipse(x + DIM*.44, y + DIM*.1, DIM*.3, DIM*.8);

    // Mouth & Eyes:
    fill(-1);
    ellipse(x, y + DIM*.2, DIM*.3, DIM*.3);
    ellipse(x - DIM*.2, y - DIM*.1, DIM*.2, DIM*.2);
    ellipse(x + DIM*.2, y - DIM*.1, DIM*.2, DIM*.2);

    // Nose & Irides:
    fill(0);
    ellipse(x, y + DIM*.1, DIM*.16, DIM*.16);
    ellipse(x - DIM*.14, y - DIM*.16, DIM*.1, DIM*.1);
    ellipse(x + DIM*.26, y - DIM*.16, DIM*.1, DIM*.1);
  }
}