Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More progress on input.
  • Loading branch information
Andrew Lawson authored and Andrew Lawson committed Nov 17, 2014
1 parent ab5a3af commit 996074a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions geometric_separators.pde
@@ -1,9 +1,13 @@

// Reset Button
int reset_x = 100;
int reset_y = 400;
int reset_y = 450;
int reset_w = 100;
int reset_h = 50;
int reset_h = 25;
// Calculate Button
int calc_x = 250;
int calc_y = 450;
int calc_w = 100;
int calc_h = 25;
// Button Shapes
PShape reset;
PShape calculate;
Expand All @@ -12,11 +16,11 @@ ArrayList<PShape> input = new ArrayList<PShape>();

// Setup
void setup() {
background(0);
background(255);
size(500,500,P2D);
// Create reset button
// Create buttons
reset = createShape(RECT, reset_x, reset_y, reset_w, reset_h);

calculate = createShape(RECT, calc_x, calc_y, calc_w, calc_h);
noLoop();
}

Expand All @@ -28,17 +32,21 @@ void mousePressed() {
input.clear();
}
else {
PShape new_ellipse = createShape(ELLIPSE, mouseX, mouseY, 50, 50);
PShape new_ellipse = createShape(ELLIPSE, mouseX - 12.5, mouseY - 12.5, 25, 25);
input.add(new_ellipse);
}
redraw();
}

// Draw
void draw() {
background(0);
background(255);
shape(reset);
shape(calculate);
text("Reset.", reset_x + 25, reset_y - 10);
text("Calculate.", calc_x + 25, calc_y - 10);
for (PShape ellipse : input) {
shape(ellipse);
fill(0);
}
}

0 comments on commit 996074a

Please sign in to comment.