mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-02-06 20:30:06 +00:00
Added speaker toggle
This commit is contained in:
parent
f572feade0
commit
45201b5721
@ -18,6 +18,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import jace.core.Card;
|
import jace.core.Card;
|
||||||
|
import jace.core.Motherboard;
|
||||||
import jace.core.Utility;
|
import jace.core.Utility;
|
||||||
import jace.core.Video;
|
import jace.core.Video;
|
||||||
import jace.lawless.LawlessComputer;
|
import jace.lawless.LawlessComputer;
|
||||||
@ -34,6 +35,7 @@ import javafx.beans.binding.NumberBinding;
|
|||||||
import javafx.beans.binding.When;
|
import javafx.beans.binding.When;
|
||||||
import javafx.beans.property.BooleanProperty;
|
import javafx.beans.property.BooleanProperty;
|
||||||
import javafx.beans.property.SimpleBooleanProperty;
|
import javafx.beans.property.SimpleBooleanProperty;
|
||||||
|
import javafx.beans.value.ObservableNumberValue;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
@ -94,6 +96,9 @@ public class JaceUIController {
|
|||||||
@FXML
|
@FXML
|
||||||
private ComboBox<String> musicSelection;
|
private ComboBox<String> musicSelection;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private Slider speakerToggle;
|
||||||
|
|
||||||
private final BooleanProperty aspectRatioCorrectionEnabled = new SimpleBooleanProperty(false);
|
private final BooleanProperty aspectRatioCorrectionEnabled = new SimpleBooleanProperty(false);
|
||||||
|
|
||||||
public static final double MIN_SPEED = 0.5;
|
public static final double MIN_SPEED = 0.5;
|
||||||
@ -132,7 +137,23 @@ public class JaceUIController {
|
|||||||
rootPane.requestFocus();
|
rootPane.requestFocus();
|
||||||
}));
|
}));
|
||||||
rootPane.requestFocus();
|
rootPane.requestFocus();
|
||||||
|
speakerToggle.setValue(1.0);
|
||||||
|
speakerToggle.setOnMouseClicked(evt -> {
|
||||||
|
speakerEnabled = !speakerEnabled;
|
||||||
|
int desiredValue = speakerEnabled ? 1 : 0;
|
||||||
|
speakerToggle.setValue(desiredValue);
|
||||||
|
Emulator.withComputer(computer -> {
|
||||||
|
Motherboard.enableSpeaker = speakerEnabled;
|
||||||
|
computer.motherboard.reconfigure();
|
||||||
|
if (!speakerEnabled) {
|
||||||
|
computer.motherboard.speaker.detach();
|
||||||
|
} else {
|
||||||
|
computer.motherboard.speaker.attach();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
boolean speakerEnabled = true;
|
||||||
|
|
||||||
private void showMenuButton(MouseEvent evt) {
|
private void showMenuButton(MouseEvent evt) {
|
||||||
if (!evt.isPrimaryButtonDown() && !evt.isSecondaryButtonDown() && !controlOverlay.isVisible()) {
|
if (!evt.isPrimaryButtonDown() && !evt.isSecondaryButtonDown() && !controlOverlay.isVisible()) {
|
||||||
|
@ -1,17 +1,30 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.String?>
|
||||||
<?import javafx.collections.FXCollections?>
|
<?import javafx.collections.FXCollections?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
<?import javafx.scene.image.*?>
|
<?import javafx.scene.control.ComboBox?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import java.lang.String?>
|
<?import javafx.scene.control.Slider?>
|
||||||
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="384.0" prefWidth="560.0" style="-fx-background-color: black;" stylesheets="@../styles/style.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
|
<?import javafx.scene.image.Image?>
|
||||||
|
<?import javafx.scene.image.ImageView?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.HBox?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
|
<?import javafx.scene.layout.StackPane?>
|
||||||
|
<?import javafx.scene.layout.TilePane?>
|
||||||
|
|
||||||
|
<AnchorPane id="AnchorPane" fx:id="rootPane" prefHeight="384.0" prefWidth="560.0" style="-fx-background-color: black;" stylesheets="@../styles/style.css" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="jace.JaceUIController">
|
||||||
<children>
|
<children>
|
||||||
<StackPane fx:id="stackPane" prefHeight="384.0" prefWidth="560.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<StackPane fx:id="stackPane" prefHeight="384.0" prefWidth="560.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" style="-fx-background-color: BLACK;" />
|
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" style="-fx-background-color: BLACK;" />
|
||||||
<HBox fx:id="notificationBox" alignment="BOTTOM_RIGHT" fillHeight="false" minHeight="45.0" maxHeight="45.0" mouseTransparent="true" prefHeight="45.0" prefWidth="560.0" StackPane.alignment="BOTTOM_CENTER" />
|
<HBox fx:id="notificationBox" alignment="BOTTOM_RIGHT" fillHeight="false" maxHeight="45.0" minHeight="45.0" mouseTransparent="true" prefHeight="45.0" prefWidth="560.0" StackPane.alignment="BOTTOM_CENTER" />
|
||||||
<AnchorPane fx:id="menuButtonPane" prefHeight="200.0" prefWidth="200.0">
|
<AnchorPane fx:id="menuButtonPane" prefHeight="200.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<Button fx:id="menuButton" layoutX="494.0" layoutY="14.0" mnemonicParsing="false" styleClass="menuButton" text="☰" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
<Button fx:id="menuButton" layoutX="494.0" layoutY="14.0" mnemonicParsing="false" styleClass="menuButton" text="☰" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
|
||||||
@ -55,7 +68,7 @@
|
|||||||
<top>
|
<top>
|
||||||
<HBox fillHeight="false" nodeOrientation="LEFT_TO_RIGHT" BorderPane.alignment="CENTER">
|
<HBox fillHeight="false" nodeOrientation="LEFT_TO_RIGHT" BorderPane.alignment="CENTER">
|
||||||
<children>
|
<children>
|
||||||
<TilePane hgap="5.0" nodeOrientation="LEFT_TO_RIGHT" vgap="5.0" HBox.hgrow="SOMETIMES">
|
<TilePane hgap="5.0" nodeOrientation="LEFT_TO_RIGHT" vgap="5.0" HBox.hgrow="NEVER">
|
||||||
<children>
|
<children>
|
||||||
<Button contentDisplay="TOP" mnemonicParsing="false" styleClass="uiActionButton" text="Info">
|
<Button contentDisplay="TOP" mnemonicParsing="false" styleClass="uiActionButton" text="Info">
|
||||||
<graphic>
|
<graphic>
|
||||||
@ -77,10 +90,18 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</children>
|
</children>
|
||||||
</TilePane>
|
</TilePane>
|
||||||
<TilePane alignment="TOP_RIGHT" hgap="5.0" vgap="5.0" HBox.hgrow="ALWAYS">
|
<GridPane prefHeight="70.0" prefWidth="467.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints halignment="RIGHT" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label styleClass="musicLabel">Music:</Label>
|
<Label alignment="CENTER_RIGHT" styleClass="musicLabel" textAlignment="RIGHT">Music:</Label>
|
||||||
<ComboBox fx:id="musicSelection">
|
<ComboBox fx:id="musicSelection" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<String fx:value="8-bit Chipmusic" />
|
<String fx:value="8-bit Chipmusic" />
|
||||||
@ -89,40 +110,13 @@
|
|||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
<value>
|
<value>
|
||||||
<String fx:value="8-bit Chipmusic"/>
|
<String fx:value="8-bit Chipmusic" />
|
||||||
</value>
|
</value>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<!--
|
<Label alignment="CENTER_RIGHT" prefHeight="53.0" prefWidth="201.0" styleClass="musicLabel" text="Speaker:" textAlignment="RIGHT" GridPane.rowIndex="1" />
|
||||||
<Button contentDisplay="TOP" mnemonicParsing="false" styleClass="uiActionButton" text="IDE">
|
<Slider fx:id="speakerToggle" blockIncrement="1.0" majorTickUnit="1.0" max="1.0" maxWidth="32.0" minWidth="32.0" minorTickCount="0" prefWidth="32.0" snapToTicks="true" GridPane.columnIndex="1" GridPane.rowIndex="1" />
|
||||||
<graphic>
|
|
||||||
<ImageView>
|
|
||||||
<image>
|
|
||||||
<Image url="@../styles/icons/ide.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</graphic>
|
|
||||||
</Button>
|
|
||||||
<Button contentDisplay="TOP" mnemonicParsing="false" styleClass="uiActionButton" text="Inspect">
|
|
||||||
<graphic>
|
|
||||||
<ImageView>
|
|
||||||
<image>
|
|
||||||
<Image url="@../styles/icons/inspect.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</graphic>
|
|
||||||
</Button>
|
|
||||||
<Button alignment="TOP_LEFT" contentDisplay="TOP" mnemonicParsing="false" styleClass="uiActionButton" text="Plug-in" TilePane.alignment="TOP_RIGHT">
|
|
||||||
<graphic>
|
|
||||||
<ImageView>
|
|
||||||
<image>
|
|
||||||
<Image url="@../styles/icons/plugin.png" />
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</graphic>
|
|
||||||
</Button>
|
|
||||||
-->
|
|
||||||
</children>
|
</children>
|
||||||
</TilePane>
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</top>
|
</top>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
-fx-background-radius: 10px;
|
-fx-background-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menuButton, .uiActionButton, .uiSpeedSlider ImageView, .uiSpeedSlider Slider, .uiSpeedSlider AnchorPane, .musicLabel {
|
.menuButton, .uiActionButton, .uiSpeedSlider ImageView, .uiSpeedSlider Slider, .uiSpeedSlider AnchorPane, .musicLabel, GridPane {
|
||||||
-fx-background-color: rgba(0, 0, 0, 0.75);
|
-fx-background-color: rgba(0, 0, 0, 0.75);
|
||||||
-fx-text-fill: #a0FFa0
|
-fx-text-fill: #a0FFa0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user