Skip to content
Snippets Groups Projects

Sound: Music is playing, fuiyoh

Merged Gehrung Jonas requested to merge sound into development
30 files
+ 169
0
Compare changes
  • Side-by-side
  • Inline
Files
30
package de.hdm_stuttgart.battlearena.Main;
import de.hdm_stuttgart.battlearena.Model.Sound.MusicType;
import de.hdm_stuttgart.battlearena.Model.Sound.SFX;
import de.hdm_stuttgart.battlearena.Model.Sound.SoundManager;
import de.hdm_stuttgart.battlearena.Model.Inputs.InputHandler;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Rectangle2D;
@@ -30,6 +35,7 @@ public class Main extends Application {
@Override
public void start(Stage stage) throws Exception {
// loading font in start() because CSS can't handle whitespace in folder names
Font.loadFont(getClass().getResourceAsStream("/fonts/StarshipShadow.ttf"), 50);
@@ -53,6 +59,17 @@ public class Main extends Application {
scene.getStylesheets().add(Objects.requireNonNull(this.getClass().getResource("/styles/style.css")).toExternalForm());
stage.setScene(scene);
SoundManager soundManager = new SoundManager();
stage.setOnCloseRequest(event -> {
if (soundManager != null) {
soundManager.stopMusic();
}
});
soundManager.playMusic(MusicType.GAME);
stage.show();
log.debug("Project started successfully!");
}
Loading