From 4d2498d5fd3a71024a5591b00b73c64885ce1043 Mon Sep 17 00:00:00 2001 From: Andrew Lawson Date: Mon, 17 Nov 2014 00:16:24 -0500 Subject: [PATCH] Initial commit. --- .gitignore | 1 + sketch_141108a.pde | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 .gitignore create mode 100644 sketch_141108a.pde diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..102b6fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.properties \ No newline at end of file diff --git a/sketch_141108a.pde b/sketch_141108a.pde new file mode 100644 index 0000000..6c4b674 --- /dev/null +++ b/sketch_141108a.pde @@ -0,0 +1,44 @@ + +// Reset Button +int reset_x = 100; +int reset_y = 400; +int reset_w = 100; +int reset_h = 50; +// Button Shapes +PShape reset; +PShape calculate; +// Input list +ArrayList input = new ArrayList(); + +// Setup +void setup() { + background(0); + size(500,500,P2D); + // Create reset button + reset = createShape(RECT, reset_x, reset_y, reset_w, reset_h); + + noLoop(); +} + +// On mouse press +void mousePressed() { + if ((mouseX >= reset_x && mouseX <= (reset_x + reset_w)) && + (mouseY >= reset_y && mouseY <= (reset_y + reset_h))) { + // Reset input and background + input.clear(); + } + else { + PShape new_ellipse = createShape(ELLIPSE, mouseX, mouseY, 50, 50); + input.add(new_ellipse); + } + redraw(); +} + +// Draw +void draw() { + background(0); + shape(reset); + for (PShape ellipse : input) { + shape(ellipse); + } +}