X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fexamples%2FPlayground.java;h=cf9f1e07d2e2c642e39dbe01db8e552ae6febdc9;hb=6fc37993a726bfa7ec8e0725c85417ce80cbeb5d;hp=78524b7d18393f36bda300ebf5b84a00093e2674;hpb=3e313a918963d07e59ddafd259884a6576361926;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/examples/Playground.java b/LogicUI/src/era/mi/gui/examples/Playground.java index 78524b7d..cf9f1e07 100644 --- a/LogicUI/src/era/mi/gui/examples/Playground.java +++ b/LogicUI/src/era/mi/gui/examples/Playground.java @@ -11,23 +11,27 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Point; public class Playground { - private static final int WIRE_DELAY = 10; - private static final int OR_DELAY = 50; - private static final int NOT_DELAY = 50; - public static void main(String[] args) { ViewModel model = new ViewModel(); + GUIAndGate andGate = new GUIAndGate(model, 1); + andGate.moveTo(10, 10); + GUINotGate notGate = new GUINotGate(model, 1); + notGate.moveTo(10, 40); + + new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50)); + LogicUIStandalone ui = new LogicUIStandalone(model); - addComponentsAndWires(ui, model); + + ui.getLogicUICanvas().addListener(SWT.KeyDown, e -> notGate.moveTo(150, 10)); ui.run(); } public static void addComponentsAndWires(LogicUIStandalone ui, ViewModel model) { - GUIAndGate andGate = new GUIAndGate(model); + GUIAndGate andGate = new GUIAndGate(model, 1); andGate.moveTo(10, 10); - GUINotGate notGate = new GUINotGate(model); + GUINotGate notGate = new GUINotGate(model, 1); notGate.moveTo(10, 40); new GUIWire(model, andGate.getPins().get(0), notGate.getPins().get(1), new Point(20, 50));