Allow saving speed slider setting with config, and also added option to disable boot animation

This commit is contained in:
Brendan Robert 2018-01-16 23:16:11 -06:00
parent 0179dc07ce
commit 55ee4c4d3b
4 changed files with 26 additions and 2 deletions

View File

@ -81,6 +81,12 @@ public class EmulatorUILogic implements Reconfigurable {
}
};
}
@ConfigurableField(
category = "General",
name = "Speed Setting"
)
public int speedSetting = 1;
@ConfigurableField(
category = "General",

View File

@ -6,10 +6,12 @@
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 +111,8 @@ public class JaceUIController {
assert appleScreen != null : "fx:id=\"appleScreen\" was not injected: check your FXML file 'JaceUI.fxml'.";
controlOverlay.setVisible(false);
menuButtonPane.setVisible(false);
controlOverlay.setFocusTraversable(false);
menuButtonPane.setFocusTraversable(false);
NumberBinding aspectCorrectedWidth = rootPane.heightProperty().multiply(3.0).divide(2.0);
NumberBinding width = new When(
aspectRatioCorrectionEnabled.and(aspectCorrectedWidth.lessThan(rootPane.widthProperty()))
@ -125,6 +129,7 @@ public class JaceUIController {
controlOverlay.setOnMouseClicked(this::hideControlOverlay);
delayTimer.getKeyFrames().add(new KeyFrame(Duration.millis(3000), evt -> {
hideControlOverlay(null);
rootPane.requestFocus();
}));
}
@ -139,9 +144,11 @@ public class JaceUIController {
ft.play();
}
}
rootPane.requestFocus();
}
Timeline delayTimer = new Timeline();
private void resetMenuButtonTimer() {
delayTimer.playFromStart();
}
@ -155,6 +162,7 @@ public class JaceUIController {
ft.setFromValue(0.0);
ft.setToValue(1.0);
ft.play();
rootPane.requestFocus();
}
}
@ -226,6 +234,7 @@ public class JaceUIController {
}
});
speedSlider.valueProperty().addListener((val, oldValue, newValue) -> setSpeed(newValue.doubleValue()));
Platform.runLater(() -> speedSlider.setValue(Emulator.logic.speedSetting));
}
private void connectButtons(Node n) {
@ -241,6 +250,7 @@ public class JaceUIController {
}
private void setSpeed(double speed) {
Emulator.logic.speedSetting = (int) speed;
double speedRatio = convertSpeedToRatio(speed);
if (speedRatio > 100.0) {
Emulator.computer.getMotherboard().maxspeed = true;

View File

@ -88,7 +88,7 @@ public class ConfigurationUIController {
assert settingsScroll != null : "fx:id=\"settingsScroll\" was not injected: check your FXML file 'Configuration.fxml'.";
assert deviceTree != null : "fx:id=\"deviceTree\" was not injected: check your FXML file 'Configuration.fxml'.";
assert treeScroll != null : "fx:id=\"treeScroll\" was not injected: check your FXML file 'Configuration.fxml'.";
resetDeviceTree();
cancelConfig(null);
deviceTree.getSelectionModel().selectedItemProperty().addListener(this::selectionChanged);
deviceTree.maxWidthProperty().bind(treeScroll.widthProperty());
}

View File

@ -4,6 +4,7 @@ import jace.apple2e.Apple2e;
import jace.apple2e.RAM128k;
import jace.apple2e.SoftSwitches;
import jace.apple2e.VideoNTSC;
import jace.config.ConfigurableField;
import jace.core.Card;
import jace.core.Video;
import jace.library.MediaConsumer;
@ -25,6 +26,8 @@ public class LawlessComputer extends Apple2e {
byte[] bootScreen = null;
boolean performedBootAnimation = false;
LawlessImageTool gameDiskHandler = new LawlessImageTool();
@ConfigurableField(name = "Boot Animation")
public boolean showBootAnimation = true;
public LawlessComputer() {
super();
@ -49,7 +52,12 @@ public class LawlessComputer extends Apple2e {
for (SoftSwitches s : SoftSwitches.values()) {
s.getSwitch().reset();
}
(new Thread(this::startAnimation)).start();
if (showBootAnimation) {
(new Thread(this::startAnimation)).start();
} else {
finishColdStart();
getMotherboard().requestSpeed(this);
}
}
public void startAnimation() {