diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2023-06-08 02:50:36 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2023-06-08 02:50:36 -0400 |
commit | 5951f6b55f20981f411a06d98fb686acc4da394e (patch) | |
tree | 7f3657ddb1a714afd90be952cd0f4e736572c006 /src/main/SoundController.java | |
parent | e498bd79689dfc3f9a8fd4670b825dddcbc24842 (diff) | |
download | NPEhero-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 '')
-rw-r--r-- | src/main/SoundController.java | 12 |
1 files changed, 7 insertions, 5 deletions
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); }); |