diff options
author | Christopher Baines <cbaines8@gmail.com> | 2011-09-12 14:21:47 +0100 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2011-09-12 14:21:47 +0100 |
commit | b872e8aaf1f429d9422498cab25d5638e4158502 (patch) | |
tree | a3147d97d173b6291eaad40c9b04eea162dff4ac /PunchingBag | |
parent | 476322ce729ef56d808be66843fef18a83470191 (diff) | |
parent | 4a097766a92c6d190e25c860097f20cd1cfbf069 (diff) | |
download | punchingbag-b872e8aaf1f429d9422498cab25d5638e4158502.tar punchingbag-b872e8aaf1f429d9422498cab25d5638e4158502.tar.gz |
Merge branch 'master' of gitorious.org:punchingbag/punchingbag
Conflicts:
PunchingBag/src/PunchingBagGUI.java
Diffstat (limited to 'PunchingBag')
-rw-r--r-- | PunchingBag/src/PunchingBag.java | 35 | ||||
-rw-r--r-- | PunchingBag/src/PunchingBagGUI.java | 6 |
2 files changed, 38 insertions, 3 deletions
diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java index 925d5c6..a7b7070 100644 --- a/PunchingBag/src/PunchingBag.java +++ b/PunchingBag/src/PunchingBag.java @@ -2,6 +2,8 @@ import gnu.io.CommPortIdentifier; import javax.swing.event.EventListenerList; + + import java.awt.Rectangle; import java.awt.geom.Area; @@ -98,6 +100,10 @@ public class PunchingBag implements Runnable { void circleExpand(int x, int y, int intensity) { runningEffects.add(new CircleExpand(x, y, 100)); } + + void squareExpand(int x, int y, int intensity, Colour colour) { + runningEffects.add(new SquareExpand(x, y, intensity, colour)); + } void noise(Rectangle rect, long time) { runningEffects.add(new Noise(rect, System.currentTimeMillis() + time)); @@ -190,6 +196,35 @@ public class PunchingBag implements Runnable { } } + + class SquareExpand extends Effect { + final int x; + final int y; + final Colour colour; + int intensity; + boolean drawnSomething = true; + + int heightWidth = 2; + + + public SquareExpand(int x, int y, int intensity, Colour colour) { + this.x = x; + this.y = y; + this.intensity = intensity; + this.colour = colour; + + } + + + public void draw() { + heightWidth += 0.1 + 0.1 + (heightWidth / 20); + if (!drawRectCenter(x, y, heightWidth, heightWidth, colour)) + stop = true; + + + } + + } class Noise extends Effect { final Rectangle area; diff --git a/PunchingBag/src/PunchingBagGUI.java b/PunchingBag/src/PunchingBagGUI.java index 7af4d71..adf30b0 100644 --- a/PunchingBag/src/PunchingBagGUI.java +++ b/PunchingBag/src/PunchingBagGUI.java @@ -537,12 +537,12 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, System.out.println("Button Pressed: " + x + " " + y);
// bag.circleExpand(x, y, 16);
//bag.noise(new Rectangle(0, 0, 9, 20), 5000);
- for (int bx=0; bx<bag.ledWidth; bx++) {
+ /*for (int bx=0; bx<bag.ledWidth; bx++) {
for (int by=0; by<bag.ledHeight; by++) {
bag.setLED(bx, by, PunchingBag.Colour.Red);
}
- }
-
+ }*/
+ bag.squareExpand(x,y, 16, PunchingBag.Colour.Red);
}
@Override
|