IMG模块支持加载图片组

This commit is contained in:
MrZ626
2021-03-03 16:38:53 +08:00
parent b94eed6df8
commit 7587d8cafd

View File

@@ -12,13 +12,21 @@ function IMG.init(list)
local function load(skip)
local loaded=0
for k,v in next,list do
IMG[k]=love.graphics.newImage("media/image/"..v)
if type(v)=="string"then
IMG[k]=love.graphics.newImage("media/image/"..v)
else
for i=1,#v do
v[i]=love.graphics.newImage("media/image/"..v[i])
end
IMG[k]=v
end
loaded=loaded+1
if not skip and loaded~=count then
coroutine.yield()
end
end
IMG.loadOne=nil
IMG.loadAll=nil
end
IMG.loadOne=coroutine.wrap(load)