aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-06-08 02:50:36 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-06-08 02:50:36 -0400
commit5951f6b55f20981f411a06d98fb686acc4da394e (patch)
tree7f3657ddb1a714afd90be952cd0f4e736572c006 /src/main
parente498bd79689dfc3f9a8fd4670b825dddcbc24842 (diff)
downloadNPEhero-5951f6b55f20981f411a06d98fb686acc4da394e.tar.gz
NPEhero-5951f6b55f20981f411a06d98fb686acc4da394e.tar.bz2
NPEhero-5951f6b55f20981f411a06d98fb686acc4da394e.zip
move resources out of src so they can be read from a jar
Diffstat (limited to 'src/main')
-rw-r--r--src/main/Level.java2
-rw-r--r--src/main/SoundController.java12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/main/Level.java b/src/main/Level.java
index 79f70e1..313b1fa 100644
--- a/src/main/Level.java
+++ b/src/main/Level.java
@@ -80,7 +80,7 @@ public class Level
diffList = FXCollections.observableArrayList();
validDiffList = FXCollections.observableArrayList();
- for(File cur: thisDir.listFiles()) //iterates through all files/folders in src/assets/levels/LEVEL
+ for(File cur: thisDir.listFiles()) //iterates through all files/folders in /levels/LEVEL
{
if (cur.isDirectory()) //all subfolders within a level folder are difficulties
{
diff --git a/src/main/SoundController.java b/src/main/SoundController.java
index 8f255da..0d7527e 100644
--- a/src/main/SoundController.java
+++ b/src/main/SoundController.java
@@ -1,6 +1,7 @@
package main;
import java.io.File;
+import java.nio.file.Paths;
import java.util.HashMap;
import gui.Driver;
@@ -13,17 +14,18 @@ public class SoundController
public MediaPlayer songMediaPlayer;
public MediaPlayer sfxMediaPlayer;
private HashMap<String,MediaPlayer> effects = new HashMap<>();
- private File mainMenuSong = new File("src/assets/fairyfountain.wav");
+ private File mainMenuSong = Paths.get("resources/fairyfountain.wav").toFile();
+
/**
* creates a new sound controller and starts playing the main menu music
*/
public SoundController()
{
- effects.put("hit", new MediaPlayer(new Media(new File("src/assets/hit.wav").toURI().toString())));
- effects.put("miss", new MediaPlayer(new Media(new File("src/assets/miss.wav").toURI().toString())));
- effects.put("forward", new MediaPlayer(new Media(new File("src/assets/forward.wav").toURI().toString())));
- effects.put("backward", new MediaPlayer(new Media(new File("src/assets/backward.wav").toURI().toString())));
+ effects.put("hit", new MediaPlayer(new Media(Paths.get("resources/hit.wav").toUri().toString())));
+ effects.put("miss", new MediaPlayer(new Media(Paths.get("resources/miss.wav").toUri().toString())));
+ effects.put("forward", new MediaPlayer(new Media(Paths.get("resources/forward.wav").toUri().toString())));
+ effects.put("backward", new MediaPlayer(new Media(Paths.get("resources/backward.wav").toUri().toString())));
effects.forEach((key,value) -> {
value.volumeProperty().bind(Driver.settingsController.effectsVol);
});