()
| 75 | } |
| 76 | |
| 77 | public void redraw() { |
| 78 | boolean isRunning = Emulator.withComputer(c->c.getRunningProperty().get(), false); |
| 79 | if (!isRunning) return; |
| 80 | |
| 81 | int val = cell.value.get() & 0x0ff; |
| 82 | if (!holding.get()) { |
| 83 | value = val; |
| 84 | } |
| 85 | if (samples.size() >= GRAPH_WIDTH) { |
| 86 | samples.remove(0); |
| 87 | } |
| 88 | samples.add(val); |
| 89 | Platform.runLater(() -> { |
| 90 | GraphicsContext g = graph.getGraphicsContext2D(); |
| 91 | g.setFill(Color.BLACK); |
| 92 | g.fillRect(0, 0, GRAPH_WIDTH, GRAPH_HEIGHT); |
| 93 | if (samples.size() > 1) { |
| 94 | g.setLineWidth(1); |
| 95 | g.setStroke(Color.LAWNGREEN); |
| 96 | int y = (int) (GRAPH_HEIGHT - ((samples.get(0) / 255.0) * GRAPH_HEIGHT)); |
| 97 | g.beginPath(); |
| 98 | g.moveTo(0, y); |
| 99 | for (int i = 1; i < samples.size(); i++) { |
| 100 | y = (int) (GRAPH_HEIGHT - ((samples.get(i) / 255.0) * GRAPH_HEIGHT)); |
| 101 | g.lineTo(i, y); |
| 102 | } |
| 103 | g.stroke(); |
| 104 | } |
| 105 | g.beginPath(); |
| 106 | g.setStroke(Color.WHITE); |
| 107 | g.strokeText(String.valueOf(val), GRAPH_WIDTH - 25, GRAPH_HEIGHT - 5); |
| 108 | }); |
| 109 | } |
| 110 | RAMListener holdListener; |
| 111 | |
| 112 | public BooleanProperty holdingProperty() { |
no test coverage detected