多媒体库再完善,未初始化时调用不会报错了

This commit is contained in:
MrZ626
2020-12-10 13:18:43 +08:00
parent 5c073257b7
commit 8e1c53b1e7
5 changed files with 27 additions and 8 deletions

View File

@@ -8,11 +8,13 @@ function IMG.init(list)
end
function IMG.getCount()return count end
IMG.loadOne=coroutine.wrap(function()
IMG.loadOne=coroutine.wrap(function(skip)
IMG.loadAll=nil
for k,v in next,list do
IMG[k]=love.graphics.newImage("media/image/"..v)
coroutine.yield()
if not skip and i~=count then
coroutine.yield()
end
end
IMG.loadOne=nil
end)