From 356b1fad3eb8258bef56588f302d790917f17c87 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Mon, 19 Mar 2018 00:55:37 -0500 Subject: [PATCH] Updated default speed to 2x instead of 1.5x and fixed issue that kept resetting speed to 1x every time the emulator is started --- .../jace/src/main/java/jace/EmulatorUILogic.java | 3 ++- .../jace/src/main/java/jace/JaceUIController.java | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java b/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java index 837df34f..33259120 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/EmulatorUILogic.java @@ -86,7 +86,7 @@ public class EmulatorUILogic implements Reconfigurable { category = "General", name = "Speed Setting" ) - public int speedSetting = 2; + public int speedSetting = 3; @ConfigurableField( category = "General", @@ -560,5 +560,6 @@ public class EmulatorUILogic implements Reconfigurable { @Override public void reconfigure() { + LawlessLegends.getApplication().controller.setSpeed(speedSetting); } } diff --git a/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java b/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java index 02ebec92..e98de3d0 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/JaceUIController.java @@ -6,12 +6,10 @@ package jace; import com.sun.glass.ui.Application; -import jace.config.ConfigurableField; import jace.core.Card; import jace.core.Computer; import jace.core.Motherboard; import jace.core.Utility; -import jace.lawless.LawlessComputer; import jace.library.MediaCache; import jace.library.MediaConsumer; import jace.library.MediaConsumerParent; @@ -109,6 +107,7 @@ public class JaceUIController { assert stackPane != null : "fx:id=\"stackPane\" was not injected: check your FXML file 'JaceUI.fxml'."; assert notificationBox != null : "fx:id=\"notificationBox\" was not injected: check your FXML file 'JaceUI.fxml'."; assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'."; + speedSlider.setValue(1.0); controlOverlay.setVisible(false); menuButtonPane.setVisible(false); controlOverlay.setFocusTraversable(false); @@ -183,7 +182,7 @@ public class JaceUIController { } } - private double convertSpeedToRatio(Double setting) { + protected double convertSpeedToRatio(Double setting) { if (setting < 1.0) { return 0.5; } else if (setting == 1.0) { @@ -209,7 +208,6 @@ public class JaceUIController { rootPane.setOnKeyReleased(keyboardHandler); rootPane.setFocusTraversable(true); } - speedSlider.setValue(1.0); speedSlider.setMinorTickCount(0); speedSlider.setMajorTickUnit(1); speedSlider.setLabelFormatter(new StringConverter() { @@ -253,9 +251,12 @@ public class JaceUIController { } } - private void setSpeed(double speed) { + protected void setSpeed(double speed) { Emulator.logic.speedSetting = (int) speed; double speedRatio = convertSpeedToRatio(speed); + if (speedSlider.getValue() != speed) { + Platform.runLater(()->speedSlider.setValue(speed)); + } if (speedRatio > 100.0) { Emulator.computer.getMotherboard().setMaxSpeed(true); Motherboard.cpuPerClock = 3;