X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fslipway%2Fgui%2FGuiGate.java;h=f2932cddc798c081fe511d8ae078de150011cd6d;hb=ba88e67948af47f28adea83cfd9394cf41a68abb;hp=56babc4f7a6ea9229d36013bbe90cccd5c75f27d;hpb=d50d9adb6825ca0c4e86cdf1ca529911b97c23a9;p=slipway.git diff --git a/src/edu/berkeley/slipway/gui/GuiGate.java b/src/edu/berkeley/slipway/gui/GuiGate.java index 56babc4..f2932cd 100644 --- a/src/edu/berkeley/slipway/gui/GuiGate.java +++ b/src/edu/berkeley/slipway/gui/GuiGate.java @@ -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