aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2024-08-31 21:39:29 -0400
committersowgro <tpoke.ferrari@gmail.com>2024-08-31 21:39:29 -0400
commite026f360ca7777fe72ec1b3bd86045f7d94aa834 (patch)
treefaedd4ea64e444063d804d6d81a16a64dd1bdfef /src/main/java/net/sowgro/npehero/gui/LevelSurround.java
parent2dd291f259734564b8d507a10b29602ef3a4e462 (diff)
downloadNPEhero-e026f360ca7777fe72ec1b3bd86045f7d94aa834.tar.gz
NPEhero-e026f360ca7777fe72ec1b3bd86045f7d94aa834.tar.bz2
NPEhero-e026f360ca7777fe72ec1b3bd86045f7d94aa834.zip
finish SongPlayer rewrite
- move from gameloop to timeline - significant code clean up - change design of blocks and targets
Diffstat (limited to 'src/main/java/net/sowgro/npehero/gui/LevelSurround.java')
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/gui/LevelSurround.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
index 09eeaa0..4b11c15 100755
--- a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
+++ b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
@@ -1,5 +1,6 @@
package net.sowgro.npehero.gui;
+import javafx.animation.AnimationTimer;
import net.sowgro.npehero.Driver;
import net.sowgro.npehero.gameplay.SongPlayer;
import javafx.geometry.Insets;
@@ -12,7 +13,6 @@ import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import net.sowgro.npehero.levelapi.Difficulty;
-import net.sowgro.npehero.levelapi.Level;
import net.sowgro.npehero.gameplay.ScoreController;
import net.sowgro.npehero.main.Page;
import net.sowgro.npehero.main.Sound;
@@ -55,10 +55,10 @@ public class LevelSurround extends Page
AnchorPane topBar = new AnchorPane();
topBar.getChildren().addAll(buttonBox,titleTextBox);
- topBar.setLeftAnchor(buttonBox, 0.0);
- topBar.setRightAnchor(titleTextBox, 0.0);
- topBar.setTopAnchor(buttonBox, 0.0);
- topBar.setTopAnchor(titleTextBox, 0.0);
+ AnchorPane.setLeftAnchor(buttonBox, 0.0);
+ AnchorPane.setRightAnchor(titleTextBox, 0.0);
+ AnchorPane.setTopAnchor(buttonBox, 0.0);
+ AnchorPane.setTopAnchor(titleTextBox, 0.0);
topBar.setPadding(new Insets(10));
@@ -79,8 +79,8 @@ public class LevelSurround extends Page
AnchorPane scoreBox = new AnchorPane();
scoreBox.getChildren().add(scoreTextBox);
- scoreBox.setLeftAnchor(scoreTextBox, 0.0);
- scoreBox.setBottomAnchor(scoreTextBox, 0.0);
+ AnchorPane.setLeftAnchor(scoreTextBox, 0.0);
+ AnchorPane.setBottomAnchor(scoreTextBox, 0.0);
scoreBox.setPadding(new Insets(10));
Text comboLabel = new Text();
@@ -100,17 +100,17 @@ public class LevelSurround extends Page
AnchorPane comboBox = new AnchorPane();
comboBox.getChildren().add(comboTextBox);
- comboBox.setRightAnchor(comboTextBox, 0.0);
- comboBox.setBottomAnchor(comboTextBox, 0.0);
+ AnchorPane.setRightAnchor(comboTextBox, 0.0);
+ AnchorPane.setBottomAnchor(comboTextBox, 0.0);
comboBox.setPadding(new Insets(10));
- game.minWidthProperty().bind(content.heightProperty().multiply(0.66));
+ game.minWidthProperty().bind(content.heightProperty().multiply(0.55));
game.minHeightProperty().bind(content.heightProperty());
game.getStyleClass().add("box");
- comboBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.minWidthProperty()).divide(2));
- scoreBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.minWidthProperty()).divide(2));
+ comboBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.widthProperty()).divide(2));
+ scoreBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.widthProperty()).divide(2));
HBox centerBox = new HBox();
centerBox.getChildren().addAll(comboBox, game, scoreBox);
@@ -121,7 +121,12 @@ public class LevelSurround extends Page
content.getChildren().add(root);
- game.start();
+ new AnimationTimer() {
+ @Override
+ public void handle(long now) {
+ game.start();
+ }
+ }.start();
}
@Override