cmd新增stopbgm命令,rst命令有输出了

This commit is contained in:
MrZ626
2021-03-10 12:49:32 +08:00
parent f45331d019
commit 3ca0f6f9af

View File

@@ -1,6 +1,6 @@
local gc=love.graphics local gc=love.graphics
local int=math.floor local int=math.floor
local ins=table.insert local ins,rem=table.insert,table.remove
local inputBox=WIDGET.newInputBox{name="input",x=40,y=650,w=1200,h=50} local inputBox=WIDGET.newInputBox{name="input",x=40,y=650,w=1200,h=50}
local outputBox=WIDGET.newTextBox{name="output",x=40,y=30,w=1200,h=600,font=25,lineH=25,fix=true} local outputBox=WIDGET.newTextBox{name="output",x=40,y=30,w=1200,h=600,font=25,lineH=25,fix=true}
@@ -163,6 +163,14 @@ do--commands.help(arg)
"Usage: playbgm [bgmName]" "Usage: playbgm [bgmName]"
}, },
}, },
stopbgm={
description="Stop the BGM.",
details={
"Stop the BGM.",
"",
"Usage: stopbgm"
},
},
theme={ theme={
description="Load a theme.", description="Load a theme.",
details={ details={
@@ -190,6 +198,7 @@ do--commands.help(arg)
"unlockall", "unlockall",
"play", "play",
"playbgm", "playbgm",
"stopbgm",
"theme", "theme",
} }
local pageSize=10 local pageSize=10
@@ -223,7 +232,10 @@ do--commands.help(arg)
end end
function commands.shutdown(arg)os.execute("shutdown "..arg)end function commands.shutdown(arg)os.execute("shutdown "..arg)end
function commands.cls()outputBox:clear()end function commands.cls()outputBox:clear()end
function commands.rst()history,hisPtr={}end function commands.rst()
history,hisPtr={}
log"History cleared"
end
function commands.echo(str) function commands.echo(str)
if str~=""then if str~=""then
outputBox:push(str) outputBox:push(str)
@@ -323,6 +335,9 @@ function commands.playbgm(bgm)
log{COLOR.water,"Usage: playbgm [bgmName]"} log{COLOR.water,"Usage: playbgm [bgmName]"}
end end
end end
function commands.stopbgm()
BGM.stop()
end
function commands.theme(name) function commands.theme(name)
if name=="classic"then if name=="classic"then
THEME=false THEME=false
@@ -422,6 +437,7 @@ function scene.keyDown(k)
--Write History --Write History
ins(history,input) ins(history,input)
if history[27]then rem(history,1)end
hisPtr=nil hisPtr=nil
--Insert empty line --Insert empty line