mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-25 14:19:03 -06:00
SFX and BGM are now separate sliders
This commit is contained in:
parent
f4675da0b0
commit
548612123a
@ -47,7 +47,7 @@ function fadeoutBGM(time)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function resetBGMFadeout(time)
|
function resetBGMFadeout(time)
|
||||||
current_bgm:setVolume(config.sfx_volume)
|
current_bgm:setVolume(config.bgm_volume)
|
||||||
fading_bgm = false
|
fading_bgm = false
|
||||||
current_bgm:play()
|
current_bgm:play()
|
||||||
end
|
end
|
||||||
@ -59,7 +59,7 @@ function processBGMFadeout(dt)
|
|||||||
fadeout_time = 0
|
fadeout_time = 0
|
||||||
fading_bgm = false
|
fading_bgm = false
|
||||||
end
|
end
|
||||||
current_bgm:setVolume(fadeout_time * config.sfx_volume / total_fadeout_time)
|
current_bgm:setVolume(fadeout_time * config.bgm_volume / total_fadeout_time)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
1
main.lua
1
main.lua
@ -18,6 +18,7 @@ function love.load()
|
|||||||
if not config.das then config.das = 10 end
|
if not config.das then config.das = 10 end
|
||||||
if not config.arr then config.arr = 2 end
|
if not config.arr then config.arr = 2 end
|
||||||
if not config.sfx_volume then config.sfx_volume = 0.5 end
|
if not config.sfx_volume then config.sfx_volume = 0.5 end
|
||||||
|
if not config.bgm_volume then config.bgm_volume = 0.5 end
|
||||||
|
|
||||||
if config.secret == nil then config.secret = false
|
if config.secret == nil then config.secret = false
|
||||||
elseif config.secret == true then playSE("welcome") end
|
elseif config.secret == true then playSE("welcome") end
|
||||||
|
@ -28,12 +28,14 @@ function ConfigScene:new()
|
|||||||
state = "Changing game settings",
|
state = "Changing game settings",
|
||||||
})
|
})
|
||||||
|
|
||||||
self.sfxSlider = newSlider(290, 375, 400, config.sfx_volume * 100, 0, 100, function(v) config.sfx_volume = v / 100 end, {width=20})
|
self.sfxSlider = newSlider(165, 375, 225, config.sfx_volume * 100, 0, 100, function(v) config.sfx_volume = v / 100 end, {width=20})
|
||||||
|
self.bgmSlider = newSlider(465, 375, 225, config.bgm_volume * 100, 0, 100, function(v) config.bgm_volume = v / 100 end, {width=20})
|
||||||
end
|
end
|
||||||
|
|
||||||
function ConfigScene:update()
|
function ConfigScene:update()
|
||||||
config["das_last_key"] = config.gamesettings.das_last_key == 2
|
config["das_last_key"] = config.gamesettings.das_last_key == 2
|
||||||
self.sfxSlider:update()
|
self.sfxSlider:update()
|
||||||
|
self.bgmSlider:update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ConfigScene:render()
|
function ConfigScene:render()
|
||||||
@ -45,7 +47,8 @@ function ConfigScene:render()
|
|||||||
)
|
)
|
||||||
|
|
||||||
love.graphics.setFont(font_3x5_3)
|
love.graphics.setFont(font_3x5_3)
|
||||||
love.graphics.print("Master Volume: " .. math.floor(self.sfxSlider:getValue()) .. "%", 80, 325)
|
love.graphics.print("SFX Volume: " .. math.floor(self.sfxSlider:getValue()) .. "%", 70, 325)
|
||||||
|
love.graphics.print("BGM Volume: " .. math.floor(self.bgmSlider:getValue()) .. "%", 370, 325)
|
||||||
|
|
||||||
love.graphics.setFont(font_3x5_4)
|
love.graphics.setFont(font_3x5_4)
|
||||||
love.graphics.print("GAME SETTINGS", 80, 40)
|
love.graphics.print("GAME SETTINGS", 80, 40)
|
||||||
@ -65,6 +68,7 @@ function ConfigScene:render()
|
|||||||
|
|
||||||
love.graphics.setColor(1, 1, 1, 0.75)
|
love.graphics.setColor(1, 1, 1, 0.75)
|
||||||
self.sfxSlider:draw()
|
self.sfxSlider:draw()
|
||||||
|
self.bgmSlider:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ConfigScene:onInputPress(e)
|
function ConfigScene:onInputPress(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user