checkpoint
[slipway.git] / src / edu / berkeley / slipway / gui / GuiGate.java
index 56babc4..f2932cd 100644 (file)
@@ -5,6 +5,7 @@ import java.awt.*;
 import java.awt.geom.*;
 import java.awt.event.*;
 import java.awt.color.*;
+import static com.atmel.fpslic.FpslicConstants.*;
 
 public class GuiGate {
 
@@ -33,8 +34,10 @@ public class GuiGate {
     int rotation = 1;
     R gateArea;
     R r;
+    boolean disabled = false;
 
     public void draw(G g, int color) {
+        if (disabled) return;
         g.pushTransform();
         g.g.translate(gateArea.cx(), gateArea.cy());
         g.g.rotate((2 * Math.PI * rotation)/4);
@@ -66,4 +69,21 @@ public class GuiGate {
                      r.miny() + r.height()/2).transform(at);
     }
 
+    public void rotation(int dir) {
+        switch (dir) {
+            case NORTH: rotation = 2; break;
+            case SOUTH: rotation = 0; break;
+            case WEST:  rotation = 3; break;
+            case EAST:  rotation = 1; break;
+            default:    rotation = 0;
+        }
+    }
+
+    public void route(G g, P p, R ring, int input, int color) {
+        if (disabled) return;
+        g.color(color);
+        g.route(p, ring, getInput(input));
+        g.line(getInput(input), getInputDest(input));
+    }
+
 }
\ No newline at end of file