aboutsummaryrefslogtreecommitdiff
path: root/src/gui/Driver.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-05-19 01:15:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-05-19 01:15:47 -0400
commit7c106e7dda744e7d3782737262601de693db0dca (patch)
treefccec4b5825bb63e2d1195dce431f063ac87f5cb /src/gui/Driver.java
parentfe9794bdc8270b43ed5ae847d65ea2a2eecd4a79 (diff)
downloadNPEhero-7c106e7dda744e7d3782737262601de693db0dca.tar.gz
NPEhero-7c106e7dda744e7d3782737262601de693db0dca.tar.bz2
NPEhero-7c106e7dda744e7d3782737262601de693db0dca.zip
- overhaul css (not done)
- rewrite driver - add difficulty buttons - remove placeholders (not done)
Diffstat (limited to 'src/gui/Driver.java')
-rw-r--r--src/gui/Driver.java33
1 files changed, 8 insertions, 25 deletions
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<String,Pane> menus = new HashMap<String,Pane>();
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(