Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit.
- Loading branch information
Andrew Lawson
authored and
Andrew Lawson
committed
Nov 17, 2014
0 parents
commit 4d2498d
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<PShape> input = new ArrayList<PShape>(); | ||
|
||
// 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); | ||
} | ||
} |