From d7392b8ba11517117c25f6fc139da84873cb7cac Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Tue, 16 May 2023 19:35:33 -0400 Subject: Preliminary testing with converting the songPlayer class to JavaFX Code --- src/fallTest/newSongPlayer.java | 85 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/fallTest/newSongPlayer.java (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java new file mode 100644 index 0000000..89f0097 --- /dev/null +++ b/src/fallTest/newSongPlayer.java @@ -0,0 +1,85 @@ +package fallTest; + +import javafx.event.EventHandler; +import javafx.event.ActionEvent; +import javafx.geometry.Pos; +import javafx.scene.control.Button; +import javafx.scene.effect.BlurType; +import javafx.scene.effect.DropShadow; +import javafx.scene.layout.Border; +import javafx.scene.layout.BorderStroke; +import javafx.scene.layout.BorderStrokeStyle; +import javafx.scene.layout.BorderWidths; +import javafx.scene.layout.CornerRadii; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.Text; + +public class newSongPlayer extends Pane +{ + + public newSongPlayer() { + /*TButton dButton = new TButton(Color.RED, 50, 50, 5); + System.out.println(super.widthProperty()); + dButton.heightProperty().bind(super.widthProperty().divide(1)); + dButton.widthProperty().bind(super.widthProperty().divide(1)); + + HBox buttonBox = new HBox(); + buttonBox.getChildren().addAll(dButton); + buttonBox.setAlignment(Pos.CENTER); + buttonBox.setSpacing(10); + + super.getChildren().add(buttonBox); + //buttonBox.setBorder(border);*/ + } + + public void init() { + TButton dButton = new TButton(Color.RED, 50, 50, 5); + dButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + dButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + dButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + dButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + + TButton fButton = new TButton(Color.BLUE, 50, 50, 5); + fButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + fButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + fButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + fButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + + TButton sButton = new TButton(Color.GREEN, 50, 50, 5); + sButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + sButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + sButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + sButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + + TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); + jButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + jButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + jButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + jButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + + TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); + kButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + kButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); + kButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + kButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + + + + HBox buttonBox = new HBox(); + buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton); + buttonBox.setAlignment(Pos.CENTER); + buttonBox.setSpacing(10); + + VBox root = new VBox(); + root.getChildren().addAll(buttonBox); + root.setAlignment(Pos.BOTTOM_CENTER); + root.setSpacing(10); + + + super.getChildren().add(root); + } +} -- cgit v1.2.3 From fbd52c44150e463b2c24da2ff38f1acc11edac4d Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Tue, 16 May 2023 20:06:19 -0400 Subject: Improved Button Look --- src/fallTest/newSongPlayer.java | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index 89f0097..d98b235 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -6,6 +6,7 @@ import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.effect.BlurType; import javafx.scene.effect.DropShadow; +import javafx.scene.input.KeyCode; import javafx.scene.layout.Border; import javafx.scene.layout.BorderStroke; import javafx.scene.layout.BorderStrokeStyle; @@ -42,41 +43,70 @@ public class newSongPlayer extends Pane dButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); dButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); dButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + dButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + dButton.setOnKeyPressed(e -> { + if (e.getCode() == KeyCode.D) { + System.out.println("D"); + } + }); TButton fButton = new TButton(Color.BLUE, 50, 50, 5); fButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); fButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); fButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); fButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + fButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + fButton.setOnKeyPressed(e -> { + if (e.getCode() == KeyCode.F) { + System.out.println("F"); + } + }); TButton sButton = new TButton(Color.GREEN, 50, 50, 5); sButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); sButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); sButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); sButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + sButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + sButton.setOnKeyPressed(e -> { + if (e.getCode() == KeyCode.SPACE) { + System.out.println("SPC"); + } + }); TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); jButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); jButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); jButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); jButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); + jButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + jButton.setOnKeyPressed(e -> { + if (e.getCode() == KeyCode.J) { + System.out.println("J"); + } + }); TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); kButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); kButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); kButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); kButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - + kButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + kButton.setOnKeyPressed(e -> { + if (e.getCode() == KeyCode.K) { + System.out.println("K"); + } + }); HBox buttonBox = new HBox(); + buttonBox.setAlignment(Pos.CENTER_LEFT); buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton); - buttonBox.setAlignment(Pos.CENTER); buttonBox.setSpacing(10); VBox root = new VBox(); + root.setAlignment(Pos.CENTER); root.getChildren().addAll(buttonBox); - root.setAlignment(Pos.BOTTOM_CENTER); root.setSpacing(10); -- cgit v1.2.3 From 0ec11156c87afc066b1a6ef8f569aedad3a16ae5 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Tue, 16 May 2023 22:48:41 -0400 Subject: Overhaul of the look of the gui, I need to rename the boxes --- src/fallTest/newSongPlayer.java | 107 +++++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 46 deletions(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index d98b235..ff96d63 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -1,6 +1,10 @@ package fallTest; import javafx.event.EventHandler; + +import java.awt.Insets; + +import javafx.event.*; import javafx.event.ActionEvent; import javafx.geometry.Pos; import javafx.scene.control.Button; @@ -14,36 +18,27 @@ import javafx.scene.layout.BorderWidths; import javafx.scene.layout.CornerRadii; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; +import javafx.scene.shape.Rectangle; import javafx.scene.text.Font; import javafx.scene.text.Text; public class newSongPlayer extends Pane { - - public newSongPlayer() { - /*TButton dButton = new TButton(Color.RED, 50, 50, 5); - System.out.println(super.widthProperty()); - dButton.heightProperty().bind(super.widthProperty().divide(1)); - dButton.widthProperty().bind(super.widthProperty().divide(1)); - - HBox buttonBox = new HBox(); - buttonBox.getChildren().addAll(dButton); - buttonBox.setAlignment(Pos.CENTER); - buttonBox.setSpacing(10); - - super.getChildren().add(buttonBox); - //buttonBox.setBorder(border);*/ - } - public void init() { + Rectangle field = new Rectangle(50, 50, new Color(0, 0, 0, 0.7)); + field.heightProperty().bind(this.getScene().getWindow().heightProperty().multiply(0.95)); + field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.).add(50)); + TButton dButton = new TButton(Color.RED, 50, 50, 5); - dButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - dButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - dButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - dButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - dButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + dButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + dButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + dButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + dButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + dButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); + //Text dButtonText = new Text("D"); dButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.D) { System.out.println("D"); @@ -51,11 +46,11 @@ public class newSongPlayer extends Pane }); TButton fButton = new TButton(Color.BLUE, 50, 50, 5); - fButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - fButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - fButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - fButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - fButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + fButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + fButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + fButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + fButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + fButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); fButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.F) { System.out.println("F"); @@ -63,11 +58,11 @@ public class newSongPlayer extends Pane }); TButton sButton = new TButton(Color.GREEN, 50, 50, 5); - sButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - sButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - sButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - sButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - sButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + sButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + sButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + sButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + sButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + sButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); sButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.SPACE) { System.out.println("SPC"); @@ -75,11 +70,11 @@ public class newSongPlayer extends Pane }); TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); - jButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - jButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - jButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - jButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - jButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + jButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + jButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + jButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + jButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + jButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); jButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.J) { System.out.println("J"); @@ -87,29 +82,49 @@ public class newSongPlayer extends Pane }); TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); - kButton.heightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - kButton.widthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(20)); - kButton.arcHeightProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - kButton.arcWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(100)); - kButton.strokeWidthProperty().bind(this.getScene().getWindow().heightProperty().add(this.getScene().getWindow().widthProperty()).divide(420)); + kButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + kButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); + kButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + kButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + kButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); kButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.K) { System.out.println("K"); } }); + //StackPane dButtonComplete = new StackPane(); + //dButtonComplete.getChildren().addAll(dButtonText, dButton); HBox buttonBox = new HBox(); - buttonBox.setAlignment(Pos.CENTER_LEFT); + + buttonBox.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" + + "-fx-border-width: 0;" + "-fx-border-insets: 20;" + + "-fx-border-radius: 0;" + "-fx-border-color: black;" + + "-fx-background-color: black;" + "-fx-opacity: 0.67;"); + buttonBox.setAlignment(Pos.CENTER); buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton); buttonBox.setSpacing(10); - VBox root = new VBox(); - root.setAlignment(Pos.CENTER); - root.getChildren().addAll(buttonBox); - root.setSpacing(10); + VBox polish = new VBox(); + polish.prefHeightProperty().bind(this.getScene().heightProperty()); + polish.getChildren().addAll(field); + polish.setAlignment(Pos.TOP_CENTER); + + VBox place = new VBox(); + place.prefWidthProperty().bind(this.getScene().widthProperty()); + place.prefHeightProperty().bind(this.getScene().heightProperty()); + //root.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" + // + "-fx-border-width: 2;" + "-fx-border-insets: 0;" + // + "-fx-border-radius: 2;" + "-fx-border-color: red;"); + place.setAlignment(Pos.BOTTOM_CENTER); + place.getChildren().addAll(buttonBox); + place.setSpacing(10); + StackPane root = new StackPane(); + root.getChildren().addAll(polish, place); super.getChildren().add(root); + } } -- cgit v1.2.3 From a7b4e891e02811222a2fcde1335b97ac1575bba9 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Wed, 17 May 2023 08:55:09 -0400 Subject: Making the buttons smaller, and began setting up the note visualization --- src/fallTest/newSongPlayer.java | 97 ++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 59 deletions(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index ff96d63..f9affad 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -3,6 +3,9 @@ package fallTest; import javafx.event.EventHandler; import java.awt.Insets; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.Queue; import javafx.event.*; import javafx.event.ActionEvent; @@ -27,96 +30,54 @@ import javafx.scene.text.Text; public class newSongPlayer extends Pane { + Timer time = new Timer(); + + private double dLaneX; + + public void init() { + Queue dSends = new LinkedList(); //Queue that dictates when to send the notes + ArrayList dLane = new ArrayList(); //Array list containing all the notes currently on the field + Rectangle field = new Rectangle(50, 50, new Color(0, 0, 0, 0.7)); field.heightProperty().bind(this.getScene().getWindow().heightProperty().multiply(0.95)); - field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.).add(50)); - + field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.7).add(50)); TButton dButton = new TButton(Color.RED, 50, 50, 5); - dButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - dButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - dButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - dButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - dButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); - //Text dButtonText = new Text("D"); - dButton.setOnKeyPressed(e -> { + genButton(dButton); + /*dButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.D) { System.out.println("D"); } - }); + });*/ TButton fButton = new TButton(Color.BLUE, 50, 50, 5); - fButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - fButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - fButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - fButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - fButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); - fButton.setOnKeyPressed(e -> { - if (e.getCode() == KeyCode.F) { - System.out.println("F"); - } - }); + genButton(fButton); TButton sButton = new TButton(Color.GREEN, 50, 50, 5); - sButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - sButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - sButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - sButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - sButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); - sButton.setOnKeyPressed(e -> { - if (e.getCode() == KeyCode.SPACE) { - System.out.println("SPC"); - } - }); + genButton(sButton); TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); - jButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - jButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - jButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - jButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - jButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); - jButton.setOnKeyPressed(e -> { - if (e.getCode() == KeyCode.J) { - System.out.println("J"); - } - }); + genButton(jButton); TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); - kButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - kButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12)); - kButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - kButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); - kButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); - kButton.setOnKeyPressed(e -> { - if (e.getCode() == KeyCode.K) { - System.out.println("K"); - } - }); - - //StackPane dButtonComplete = new StackPane(); - //dButtonComplete.getChildren().addAll(dButtonText, dButton); + genButton(kButton); + HBox buttonBox = new HBox(); - buttonBox.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" + "-fx-border-width: 0;" + "-fx-border-insets: 20;" - + "-fx-border-radius: 0;" + "-fx-border-color: black;" + "-fx-background-color: black;" + "-fx-opacity: 0.67;"); buttonBox.setAlignment(Pos.CENTER); buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton); buttonBox.setSpacing(10); VBox polish = new VBox(); - polish.prefHeightProperty().bind(this.getScene().heightProperty()); polish.getChildren().addAll(field); polish.setAlignment(Pos.TOP_CENTER); VBox place = new VBox(); place.prefWidthProperty().bind(this.getScene().widthProperty()); place.prefHeightProperty().bind(this.getScene().heightProperty()); - //root.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;" - // + "-fx-border-width: 2;" + "-fx-border-insets: 0;" - // + "-fx-border-radius: 2;" + "-fx-border-color: red;"); place.setAlignment(Pos.BOTTOM_CENTER); place.getChildren().addAll(buttonBox); place.setSpacing(10); @@ -126,5 +87,23 @@ public class newSongPlayer extends Pane super.getChildren().add(root); + sendNote(dLane); + } + + public void sendNote(ArrayList lane) { + lane.add(new Block(Color.PINK, 50, 50, 5)); + lane.get(lane.size()-1).heightProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); + lane.get(lane.size()-1).widthProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); + lane.get(lane.size()-1).arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + lane.get(lane.size()-1).arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + super.getChildren().add(lane.get(lane.size()-1)); + } + + public void genButton(TButton button) { + button.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); + button.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); + button.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + button.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + button.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210)); } } -- cgit v1.2.3 From bc7c7d96419a10d85e6b4a2ec5e1a2cbe78de9b1 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Wed, 17 May 2023 09:05:37 -0400 Subject: resized buttons and set up infrastructure for the note animation --- src/fallTest/newSongPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index f9affad..46d6e4b 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -32,7 +32,7 @@ public class newSongPlayer extends Pane { Timer time = new Timer(); - private double dLaneX; + private double dLaneX = 0; public void init() { -- cgit v1.2.3 From 33b5b82b1a2c511c6de0c1f744aec1f04bee12f7 Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Wed, 17 May 2023 09:38:56 -0400 Subject: resized buttons and testing note displays --- src/fallTest/newSongPlayer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/fallTest/newSongPlayer.java') diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index 46d6e4b..3f6d4ed 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; +import javafx.beans.property.DoubleProperty; import javafx.event.*; import javafx.event.ActionEvent; import javafx.geometry.Pos; @@ -33,7 +34,7 @@ public class newSongPlayer extends Pane Timer time = new Timer(); private double dLaneX = 0; - + TButton dButton = new TButton(Color.RED, 50, 50, 5); public void init() { Queue dSends = new LinkedList(); //Queue that dictates when to send the notes @@ -42,7 +43,6 @@ public class newSongPlayer extends Pane Rectangle field = new Rectangle(50, 50, new Color(0, 0, 0, 0.7)); field.heightProperty().bind(this.getScene().getWindow().heightProperty().multiply(0.95)); field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.7).add(50)); - TButton dButton = new TButton(Color.RED, 50, 50, 5); genButton(dButton); /*dButton.setOnKeyPressed(e -> { if (e.getCode() == KeyCode.D) { @@ -86,16 +86,17 @@ public class newSongPlayer extends Pane root.getChildren().addAll(polish, place); super.getChildren().add(root); - - sendNote(dLane); + sendNote(dLane, buttonBox.getLayoutX()); } - public void sendNote(ArrayList lane) { + public void sendNote(ArrayList lane, double pos) { lane.add(new Block(Color.PINK, 50, 50, 5)); lane.get(lane.size()-1).heightProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); lane.get(lane.size()-1).widthProperty().bind(this.getScene().getWindow().widthProperty().divide(16)); lane.get(lane.size()-1).arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); lane.get(lane.size()-1).arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50)); + lane.get(lane.size()-1).setX(pos); + System.out.println(pos); super.getChildren().add(lane.get(lane.size()-1)); } -- cgit v1.2.3