Fixed audio not getting correct volume at settings loading. Added back background music

This commit is contained in:
lieght
2025-10-05 01:51:29 +02:00
parent d7d6a49b98
commit 0ab0cd75ba
5 changed files with 13 additions and 4 deletions

View File

@@ -11,6 +11,8 @@ import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.toop.framework.asset.resources.SettingsAsset;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.local.AppSettings;
import java.io.File;
@@ -65,6 +67,8 @@ public final class App extends Application {
App.isQuitting = false;
new EventFlow().addPostEvent(new AudioEvents.StartBackgroundMusic()).postEvent();
activate(new MainLayer());
}

View File

@@ -84,7 +84,7 @@ public final class OptionsLayer extends Layer {
container.addSlider(100, currentVolume, (volume) -> {
currentVolume = volume;
settings.setVolume(volume);
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(volume.doubleValue() / 100.0)).asyncPostEvent();
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(volume.doubleValue())).asyncPostEvent();
});
}

View File

@@ -2,6 +2,8 @@ package org.toop.local;
import org.toop.app.App;
import org.toop.framework.asset.resources.SettingsAsset;
import org.toop.framework.audio.events.AudioEvents;
import org.toop.framework.eventbus.EventFlow;
import org.toop.framework.settings.Settings;
import java.io.File;
@@ -20,6 +22,8 @@ public class AppSettings {
AppContext.setLocale(Locale.of(settingsData.locale));
App.setFullscreen(settingsData.fullScreen);
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(settingsData.volume)).asyncPostEvent();
}
public SettingsAsset getPath() {