Merge branch 'master' into add-video-background-support

This commit is contained in:
aur9ra 2023-07-14 23:23:49 -07:00
commit 602e7105ab
4 changed files with 19 additions and 23 deletions

View File

@ -7,13 +7,15 @@ 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 bgm_locked then
return
end
if current_bgm ~= nil then if current_bgm ~= nil then
current_bgm:stop() current_bgm:stop()
end end
if bgm_locked or config.bgm_volume <= 0 then if config.bgm_volume <= 0 then
current_bgm = nil current_bgm = nil
elseif sound ~= nil then elseif sound ~= nil then
if subsound ~= nil then if subsound ~= nil then
@ -67,24 +69,19 @@ function processBGMFadeout(dt)
fadeout_time = 0 fadeout_time = 0
fading_bgm = false fading_bgm = false
end end
current_bgm:setVolume(fadeout_time * config.bgm_volume / total_fadeout_time) current_bgm:setVolume(
fadeout_time * config.bgm_volume / total_fadeout_time
)
end end
end end
function pauseBGM(f) function pauseBGM()
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(f) function resumeBGM()
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

View File

@ -280,14 +280,6 @@ function love.wheelmoved(x, y)
scene:onInputPress({input=nil, type="wheel", x=x, y=y}) scene:onInputPress({input=nil, type="wheel", x=x, y=y})
end end
function love.focus(f)
if f then
resumeBGM(true)
else
pauseBGM(true)
end
end
function love.resize(w, h) function love.resize(w, h)
GLOBAL_CANVAS:release() GLOBAL_CANVAS:release()
GLOBAL_CANVAS = love.graphics.newCanvas(w, h) GLOBAL_CANVAS = love.graphics.newCanvas(w, h)

View File

@ -16,9 +16,7 @@ function CreditsScene:new()
end end
function CreditsScene:update() function CreditsScene:update()
if love.window.hasFocus() then
self.frames = self.frames + 1 self.frames = self.frames + 1
end
if self.frames >= 2100 * self.scroll_speed then if self.frames >= 2100 * self.scroll_speed then
playSE("mode_decide") playSE("mode_decide")
scene = TitleScene() scene = TitleScene()

View File

@ -37,6 +37,7 @@ function ReplayScene:new(replay, game_mode, ruleset)
self.replay = deepcopy(replay) self.replay = deepcopy(replay)
self.replay_index = 1 self.replay_index = 1
self.replay_speed = 1 self.replay_speed = 1
self.show_invisible = false
DiscordRPC:update({ DiscordRPC:update({
details = "Viewing a replay", details = "Viewing a replay",
state = self.game.name, state = self.game.name,
@ -92,6 +93,12 @@ function ReplayScene:render()
else else
love.graphics.printf("?? PAUSES (--:--.--)", 0, pauses_y_coordinate, 635, "right") love.graphics.printf("?? PAUSES (--:--.--)", 0, pauses_y_coordinate, 635, "right")
end end
if self.show_invisible then
self.game.grid:draw()
love.graphics.setColor(1, 1, 1, 1)
love.graphics.setFont(font_3x5_3)
love.graphics.printf("SHOW INVIS", 64, 60, 160, "center")
end
end end
function ReplayScene:onInputPress(e) function ReplayScene:onInputPress(e)
@ -124,6 +131,8 @@ function ReplayScene:onInputPress(e)
if self.replay_speed > 99 then if self.replay_speed > 99 then
self.replay_speed = 99 self.replay_speed = 99
end end
elseif e.input == "hold" then
self.show_invisible = not self.show_invisible
end end
end end