移除无效的debug功能键,整理代码

This commit is contained in:
MrZ626
2021-06-25 20:53:41 +08:00
parent c8480a17e9
commit 535e78a8b3
3 changed files with 12 additions and 5 deletions

View File

@@ -211,6 +211,8 @@ local function noDevkeyPressed(key)
elseif key=="f2"then
MES.new('info',("System:%s[%s]\nluaVer:%s\njitVer:%s\njitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num))
elseif key=="f3"then
MES.new('error',"挂了")
elseif key=="f4"then
for _=1,8 do
local P=PLY_ALIVE[rnd(#PLY_ALIVE)]
if P~=PLAYERS[1]then
@@ -218,10 +220,8 @@ local function noDevkeyPressed(key)
P:lose()
end
end
elseif key=="f4"and not kb.isDown("lalt","ralt")then
MES.new.copy()
elseif key=="f5"then
print(WIDGET.isFocus()or"no widget selected")
print(WIDGET.getSel()or"no widget selected")
elseif key=="f6"then
for k,v in next,_G do print(k,v)end
elseif key=="f7"and love._openConsole then

View File

@@ -1243,8 +1243,15 @@ function WIDGET.setLang(widgetText)
end
end
end
function WIDGET.getSelected()
return WIDGET.sel
end
function WIDGET.isFocus(W)
return W==nil and WIDGET.sel or WIDGET.sel==W
if W then
return W and WIDGET.sel==W
else
return WIDGET.sel~=false
end
end
function WIDGET.focus(W)
if WIDGET.sel==W then return end

View File

@@ -76,7 +76,7 @@ function scene.touchUp()
end
end
function scene.touchMove(_,_,dx,dy)
if selected and WIDGET.isFocus(false)then
if selected and not WIDGET.isFocus()then
local B=VK_org[selected]
B.x,B.y=B.x+dx,B.y+dy
end