框架keyDown事件机制微调,重构框架主循环和控件相关代码

可以用键盘和手柄控制光标(手柄不完善)
整理代码和部分语言文件细节
This commit is contained in:
MrZ626
2021-11-27 23:16:21 +08:00
parent f6b4c1b109
commit b6c37a5c9f
21 changed files with 246 additions and 339 deletions

View File

@@ -4,7 +4,7 @@ local ins,rem=table.insert,table.remove
local C=COLOR
local inputBox=WIDGET.newInputBox{name='input',x=40,y=650,w=1200,h=50,fType='mono'}
local outputBox=WIDGET.newTextBox{name='output',x=40,y=30,w=1200,h=610,font=25,fType='mono',lineH=25,fix=true}
local outputBox=WIDGET.newTextBox{name='output',x=40,y=30,w=1200,h=610,font=25,fType='mono',lineH=23,fix=true}
local function log(str)outputBox:push(str)end
log{C.lP,"Techmino Console"}
@@ -1088,8 +1088,8 @@ function scene.keyDown(key)
end
elseif key=='scrollup'then outputBox:scroll(-5)
elseif key=='scrolldown'then outputBox:scroll(5)
elseif key=='pageup'then outputBox:scroll(-20)
elseif key=='pagedown'then outputBox:scroll(20)
elseif key=='pageup'then outputBox:scroll(-25)
elseif key=='pagedown'then outputBox:scroll(25)
elseif key=='home'then outputBox:scroll(-1e99)
elseif key=='end'then outputBox:scroll(1e99)
elseif combKey[key]and kb.isDown('lctrl','rctrl')then combKey[key]()
@@ -1103,7 +1103,7 @@ function scene.keyDown(key)
if not WIDGET.isFocus(inputBox)then
WIDGET.focus(inputBox)
end
WIDGET.keyPressed(key)
return true
end
end