Skip to content

Commit

Permalink
bump CircuitSim jar
Browse files Browse the repository at this point in the history
  • Loading branch information
endorpersand committed Jan 16, 2025
1 parent b08f4bd commit 3b4a1d1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Binary file modified CircuitSim.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ So I have two goals in this template:
Getting Started
---------------

_Note: The `CircuitSim.jar` in the repo is built against the [CS2110 fork of CircuitSim](https://github.com/gt-cs2110/CircuitSim), which is not compatible with files created in "regular" CircuitSim. If you are using vanilla CircuitSim, you probably need to rebuild this library._
_Note: The `CircuitSim.jar` in the repo is built against the [CE fork of CircuitSim](https://github.com/gt-cs2110/CircuitSim), which is not compatible with files created in "regular" CircuitSim. If you are using vanilla CircuitSim, you probably need to rebuild this library._

To make your own CircuitSim tester, take a look at the [sample tester repo](https://github.com/zucchini/sample-circuitsim-tester).

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/io/zucchini/circuitsimtester/api/Subcircuit.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

import javafx.geometry.Bounds;
import javafx.scene.canvas.Canvas;
import com.ra4king.circuitsim.gui.*;
import com.ra4king.circuitsim.gui.ComponentManager.ComponentLauncherInfo;
Expand Down Expand Up @@ -636,24 +637,24 @@ private Port.Link makeOrphanPort(Port port) {
port.unlinkPort(port);
return link;
}

private int getMaxX() {
return (int) Math.ceil(state.circuitManager.getCanvas().getWidth() / GuiUtils.BLOCK_SIZE);
}

private int getMaxY() {
return (int) Math.ceil(state.circuitManager.getCanvas().getHeight() / GuiUtils.BLOCK_SIZE);

private Pair<Integer, Integer> getMaxCoords() {
Bounds bounds = state.circuitManager.getCircuitBounds();
return new Pair<>((int) bounds.getMaxX(), (int) bounds.getMaxY());
}

private Pin substitutePin(Port port, boolean isInput) {
return addSnitchPinToLink(makeOrphanPort(port), isInput);
}

private Pin addSnitchPinToLink(Port.Link link, boolean isInput) {
Pair<Integer, Integer> maxCoords = getMaxCoords();
int maxX = maxCoords.getKey();
int maxY = maxCoords.getValue();
PinPeer mockPinPeer = new PinPeer(new Properties(
new Properties.Property<>(Properties.BITSIZE, link.getBitSize()),
new Properties.Property<>(PinPeer.IS_INPUT, isInput)
), getMaxX(), getMaxY());
), maxX, maxY);

// Find a valid place to drop it
do {
Expand Down

0 comments on commit 3b4a1d1

Please sign in to comment.