diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/GameMusic.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/GameMusic.java index d1d3e0a..284dc8b 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/GameMusic.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/GameMusic.java @@ -8,8 +8,7 @@ import com.jme3.asset.AssetLoadException; import com.jme3.asset.AssetNotFoundException; import com.jme3.audio.AudioData; import com.jme3.audio.AudioNode; -import pp.battleship.notification.GameEventListener; -import pp.battleship.notification.SoundEvent; + import java.lang.System.Logger; import java.lang.System.Logger.Level; @@ -116,6 +115,12 @@ public class GameMusic extends AbstractAppState { return null; } + /** + * Sets the vol param to the level set in PREFERENCES + * + * @param vol Volume level of the music as indicated by the Volume control Slider + * + */ public void setVolume(float vol){ menuMusicModern.setVolume(vol); PREFERENCES.putFloat(VOLUME_PREF, vol); diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeControl.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeControl.java index 5713bbf..45c795d 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeControl.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/gui/VolumeControl.java @@ -3,6 +3,7 @@ package pp.battleship.client.gui; import com.simsilica.lemur.Slider; import pp.battleship.client.GameMusic; + public class VolumeControl extends Slider { private final GameMusic menuMusicModern; @@ -16,6 +17,10 @@ public class VolumeControl extends Slider { getModel().setPercent(vol); } + /** + * Updates the volume of the music to the appropriate level set by the User through the Volume control Slider + * + */ public void update() { if (vol != getModel().getPercent()) { vol = getModel().getPercent();