aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2024-07-22 01:28:11 -0400
committersowgro <tpoke.ferrari@gmail.com>2024-07-22 01:28:11 -0400
commit231c511304915d80aab89d28779d7445ad21ef70 (patch)
tree976b3f2e19e84d71acec86607ee16c9c1d9bdef1 /src/main/java/net/sowgro/npehero/gui/LevelSurround.java
parentd29ac15fa2311cb664f14334f3043adfac4cf5f9 (diff)
downloadNPEhero-231c511304915d80aab89d28779d7445ad21ef70.tar.gz
NPEhero-231c511304915d80aab89d28779d7445ad21ef70.tar.bz2
NPEhero-231c511304915d80aab89d28779d7445ad21ef70.zip
Refactor: pages now extend Page
Diffstat (limited to 'src/main/java/net/sowgro/npehero/gui/LevelSurround.java')
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/gui/LevelSurround.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
index 2a0a51a..05614ff 100755
--- a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
+++ b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
@@ -14,12 +14,14 @@ import javafx.scene.text.Text;
import net.sowgro.npehero.main.Difficulty;
import net.sowgro.npehero.main.Level;
import net.sowgro.npehero.gameplay.ScoreController;
+import net.sowgro.npehero.main.Page;
import net.sowgro.npehero.main.Sound;
-public class LevelSurround extends Pane
-{
+public class LevelSurround extends Page
+{
+ private final HBox content = new HBox();
- public LevelSurround(Level level, Difficulty difficulty, Pane prev)
+ public LevelSurround(Level level, Difficulty difficulty, Page prev)
{
ScoreController sc = new ScoreController();
SongPlayer game = new SongPlayer(level, difficulty, prev, sc);
@@ -102,13 +104,13 @@ public class LevelSurround extends Pane
comboBox.setBottomAnchor(comboTextBox, 0.0);
comboBox.setPadding(new Insets(10));
- game.minWidthProperty().bind(super.prefHeightProperty().multiply(0.66));
- game.minHeightProperty().bind(super.prefHeightProperty());
+ game.minWidthProperty().bind(content.heightProperty().multiply(0.66));
+ game.minHeightProperty().bind(content.heightProperty());
game.getStyleClass().add("box");
- comboBox.minWidthProperty().bind(super.prefWidthProperty().subtract(game.minWidthProperty()).divide(2));
- scoreBox.minWidthProperty().bind(super.prefWidthProperty().subtract(game.minWidthProperty()).divide(2));
+ comboBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.minWidthProperty()).divide(2));
+ scoreBox.minWidthProperty().bind(Driver.primaryPane.widthProperty().subtract(game.minWidthProperty()).divide(2));
HBox centerBox = new HBox();
centerBox.getChildren().addAll(comboBox, game, scoreBox);
@@ -117,10 +119,13 @@ public class LevelSurround extends Pane
StackPane root = new StackPane();
root.getChildren().addAll(centerBox, topBar);
- super.getChildren().add(root);
- root.prefWidthProperty().bind(super.prefWidthProperty());
- root.prefHeightProperty().bind(super.prefHeightProperty());
+ content.getChildren().add(root);
game.start();
}
+
+ @Override
+ public Pane getContent() {
+ return content;
+ }
} \ No newline at end of file