textBox控件名让给真·文本框,输入框控件改名inputBox,更新历史界面使用文本框控件
This commit is contained in:
@@ -1,49 +1,35 @@
|
||||
local gc=love.graphics
|
||||
local max,min=math.max,math.min
|
||||
|
||||
local scene={}
|
||||
|
||||
local texts--Text list
|
||||
local scrollPos--Scroll down length
|
||||
local inited
|
||||
|
||||
function scene.sceneInit()
|
||||
BG.set("cubes")
|
||||
texts=require"parts/updateLog"
|
||||
scrollPos=1
|
||||
if not inited then
|
||||
inited=true
|
||||
WIDGET.active.texts:setTexts(require"parts/updateLog")
|
||||
end
|
||||
if newVersionLaunch then
|
||||
newVersionLaunch=false
|
||||
scrollPos=3
|
||||
end
|
||||
end
|
||||
|
||||
function scene.wheelMoved(_,y)
|
||||
wheelScroll(y)
|
||||
end
|
||||
function scene.keyDown(key)
|
||||
if key=="up"then
|
||||
scrollPos=max(scrollPos-6,1)
|
||||
elseif key=="down"then
|
||||
scrollPos=min(scrollPos+6,#texts-22)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
end
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.setColor(.2,.2,.2,.7)
|
||||
gc.rectangle("fill",30,45,1000,632)
|
||||
gc.setColor(1,1,1)
|
||||
gc.setLineWidth(4)
|
||||
gc.rectangle("line",30,45,1000,632)
|
||||
setFont(20)
|
||||
for i=0,22 do
|
||||
gc.print(texts[scrollPos+i],40,50+27*i)
|
||||
function scene.keyDown(k)
|
||||
if k=="up"then
|
||||
WIDGET.active.texts:scroll(-5)
|
||||
elseif k=="down"then
|
||||
WIDGET.active.texts:scroll(5)
|
||||
elseif k=="pgup"then
|
||||
WIDGET.active.texts:scroll(-20)
|
||||
elseif k=="pgdown"then
|
||||
WIDGET.active.texts:scroll(20)
|
||||
end
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
WIDGET.newKey{name="prev", x=1155, y=170,w=180,fText="↑",font=65,code=pressKey"up",hide=function()return scrollPos==1 end},
|
||||
WIDGET.newKey{name="next", x=1155, y=400,w=180,fText="↓",font=65,code=pressKey"down",hide=function()return scrollPos==#texts end},
|
||||
WIDGET.newTextBox{name="texts", x=30,y=45,w=1000,h=640,font=20,fix=true},
|
||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=backScene},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user