mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-15 07:48:29 -04:00
better visual difference between running and editing mode
This commit is contained in:
parent
52b72f9140
commit
99945937aa
@ -7,7 +7,7 @@ import java.awt.*;
|
||||
*/
|
||||
public class Style {
|
||||
public static final Style NORMAL = new Style(2, false, Color.BLACK);
|
||||
public static final Style WIRE = new Style(3, true, new Color(0, 112, 0));
|
||||
public static final Style WIRE_LOW = new Style(3, true, new Color(0, 112, 0));
|
||||
public static final Style WIRE_HIGH = new Style(3, true, new Color(102, 255, 102));
|
||||
public static final Style FILLED = new Style(2, true, Color.BLACK);
|
||||
public static final Style THIN = new Style(1, false, Color.BLACK);
|
||||
|
@ -12,7 +12,7 @@ import java.util.Iterator;
|
||||
* @author hneemann
|
||||
*/
|
||||
public class Circuit implements Drawable {
|
||||
private static final Vector RAD = new Vector(3, 3);
|
||||
private static final Vector RAD = new Vector(2, 2);
|
||||
private final ArrayList<VisualPart> visualParts;
|
||||
private transient ArrayList<Vector> dots;
|
||||
private ArrayList<Wire> wires;
|
||||
@ -26,7 +26,7 @@ public class Circuit implements Drawable {
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, State state) {
|
||||
for (Vector d : getDots())
|
||||
graphic.drawCircle(d.sub(RAD), d.add(RAD), Style.WIRE);
|
||||
graphic.drawCircle(d.sub(RAD), d.add(RAD), Style.FILLED);
|
||||
for (Wire w : wires)
|
||||
w.drawTo(graphic, state);
|
||||
for (VisualPart p : visualParts)
|
||||
|
@ -21,9 +21,12 @@ public class Wire implements Drawable, Moveable {
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, State state) {
|
||||
Style style = Style.WIRE;
|
||||
if (value != null && value.getValue() != 0) {
|
||||
style = Style.WIRE_HIGH;
|
||||
Style style = Style.NORMAL;
|
||||
if (value != null) {
|
||||
if (value.getValue() != 0)
|
||||
style = Style.WIRE_HIGH;
|
||||
else
|
||||
style = Style.WIRE_LOW;
|
||||
}
|
||||
|
||||
graphic.drawLine(p1, p2, style);
|
||||
|
@ -61,9 +61,13 @@ public class InputShape implements Shape {
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, State state) {
|
||||
Style style = Style.WIRE;
|
||||
if (state != null && state.getOutput(0).getValue() != 0)
|
||||
style = Style.WIRE_HIGH;
|
||||
Style style = Style.NORMAL;
|
||||
if (state != null) {
|
||||
if (state.getOutput(0).getValue() != 0)
|
||||
style = Style.WIRE_HIGH;
|
||||
else
|
||||
style = Style.WIRE_LOW;
|
||||
}
|
||||
|
||||
Vector center = new Vector(-2 - SIZE, 0);
|
||||
graphic.drawCircle(center.sub(RAD), center.add(RAD), style);
|
||||
|
@ -46,9 +46,13 @@ public class OutputShape implements Shape {
|
||||
|
||||
@Override
|
||||
public void drawTo(Graphic graphic, State state) {
|
||||
Style style = Style.WIRE;
|
||||
if (state != null && state.getInput(0).getValue() != 0)
|
||||
style = Style.WIRE_HIGH;
|
||||
Style style = Style.NORMAL;
|
||||
if (state != null) {
|
||||
if (state.getInput(0).getValue() != 0)
|
||||
style = Style.WIRE_HIGH;
|
||||
else
|
||||
style = Style.WIRE_LOW;
|
||||
}
|
||||
|
||||
Vector center = new Vector(2 + SIZE, 0);
|
||||
graphic.drawCircle(center.sub(RAD), center.add(RAD), style);
|
||||
|
Loading…
x
Reference in New Issue
Block a user