多媒体库再完善,未初始化时调用不会报错了
This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
local BGM={
|
local BGM={
|
||||||
|
getList={},
|
||||||
|
getCount=function()return 0 end,
|
||||||
|
play=NULL,
|
||||||
|
freshVolume=NULL,
|
||||||
|
stop=NULL,
|
||||||
--nowPlay=[str:playing ID]
|
--nowPlay=[str:playing ID]
|
||||||
--playing=[src:playing SRC]
|
--playing=[src:playing SRC]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,14 @@ function IMG.init(list)
|
|||||||
end
|
end
|
||||||
function IMG.getCount()return count end
|
function IMG.getCount()return count end
|
||||||
|
|
||||||
IMG.loadOne=coroutine.wrap(function()
|
IMG.loadOne=coroutine.wrap(function(skip)
|
||||||
IMG.loadAll=nil
|
IMG.loadAll=nil
|
||||||
for k,v in next,list do
|
for k,v in next,list do
|
||||||
IMG[k]=love.graphics.newImage("media/image/"..v)
|
IMG[k]=love.graphics.newImage("media/image/"..v)
|
||||||
|
if not skip and i~=count then
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
IMG.loadOne=nil
|
IMG.loadOne=nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ function love.run()
|
|||||||
gc.print("Memory:"..gcinfo(),SCR.safeX+5,_-40)
|
gc.print("Memory:"..gcinfo(),SCR.safeX+5,_-40)
|
||||||
gc.print("Lines:"..FREEROW.getCount(),SCR.safeX+5,_-60)
|
gc.print("Lines:"..FREEROW.getCount(),SCR.safeX+5,_-60)
|
||||||
gc.print("Cursor:"..int(mx+.5).." "..int(my+.5),SCR.safeX+5,_-80)
|
gc.print("Cursor:"..int(mx+.5).." "..int(my+.5),SCR.safeX+5,_-80)
|
||||||
gc.print("Voices:"..VOC.getCount(),SCR.safeX+5,_-100)
|
gc.print("Voices:"..VOC.getQueueCount(),SCR.safeX+5,_-100)
|
||||||
gc.print("Tasks:"..TASK.getCount(),SCR.safeX+5,_-120)
|
gc.print("Tasks:"..TASK.getCount(),SCR.safeX+5,_-120)
|
||||||
ins(frameTimeList,1,dt)rem(frameTimeList,126)
|
ins(frameTimeList,1,dt)rem(frameTimeList,126)
|
||||||
gc.setColor(1,1,1,.3)
|
gc.setColor(1,1,1,.3)
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
local SFX={}
|
local SFX={
|
||||||
|
getCount=function()return 0 end,
|
||||||
|
fieldPlay=NULL,
|
||||||
|
play=NULL,
|
||||||
|
fplay=NULL,
|
||||||
|
reset=NULL,
|
||||||
|
}
|
||||||
function SFX.init(list)
|
function SFX.init(list)
|
||||||
SFX.init=nil
|
SFX.init=nil
|
||||||
local rem=table.remove
|
local rem=table.remove
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
local VOC={}
|
local VOC={
|
||||||
|
getCount=function()return 0 end,
|
||||||
|
getQueueCount=NULL,
|
||||||
|
getFreeChannel=NULL,
|
||||||
|
play=NULL,
|
||||||
|
update=NULL,
|
||||||
|
}
|
||||||
|
|
||||||
function VOC.init(list)
|
function VOC.init(list)
|
||||||
VOC.init=nil
|
VOC.init=nil
|
||||||
@@ -52,6 +58,9 @@ function VOC.init(list)
|
|||||||
end
|
end
|
||||||
VOC.loadOne=nil
|
VOC.loadOne=nil
|
||||||
|
|
||||||
|
function VOC.getQueueCount()
|
||||||
|
return #voiceQueue
|
||||||
|
end
|
||||||
function VOC.getFreeChannel()
|
function VOC.getFreeChannel()
|
||||||
local l=#voiceQueue
|
local l=#voiceQueue
|
||||||
for i=1,l do
|
for i=1,l do
|
||||||
@@ -60,9 +69,6 @@ function VOC.init(list)
|
|||||||
voiceQueue[l+1]={s=0}
|
voiceQueue[l+1]={s=0}
|
||||||
return l+1
|
return l+1
|
||||||
end
|
end
|
||||||
function VOC.getCount()
|
|
||||||
return #voiceQueue
|
|
||||||
end
|
|
||||||
|
|
||||||
function VOC.play(s,chn)
|
function VOC.play(s,chn)
|
||||||
if SETTING.voc>0 then
|
if SETTING.voc>0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user