Refactored the LED frames backing data
[kaka/cakelight.git] / src / kaka / cakelight / GuiTest.java
index 5aaba2f..c72519a 100644 (file)
@@ -83,15 +83,19 @@ public class GuiTest extends Application {
         float rowSize = 9f * BLOCK / config.leds.rows;
 //        DropShadow shadow = new DropShadow(BlurType.ONE_PASS_BOX, Color.RED, colSize * 2, colSize, 0, 0);
         for (int x = 0; x < config.leds.cols; x++) {
-            gc.setFill(getLedColor(frame, x + config.leds.rows));
+            // Top
+            gc.setFill(getLedColor(frame, config.leds.cols * 2 + config.leds.rows - x - 1));
             gc.fillRect(GUTTER + x * colSize, GUTTER - ledLength, colSize, ledLength);
-            gc.setFill(getLedColor(frame, config.leds.rows * 2 + config.leds.cols * 2 - 1 - x));
+            // Bottom
+            gc.setFill(getLedColor(frame, x));
             gc.fillRect(GUTTER + x * colSize, GUTTER + 9 * BLOCK, colSize, ledLength);
         }
         for (int y = 0; y < config.leds.rows; y++) {
-            gc.setFill(getLedColor(frame, config.leds.rows - 1 - y));
+            // Left
+            gc.setFill(getLedColor(frame, config.leds.cols * 2 + config.leds.rows + y));
             gc.fillRect(GUTTER - ledLength, GUTTER + y * rowSize, ledLength, rowSize);
-            gc.setFill(getLedColor(frame, y + config.leds.rows + config.leds.cols));
+            // Right
+            gc.setFill(getLedColor(frame, config.leds.rows + config.leds.cols - y - 1));
             gc.fillRect(GUTTER + 16 * BLOCK, GUTTER + y * rowSize, ledLength, rowSize);
         }
     }