Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rohan-bansal committed Sep 16, 2020
2 parents 0f69593 + 139e73f commit 829c93b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
22 changes: 19 additions & 3 deletions core/src/com/amhsrobotics/circuitsim/hardware/EPlate.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
SnapGrid.calculateSnap(vec);
}


if(box.contains(vec.x, vec.y)) {
drawHover(renderer);

if((CableManager.currentCable == null || (!CableManager.currentCable.appendingFromBegin && !CableManager.currentCable.appendingFromEnd)) && Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) {
if((CableManager.currentCable == null || (!CableManager.currentCable.hoveringMouse(camera) && (!CableManager.currentCable.appendingFromBegin && !CableManager.currentCable.appendingFromEnd && CableManager.currentCable.movingNode == null))) && Gdx.input.isButtonJustPressed(Input.Buttons.LEFT) && checkGood(camera)) {
if(CableManager.currentCable != null) {
CableManager.currentCable = null;
}
HardwareManager.currentHardware = this;
populateProperties();
CircuitGUIManager.propertiesBox.show();
Expand Down Expand Up @@ -140,7 +144,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam

if (!canMove) {
for (int x = 0; x < nodes.length; x++) {
if (Gdx.input.isTouched()) {
if (Gdx.input.isTouched() && checkGood(camera)) {
if (nodes[x].contains(vec) && (dragging == -1 || dragging == x)) {
dragging = x;
}
Expand All @@ -154,7 +158,7 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
}
}

if (Gdx.input.isTouched() && dragging == -1) {
if (Gdx.input.isTouched() && dragging == -1 && checkGood(camera)) {

if (box.contains(vec.x, vec.y) && (HardwareManager.getCurrentlyHovering(camera) == null || canMove)) {
if (!HardwareManager.movingObject) {
Expand Down Expand Up @@ -201,6 +205,18 @@ private void setSelectedNode(int index) {
nodes[index].setSelected(true);
}

public boolean checkGood(ClippedCameraController camera) {
boolean good = true;
for(Cable c : CableManager.getCables()) {
if(c.hoveringMouse(camera)) {
good = false;
}
}

return (good && !(CircuitGUIManager.panelShown && Gdx.input.getX() >= Gdx.graphics.getWidth() - 420 && Gdx.input.getY() <= 210) && !(!CircuitGUIManager.panelShown &&
Gdx.input.getX() >= Gdx.graphics.getWidth() - 210 && Gdx.input.getY() <= 210) && ((Gdx.input.getX() <= Gdx.graphics.getWidth() - 210) || !CircuitGUIManager.isPanelShown())&& !CableManager.movingCable);
}

@Override
public void populateProperties() {
CircuitGUIManager.propertiesBox.clearTable();
Expand Down
3 changes: 2 additions & 1 deletion core/src/com/amhsrobotics/circuitsim/hardware/Hardware.java
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ public void update(SpriteBatch batch, ModifiedShapeRenderer renderer, ClippedCam
}
}

if(!(CableManager.currentCable != null && connections.contains(CableManager.currentCable, true) && !CableManager.currentCable.hoveringMouse(camera)) && (CableManager.currentCable == null || (!(CableManager.currentCable.appendingFromBegin || CableManager.currentCable.appendingFromEnd || CableManager.currentCable.movingNode != null)))) {
if(!(CableManager.currentCable != null && connections.contains(CableManager.currentCable, true) && !CableManager.currentCable.hoveringMouse(camera)) &&
(CableManager.currentCable == null || (!(CableManager.currentCable.appendingFromBegin || CableManager.currentCable.appendingFromEnd || CableManager.currentCable.movingNode != null)))) {
if (Gdx.input.isTouched() && checkGood()) {

if (HardwareManager.getCurrentlyHovering(camera) == this || canMove) {
Expand Down
Empty file modified out-mac/Contents/Info.plist
100644 → 100755
Empty file.
Empty file modified out-mac/Contents/Resources/desktop-1.0.jar
100644 → 100755
Empty file.

0 comments on commit 829c93b

Please sign in to comment.