mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 12:59:02 -06:00
Two quick changes (read comments)
Added mouse wheel support to the mode select menu BGM now interatcs with pausing correctly
This commit is contained in:
parent
b2d0838f90
commit
7fa547c307
14
load/bgm.lua
14
load/bgm.lua
@ -7,6 +7,7 @@ bgm = {
|
|||||||
|
|
||||||
local current_bgm = nil
|
local current_bgm = nil
|
||||||
local bgm_locked = false
|
local bgm_locked = false
|
||||||
|
local unfocused = false
|
||||||
|
|
||||||
function switchBGM(sound, subsound)
|
function switchBGM(sound, subsound)
|
||||||
if current_bgm ~= nil then
|
if current_bgm ~= nil then
|
||||||
@ -56,7 +57,7 @@ end
|
|||||||
function resetBGMFadeout(time)
|
function resetBGMFadeout(time)
|
||||||
current_bgm:setVolume(config.bgm_volume)
|
current_bgm:setVolume(config.bgm_volume)
|
||||||
fading_bgm = false
|
fading_bgm = false
|
||||||
current_bgm:play()
|
resumeBGM()
|
||||||
end
|
end
|
||||||
|
|
||||||
function processBGMFadeout(dt)
|
function processBGMFadeout(dt)
|
||||||
@ -70,13 +71,20 @@ function processBGMFadeout(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function pauseBGM()
|
function pauseBGM(f)
|
||||||
|
if f then
|
||||||
|
unfocused = true
|
||||||
|
end
|
||||||
if current_bgm ~= nil then
|
if current_bgm ~= nil then
|
||||||
current_bgm:pause()
|
current_bgm:pause()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function resumeBGM()
|
function resumeBGM(f)
|
||||||
|
if f and scene.paused and unfocused then
|
||||||
|
unfocused = false
|
||||||
|
return
|
||||||
|
end
|
||||||
if current_bgm ~= nil then
|
if current_bgm ~= nil then
|
||||||
current_bgm:play()
|
current_bgm:play()
|
||||||
end
|
end
|
||||||
|
10
main.lua
10
main.lua
@ -259,11 +259,15 @@ function love.joystickhat(joystick, hat, direction)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function love.wheelmoved(x, y)
|
||||||
|
scene:onInputPress({input=nil, type="wheel", x=x, y=y})
|
||||||
|
end
|
||||||
|
|
||||||
function love.focus(f)
|
function love.focus(f)
|
||||||
if f and (scene.title ~= "Game" or not scene.paused) then
|
if f then
|
||||||
resumeBGM()
|
resumeBGM(true)
|
||||||
else
|
else
|
||||||
pauseBGM()
|
pauseBGM(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user