几个多媒体模块支持重载资源

This commit is contained in:
MrZ626
2020-12-10 14:53:27 +08:00
parent aa3826ed8d
commit ddbe1d9c97
4 changed files with 46 additions and 60 deletions

View File

@@ -4,6 +4,7 @@ local SFX={
play=NULL,
fplay=NULL,
reset=NULL,
reload=NULL,
}
function SFX.init(list)
SFX.init=nil
@@ -11,10 +12,7 @@ function SFX.init(list)
local Sources={}
local count=#list function SFX.getCount()return count end
SFX.loadOne=coroutine.wrap(function(skip)
SFX.loadAll=nil
local function load(skip)
for i=1,count do
local N="media/SFX/"..list[i]..".ogg"
if love.filesystem.getInfo(N)then
@@ -91,9 +89,9 @@ function SFX.init(list)
end
end
end
end)
function SFX.loadAll()
SFX.loadOne(true)
end
SFX.loadOne=coroutine.wrap(load)
function SFX.loadAll()load(true)end
end
return SFX