Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
Temp fix till I get around to actually looking into why games are aut…
Browse files Browse the repository at this point in the history
…o pausing.
  • Loading branch information
mdbell committed Aug 10, 2018
1 parent 84bd165 commit 56a7f40
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/src/me/mdbell/noexs/ui/NoexsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class NoexsApplication extends Application {

public static final int VERSION_MAJOR = 1;
public static final int VERSION_MINOR = 1;
public static final int VERSION_PATCH = 0;
public static final int VERSION_PATCH = 1;

public static final String APP_NAME = "JNoexs";
public static final String APP_VERSION = VERSION_MAJOR + "." + VERSION_MINOR + "." + VERSION_PATCH;
Expand Down
11 changes: 11 additions & 0 deletions client/src/me/mdbell/noexs/ui/controllers/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Semaphore;
import java.util.function.Consumer;


public class MainController implements NetworkConstants, IController {

public ChoiceBox<ConnectionType> connectionType;
public CheckBox autoResume;
private Debugger debugger = new Debugger(NopConnection.INSTANCE);

/* Global Elements */
Expand Down Expand Up @@ -116,6 +118,15 @@ public void initialize() {
connectionType.getSelectionModel().select(ConnectionType.NETWORK); //TODO save/store this
connectionType.getSelectionModel().selectedItemProperty()
.addListener((observable, oldValue, newValue) -> ipAddr.setDisable(newValue != ConnectionType.NETWORK));

timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if(debugger.connected() && autoResume.isSelected()) {
debugger.resume();
}
}
}, 0, 100);
}

void fire(Consumer<IController> c) {
Expand Down
6 changes: 4 additions & 2 deletions client/src/me/mdbell/noexs/ui/views/Main.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<?import java.net.URL?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ProgressBar?>
Expand All @@ -28,9 +29,10 @@
<Label fx:id="statusLbl" layoutX="69.0" layoutY="23.0" text="Ready" />
<Separator layoutX="57.0" layoutY="22.0" orientation="VERTICAL" prefHeight="17.0" prefWidth="10.0" />
<Label fx:id="progressLabel" layoutX="575.0" layoutY="43.0" text="0%" />
<Button fx:id="pauseBtn" layoutX="408.0" layoutY="11.0" mnemonicParsing="false" onAction="#pauseGame" text="Pause Game" />
<Button layoutX="498.0" layoutY="11.0" mnemonicParsing="false" onAction="#continueProcess" text="Run Game" />
<Button fx:id="pauseBtn" layoutX="289.0" layoutY="12.0" mnemonicParsing="false" onAction="#pauseGame" text="Pause Game" />
<Button layoutX="379.0" layoutY="11.0" mnemonicParsing="false" onAction="#continueProcess" text="Resume Game" />
<ChoiceBox fx:id="connectionType" layoutX="622.0" layoutY="39.0" prefHeight="25.0" prefWidth="107.0" />
<CheckBox fx:id="autoResume" layoutX="477.0" layoutY="15.0" mnemonicParsing="false" text="Auto Resume" />
</children>
</AnchorPane>
<Separator layoutY="490.0" prefHeight="17.0" prefWidth="1020.0" />
Expand Down

0 comments on commit 56a7f40

Please sign in to comment.