Properly change volume

This commit is contained in:
2024-01-29 12:50:36 +01:00
parent 6e848cf239
commit ed1815eddc
6 changed files with 30 additions and 1 deletions

View File

@@ -202,6 +202,9 @@ bool init(void *userData) {
ECS_COMPONENT_DEFINE(ECS, SoundState);
ecs_singleton_set(ECS, SoundState, {});
SoundState *sounds = ecs_singleton_get_mut(ECS, SoundState);
sounds->masterVolume = 0.5f;
sounds->musicVolume = 0.5f;
sounds->soundVolume = 0.5f;
soundsLoad(sounds, SOUND_WOOD_PUNCH, 0.1f, "assets/sounds/wood hit 17.wav");
}
setScreen(game, SCREEN_MAIN_MENU);
@@ -392,6 +395,8 @@ void update(float dt, void *userData) {
} else {
game->options = getDefaultOptions();
}
SoundState *sounds = ecs_singleton_get_mut(ECS, SoundState);
soundsApplyVolume(sounds, opts.master, opts.music, opts.sound);
optsLoaded = true;
}