From 7c106e7dda744e7d3782737262601de693db0dca Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 19 May 2023 01:15:47 -0400 Subject: - overhaul css (not done) - rewrite driver - add difficulty buttons - remove placeholders (not done) --- src/gui/Driver.java | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'src/gui/Driver.java') diff --git a/src/gui/Driver.java b/src/gui/Driver.java index 56bc36a..b93dbce 100644 --- a/src/gui/Driver.java +++ b/src/gui/Driver.java @@ -13,12 +13,12 @@ import javafx.scene.layout.BackgroundRepeat; import javafx.scene.layout.BackgroundSize; import javafx.scene.layout.Pane; import javafx.stage.Stage; +import main.LevelController; public class Driver extends Application { static Stage primaryStage; - static HashMap menus = new HashMap(); static Pane primaryPane = new Pane(); public static void main(String[] args) @@ -29,43 +29,22 @@ public class Driver extends Application @Override public void start(Stage newPrimaryStage) { + new LevelController(); primaryStage = newPrimaryStage; - menus.put("MainMenu", new MainMenu()); - menus.put("LevelSelector", new LevelSelector()); - menus.put("Settings", new Settings()); - menus.put("Leaderboard", new Leaderboard()); - for (Pane value : menus.values()) { - System.out.println(primaryStage.heightProperty()); - value.prefHeightProperty().bind(primaryPane.heightProperty()); - value.prefWidthProperty().bind(primaryPane.widthProperty()); - } - - Scene primaryScene = new Scene(primaryPane, 800, 600); primaryScene.getStylesheets().add("gui/style.css"); primaryStage.setScene(primaryScene); primaryStage.setTitle("NPE Hero"); - setMenu("MainMenu"); + setMenu(new MainMenu()); setBackground("assets/water.png"); primaryStage.show(); } - - public static void setMenu(String name) - { - if (! primaryPane.getChildren().isEmpty()) - { - primaryPane.getChildren().remove(0); - } - primaryPane.getChildren().add(menus.get(name)); - primaryPane.requestFocus(); - } - - public static void setCustomMenu(Pane pane) + public static void setMenu(Pane pane) { if (! primaryPane.getChildren().isEmpty()) { @@ -77,6 +56,10 @@ public class Driver extends Application primaryPane.requestFocus(); } + public static Pane getMenu(){ + return (Pane) primaryPane.getChildren().get(0); + } + public static void setBackground(String url) { primaryPane.setBackground(new Background( -- cgit v1.2.3