Skip to content

Commit 46b2a99

Browse files
committed
[settings] Added Master Volume trackbar
1 parent 31fe5b2 commit 46b2a99

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

LuaMenu/widgets/gui_settings_window.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ end
1818
--------------------------------------------------------------------------------
1919
-- Local Variables
2020
local spSetConfigInt = Spring.SetConfigInt
21+
local spGetConfigInt = Spring.GetConfigInt
2122

2223
local battleStartDisplay = 1
2324
local lobbyFullscreen = 1
@@ -39,6 +40,7 @@ local TEXT_OFFSET = 6
3940
local settingsWindowHandler
4041

4142
local trackbarLobbyMusicVolume
43+
local trackbarMasterVolume
4244

4345
--------------------------------------------------------------------------------
4446
--------------------------------------------------------------------------------
@@ -730,6 +732,25 @@ local function GetLobbyTabControls()
730732
}
731733
offset = offset + ITEM_OFFSET
732734

735+
trackbarMasterVolume = Trackbar:New {
736+
x = COMBO_X,
737+
y = offset,
738+
width = COMBO_WIDTH,
739+
height = 30,
740+
value = spGetConfigInt("snd_volmaster", 50),
741+
OnChange = {
742+
function(obj, value)
743+
if freezeSettings then
744+
return
745+
end
746+
spSetConfigInt("snd_volmaster", value)
747+
end
748+
}
749+
}
750+
children[#children + 1] = AddLabel(offset, "Master Volume")
751+
children[#children + 1] = trackbarMasterVolume
752+
offset = offset + ITEM_OFFSET
753+
733754
trackbarLobbyMusicVolume = Trackbar:New {
734755
x = COMBO_X,
735756
y = offset,
@@ -1756,6 +1777,7 @@ function widget:Update()
17561777
return
17571778
end
17581779

1780+
trackbarMasterVolume.value = spGetConfigInt("snd_volmaster", trackbarMasterVolume.value)
17591781
trackbarLobbyMusicVolume.value = WG.Chobby.Configuration.menuMusicVolume
17601782
end
17611783

0 commit comments

Comments
 (0)