aboutsummaryrefslogtreecommitdiff
path: root/src/gui/Driver.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2024-07-08 02:41:31 -0400
committersowgro <tpoke.ferrari@gmail.com>2024-07-08 02:41:31 -0400
commitee2229339429d50afa33e2f8b9c0ee0939766290 (patch)
treea5ee54bd23c24950e9b10815f3e87605906992d8 /src/gui/Driver.java
parent9e1371424bdf4c31d756d686313730d4c61f7ac5 (diff)
downloadNPEhero-ee2229339429d50afa33e2f8b9c0ee0939766290.tar.gz
NPEhero-ee2229339429d50afa33e2f8b9c0ee0939766290.tar.bz2
NPEhero-ee2229339429d50afa33e2f8b9c0ee0939766290.zip
Change project structure, embed resources into jar and remove libraries from source control
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--]src/main/java/net/sowgro/npehero/Driver.java (renamed from src/gui/Driver.java)31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/gui/Driver.java b/src/main/java/net/sowgro/npehero/Driver.java
index b46f4c9..b5e226e 100644..100755
--- a/src/gui/Driver.java
+++ b/src/main/java/net/sowgro/npehero/Driver.java
@@ -1,4 +1,4 @@
-package gui;
+package net.sowgro.npehero;
import javafx.application.Application;
import javafx.application.Platform;
@@ -15,23 +15,25 @@ import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
-import main.LevelController;
-import main.SettingsController;
-import main.SoundController;
-import java.nio.file.Paths;
+import net.sowgro.npehero.gui.MainMenu;
+import net.sowgro.npehero.main.LevelController;
+import net.sowgro.npehero.main.SettingsController;
+import net.sowgro.npehero.main.SoundController;
-import devmenu.DebugMenu;
+import java.net.URL;
+import java.util.Objects;
public class Driver extends Application
-{
+{
+
public static Stage primaryStage;
static Pane primaryPane = new Pane();
public static SettingsController settingsController = new SettingsController();
public static SoundController soundController = new SoundController();
public static LevelController levelController = new LevelController();
- public static DebugMenu debug = new DebugMenu();
+// public static DebugMenu debug = new DebugMenu();
/*
* starts javafx
@@ -47,11 +49,12 @@ public class Driver extends Application
*/
@Override
public void start(Stage newPrimaryStage)
- {
+ {
primaryStage = newPrimaryStage;
Scene primaryScene = new Scene(primaryPane, 800,600);
- primaryScene.getStylesheets().add("gui/style.css");
+
+ primaryScene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
primaryStage.setScene(primaryScene);
primaryStage.setTitle("NPE Hero");
@@ -95,7 +98,7 @@ public class Driver extends Application
/**
* replaces the background image with a new one
- * @param url the url of the image to set
+ * @param image the url of the image to set
*/
public static void setBackground(Image image) //replaces background with a new one
{
@@ -110,7 +113,7 @@ public class Driver extends Application
public static void setMenuBackground()
{
- setBackground(new Image(Paths.get("resources/mountains.png").toUri().toString()));
+ setBackground(new Image(Driver.class.getResource("mountains.png").toExternalForm()));
}
/**
@@ -120,4 +123,8 @@ public class Driver extends Application
{
Platform.exit();
}
+
+ public static URL getResource(String fileName) {
+ return Driver.class.getResource(fileName);
+ }
}