-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutput.java
More file actions
50 lines (39 loc) · 1.04 KB
/
Output.java
File metadata and controls
50 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.awt.Graphics2D;
public class Output extends Part {
public Output(String name, int x, int y, int width, int height) {
super(name, x, y, width, height, -1, 0);
}
public Output(Output l) {
super(l);
}
public Output clone() {
return new Output(this);
}
@Override
public void onDoubleClick() {
changeName();
}
@Override
public boolean[] getBooleanOutputs(boolean[] in) {
state = false;
for (Wire w : inputs) {
if (w.state) {
state = true;
break;
}
}
return new boolean[] {};
}
@Override
public void draw(Graphics2D g) {
g.setColor(state ? Main.onState_Led : Main.offState_Led);
g.fillOval(x, y, width, height);
g.setColor(Main.nodeColor);
g.drawOval(x, y, width, height);
drawText(g);
}
@Override
public int[] getInputNode(Wire w){
return new int[] {(int) x + width/2, (int) y + height/2};
}
}