diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2023-06-06 23:22:47 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2023-06-06 23:22:47 -0400 |
commit | 9b7cad1006eced84d3b81d52173759ba709245a2 (patch) | |
tree | 052d3172860fd4a2157664e12606d84d1ea45b19 /src/gui | |
parent | 49ccb5c20aa84501c1ed6b534bfa00a4a9dc5902 (diff) | |
download | NPEhero-9b7cad1006eced84d3b81d52173759ba709245a2.tar.gz NPEhero-9b7cad1006eced84d3b81d52173759ba709245a2.tar.bz2 NPEhero-9b7cad1006eced84d3b81d52173759ba709245a2.zip |
fix sound and project cleanup
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Driver.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/Driver.java b/src/gui/Driver.java index 9e09860..fd18933 100644 --- a/src/gui/Driver.java +++ b/src/gui/Driver.java @@ -18,6 +18,7 @@ import javafx.stage.Stage; import main.LevelController; import main.SettingsController; import main.SoundController; +import java.io.File; import devmenu.DebugMenu; @@ -56,7 +57,7 @@ public class Driver extends Application setMenu(new MainMenu()); - setBackground("assets/mountains.png"); + setMenuBackground(); primaryStage.addEventHandler(KeyEvent.KEY_PRESSED, event -> { //full screen stuff if (KeyCode.F11.equals(event.getCode())) { @@ -95,17 +96,22 @@ public class Driver extends Application * replaces the background image with a new one * @param url the url of the image to set */ - public static void setBackground(String url) //replaces background with a new one + public static void setBackground(Image image) //replaces background with a new one { primaryPane.setBackground(new Background( new BackgroundImage( - new Image(url), + image, BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, new BackgroundPosition(Side.LEFT, 0, true, Side.BOTTOM, 0, true), new BackgroundSize(BackgroundSize.AUTO, BackgroundSize.AUTO, true, true, false, true) ))); } + public static void setMenuBackground() + { + setBackground(new Image(new File("src/assets/mountains.png").toURI().toString())); + } + /** * quits the application */ |