mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-21 15:29:03 -06:00
Style fixes for last pull request
This commit is contained in:
parent
23d9feb357
commit
1556b247fe
@ -1,4 +1,7 @@
|
||||
named_backgrounds = {"title", "title_no_icon", "title_night", "snow", "options_input", "options_game"}
|
||||
named_backgrounds = {
|
||||
"title", "title_no_icon", "title_night",
|
||||
"snow", "options_input", "options_game"
|
||||
}
|
||||
current_playing_bgs = {}
|
||||
extended_bgs = {}
|
||||
image_formats = {".png", ".jpg"}
|
||||
@ -7,7 +10,7 @@ dir = love.filesystem.getDirectoryItems(bgpath)
|
||||
|
||||
local backgrounds = {}
|
||||
|
||||
function loadExtendedBgs()
|
||||
local function loadExtendedBgs()
|
||||
extended_bgs = require("res.backgrounds.extend_section_bg")
|
||||
end
|
||||
|
||||
@ -15,11 +18,11 @@ end
|
||||
if pcall(loadExtendedBgs) then end
|
||||
|
||||
-- helper method to populate backgrounds
|
||||
function createBackgroundIfExists(name, file_name)
|
||||
local function createBackgroundIfExists(name, file_name)
|
||||
local format_index = 1
|
||||
|
||||
-- see if background is an extension of another background
|
||||
if extended_bgs[file_name] ~= null then
|
||||
if extended_bgs[file_name] ~= nil then
|
||||
copy_bg = extended_bgs[file_name]
|
||||
copy_bg = copy_bg / 100
|
||||
backgrounds[name] = backgrounds[copy_bg]
|
||||
@ -43,8 +46,11 @@ function createBackgroundIfExists(name, file_name)
|
||||
for num, existing_file in pairs(dir) do
|
||||
if existing_file == (file_name..".ogv") then
|
||||
local tempBgPath = bgpath .. file_name .. ".ogv"
|
||||
backgrounds[name] = love.graphics.newVideo(tempBgPath, {["audio"] = false})
|
||||
-- you can set audio to true, but the video will not loop properly if audio extends beyond video frames
|
||||
backgrounds[name] = love.graphics.newVideo(
|
||||
tempBgPath, {["audio"] = false}
|
||||
)
|
||||
-- you can set audio to true, but the video will not loop
|
||||
-- properly if audio extends beyond video frames
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -52,7 +58,7 @@ function createBackgroundIfExists(name, file_name)
|
||||
return false
|
||||
end
|
||||
|
||||
function StopOtherBgs(bg)
|
||||
local function stopOtherBgs(bg)
|
||||
if #current_playing_bgs == 0 and bg:typeOf("Video") then
|
||||
current_playing_bgs[#current_playing_bgs+1] = bg
|
||||
end
|
||||
@ -75,7 +81,7 @@ function fetchBackgroundAndLoop(id)
|
||||
bg:play()
|
||||
end
|
||||
|
||||
StopOtherBgs(bg)
|
||||
stopOtherBgs(bg)
|
||||
|
||||
return bg
|
||||
end
|
||||
@ -89,7 +95,10 @@ end
|
||||
-- create named backgrounds
|
||||
local nbgIndex = 1
|
||||
while nbgIndex <= #named_backgrounds do
|
||||
createBackgroundIfExists(named_backgrounds[nbgIndex], string.gsub(named_backgrounds[nbgIndex], "_", "-"))
|
||||
createBackgroundIfExists(
|
||||
named_backgrounds[nbgIndex],
|
||||
string.gsub(named_backgrounds[nbgIndex], "_", "-")
|
||||
)
|
||||
nbgIndex = nbgIndex + 1
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user