From 9b7cad1006eced84d3b81d52173759ba709245a2 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 6 Jun 2023 23:22:47 -0400 Subject: fix sound and project cleanup --- src/gui/Driver.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui') 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 */ -- cgit v1.2.3