aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PunchingBag/src/PunchingBag.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/PunchingBag/src/PunchingBag.java b/PunchingBag/src/PunchingBag.java
index 198e709..0128120 100644
--- a/PunchingBag/src/PunchingBag.java
+++ b/PunchingBag/src/PunchingBag.java
@@ -217,6 +217,70 @@ public class PunchingBag implements Runnable {
}
}
+ public boolean drawRectCenter(int x, int y, int height, int width,
+ Colour colour) {
+ if (height < 0) {
+ height = 0;
+ }
+ if (width < 0) {
+ width = 0;
+ }
+ if (height == 0 && width == 0) {
+ return setLEDInternal(x, y, colour);
+ }
+
+ boolean doneSomething = false;
+ int widthEx = 0;
+ int heightEx = 0;
+
+ do {
+
+ } while (height && width >= 0);
+
+
+ }
+
+ public boolean drawRectCorner(int x, int y, int height, int width,
+ Colour colour) {
+ if (height < 0) {
+ height = 0;
+ }
+ if (width < 0) {
+ width = 0;
+ }
+ if (height == 0 && width == 0) {
+ return setLEDInternal(x, y, colour);
+ }
+
+ boolean doneSomething = false;
+ int heightEx = 0;
+ int widthEx = 0;
+
+ do {
+ if (setLEDInternal(x + widthEx, y, colour)) {
+ doneSomething = true;
+ }
+
+ if (setLEDInternal(x, y + heightEx, colour)) {
+ doneSomething = true;
+ }
+ if (setLEDInternal(x + widthEx, y + height, colour)) {
+ doneSomething = true;
+ }
+ if (setLEDInternal(x + width, y + heightEx, colour)) {
+ doneSomething = true;
+ }
+ if (heightEx < height) {
+ heightEx++;
+ }
+ if (widthEx < width) {
+ heightEx++;
+ }
+ } while (height >= 0 && width >= 0);
+
+ return doneSomething;
+ }
+
public boolean drawEllipse(int x, int y, int radx, int rady, Colour colour) {
if (radx == 0 && rady == 0) {
return setLEDInternal(x, y, colour);