自定义游戏的背景列表改为自动读取
This commit is contained in:
@@ -1,23 +1,28 @@
|
|||||||
local BGlist={
|
local BGs={
|
||||||
none={
|
none={
|
||||||
draw=function()
|
draw=function()
|
||||||
love.graphics.clear(.15,.15,.15)
|
love.graphics.clear(.15,.15,.15)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
local BGlist={"none"}
|
||||||
local BG={
|
local BG={
|
||||||
cur="none",
|
cur="none",
|
||||||
default="none",
|
default="none",
|
||||||
init=false,
|
init=false,
|
||||||
resize=false,
|
resize=false,
|
||||||
update=NULL,
|
update=NULL,
|
||||||
draw=BGlist.none.draw,
|
draw=BGs.none.draw,
|
||||||
event=false,
|
event=false,
|
||||||
discard=NULL,
|
discard=NULL,
|
||||||
}
|
}
|
||||||
|
|
||||||
function BG.add(name,bg)
|
function BG.add(name,bg)
|
||||||
BGlist[name]=bg
|
BGs[name]=bg
|
||||||
|
BGlist[#BGlist+1]=name
|
||||||
|
end
|
||||||
|
function BG.getList()
|
||||||
|
return BGlist
|
||||||
end
|
end
|
||||||
function BG.send(...)
|
function BG.send(...)
|
||||||
if BG.event then
|
if BG.event then
|
||||||
@@ -34,7 +39,7 @@ function BG.set(background)
|
|||||||
if background==BG.cur or not SETTING.bg then return end
|
if background==BG.cur or not SETTING.bg then return end
|
||||||
BG.discard()
|
BG.discard()
|
||||||
BG.cur=background
|
BG.cur=background
|
||||||
background=BGlist[background]
|
background=BGs[background]
|
||||||
if not background then
|
if not background then
|
||||||
LOG.print("No BG called"..background,"warn")
|
LOG.print("No BG called"..background,"warn")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -153,12 +153,7 @@ scene.widgetList={
|
|||||||
WIDGET.newSelector{name="fall", x=410, y=230,w=220,color="yellow", list={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, disp=WIDGET.lnk_CUSval("fall"),code=WIDGET.lnk_CUSsto("fall")},
|
WIDGET.newSelector{name="fall", x=410, y=230,w=220,color="yellow", list={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, disp=WIDGET.lnk_CUSval("fall"),code=WIDGET.lnk_CUSsto("fall")},
|
||||||
|
|
||||||
--Else
|
--Else
|
||||||
WIDGET.newSelector{name="bg",
|
WIDGET.newSelector{name="bg", x=1070, y=150,w=250,color="yellow",list=BG.getList(),disp=WIDGET.lnk_CUSval("bg"), code=function(i)CUSTOMENV.bg=i BG.set(i)end},
|
||||||
x=1070, y=150,w=250,color="yellow",
|
|
||||||
list={"none","grey","glow","rgb","flink","wing","fan","badapple","welcome","aura","bg1","bg2","rainbow","rainbow2","tunnel","lightning","lightning2","matrix","space","snow"},
|
|
||||||
disp=WIDGET.lnk_CUSval("bg"),
|
|
||||||
code=function(i)CUSTOMENV.bg=i BG.set(i)end
|
|
||||||
},
|
|
||||||
WIDGET.newSelector{name="bgm", x=1070, y=230,w=250,color="yellow", list=BGM.getList(), disp=WIDGET.lnk_CUSval("bgm"), code=function(i)CUSTOMENV.bgm=i BGM.play(i)end},
|
WIDGET.newSelector{name="bgm", x=1070, y=230,w=250,color="yellow", list=BGM.getList(), disp=WIDGET.lnk_CUSval("bgm"), code=function(i)CUSTOMENV.bgm=i BGM.play(i)end},
|
||||||
|
|
||||||
--Copy/Paste/Start
|
--Copy/Paste/Start
|
||||||
|
|||||||
Reference in New Issue
Block a user