diff --git a/Projekte/battleship/client/src/main/java/pp/battleship/client/BattleshipApp.java b/Projekte/battleship/client/src/main/java/pp/battleship/client/BattleshipApp.java index 6ac1c72..9a96a3b 100644 --- a/Projekte/battleship/client/src/main/java/pp/battleship/client/BattleshipApp.java +++ b/Projekte/battleship/client/src/main/java/pp/battleship/client/BattleshipApp.java @@ -7,6 +7,15 @@ package pp.battleship.client; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.lang.System.Logger; +import java.lang.System.Logger.Level; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.logging.LogManager; + import com.jme3.app.DebugKeysAppState; import com.jme3.app.SimpleApplication; import com.jme3.app.StatsAppState; @@ -20,7 +29,10 @@ import com.jme3.input.controls.MouseButtonTrigger; import com.jme3.system.AppSettings; import com.simsilica.lemur.GuiGlobals; import com.simsilica.lemur.style.BaseStyles; + +import static pp.battleship.Resources.lookup; import pp.battleship.client.gui.BattleAppState; +import pp.battleship.client.gui.BgMusic; import pp.battleship.client.gui.EditorAppState; import pp.battleship.client.gui.SeaAppState; import pp.battleship.game.client.BattleshipClient; @@ -35,17 +47,6 @@ import pp.dialog.DialogBuilder; import pp.dialog.DialogManager; import pp.graphics.Draw; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.lang.System.Logger; -import java.lang.System.Logger.Level; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.logging.LogManager; - -import static pp.battleship.Resources.lookup; - /** * The main class for the Battleship client application. * It manages the initialization, input setup, GUI setup, and game states for the client. @@ -268,6 +269,7 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient attachGameSound(); stateManager.attachAll(new EditorAppState(), new BattleAppState(), new SeaAppState()); + attachBgMusic(); } /** @@ -279,6 +281,12 @@ public class BattleshipApp extends SimpleApplication implements BattleshipClient gameSound.setEnabled(GameSound.enabledInPreferences()); stateManager.attach(gameSound); } + private void attachBgMusic() { + final BgMusic gameSound = new BgMusic(); + gameSound.setEnabled(BgMusic.enabledInPreferences()); + stateManager.attach(gameSound); + } + /** * Updates the application state every frame.