diff options
-rw-r--r-- | PunchingBag/src/PunchingBag.java | 37 | ||||
-rw-r--r-- | PunchingBag/src/PunchingBagGUI.java | 4 |
2 files changed, 27 insertions, 14 deletions
diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java index ef5cb18..e5b8011 100644 --- a/PunchingBag/src/PunchingBag.java +++ b/PunchingBag/src/PunchingBag.java @@ -2,8 +2,6 @@ import gnu.io.CommPortIdentifier; import javax.swing.event.EventListenerList; - - import java.awt.Rectangle; import java.awt.geom.Area; @@ -101,7 +99,7 @@ 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)); } @@ -197,34 +195,31 @@ 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 { @@ -391,6 +386,24 @@ public class PunchingBag implements Runnable { } return doneSomething; } + + public boolean rectfill(int x, int y, int height, int width, Colour colour) { + if (height < 0) { + height = 0; + } + if (width < 0) { + width = 0; + } + if (width == 0 && height == 0) { + return setLEDInternal(x, y, colour); + + } + + boolean doneSomething = false; + + return doneSomething; + + } private void calculateRawLeds() { // First clear everything diff --git a/PunchingBag/src/PunchingBagGUI.java b/PunchingBag/src/PunchingBagGUI.java index b62c820..5ba30a8 100644 --- a/PunchingBag/src/PunchingBagGUI.java +++ b/PunchingBag/src/PunchingBagGUI.java @@ -533,7 +533,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, @Override
public void buttonPressed(int x, int y) {
- System.out.println("Button Pressed: " + x + " " + y);
+ System.out.println("Button Pressed: " + x + " " + y); //bag.circleExpand(x, y, 16);
bag.setLED(x, y, PunchingBag.Colour.Red);
//bag.noise(new Rectangle(0, 0, 9, 20), 5000);
@@ -541,7 +541,7 @@ public class PunchingBagGUI implements MouseListener, MouseMotionListener, for (int by=0; by<bag.ledHeight; by++) {
bag.setLED(bx, by, PunchingBag.Colour.Red);
}
- }*/
+ }*/ //bag.squareExpand(x,y, 16, PunchingBag.Colour.Red);
}
|