整理代码,微调ui
This commit is contained in:
@@ -743,16 +743,16 @@ function textBox:press()
|
||||
kb.setTextInput(true,0,y1,1,1)
|
||||
end
|
||||
end
|
||||
function textBox:keypress(key)
|
||||
function textBox:keypress(k)
|
||||
local t=self.value
|
||||
if #t==0 then return end
|
||||
if key=="backspace"then
|
||||
if k=="backspace"then
|
||||
while t:byte(#t)>=128 and t:byte(#t)<192 do
|
||||
t=sub(t,1,-2)
|
||||
end
|
||||
t=sub(t,1,-2)
|
||||
SFX.play("lock")
|
||||
elseif key=="delete"then
|
||||
elseif k=="delete"then
|
||||
t=""
|
||||
SFX.play("hold")
|
||||
end
|
||||
@@ -879,16 +879,16 @@ function WIDGET.release(x,y)
|
||||
W:release(x,y)
|
||||
end
|
||||
end
|
||||
function WIDGET.keyPressed(key)
|
||||
if key=="space"or key=="return"then
|
||||
function WIDGET.keyPressed(k)
|
||||
if k=="space"or k=="return"then
|
||||
WIDGET.press()
|
||||
elseif kb.isDown("lshift","lalt","lctrl")and(key=="left"or key=="right")then
|
||||
elseif kb.isDown("lshift","lalt","lctrl")and(k=="left"or k=="right")then
|
||||
--When hold [↑], control slider with left/right
|
||||
local W=WIDGET.sel
|
||||
if W and W.type=="slider"or W.type=="selector"then
|
||||
W:arrowKey(key=="left")
|
||||
W:arrowKey(k=="left")
|
||||
end
|
||||
elseif key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
elseif k=="up"or k=="down"or k=="left"or k=="right"then
|
||||
if not WIDGET.sel then
|
||||
for _,v in next,WIDGET.active do
|
||||
if v.isAbove then
|
||||
@@ -901,10 +901,10 @@ function WIDGET.keyPressed(key)
|
||||
local W=WIDGET.sel
|
||||
if not W.getCenter then return end
|
||||
local WX,WY=W:getCenter()
|
||||
local dir=(key=="right"or key=="down")and 1 or -1
|
||||
local dir=(k=="right"or k=="down")and 1 or -1
|
||||
local tar
|
||||
local minDist=1e99
|
||||
local swap_xy=key=="up"or key=="down"
|
||||
local swap_xy=k=="up"or k=="down"
|
||||
if swap_xy then WX,WY=WY,WX end -- note that we do not swap them back later
|
||||
for _,W1 in ipairs(WIDGET.active)do
|
||||
if W~=W1 and W1.resCtr then
|
||||
@@ -929,7 +929,7 @@ function WIDGET.keyPressed(key)
|
||||
else
|
||||
local W=WIDGET.sel
|
||||
if W and W.type=="textBox"then
|
||||
W:keypress(key)
|
||||
W:keypress(k)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,11 +9,8 @@ local sin=math.sin
|
||||
|
||||
local mapCam={
|
||||
sel=nil,--Selected mode ID
|
||||
|
||||
xOy=mt.newTransform(0,0,0,1),
|
||||
|
||||
--If controlling with key
|
||||
keyCtrl=false,
|
||||
xOy=mt.newTransform(0,0,0,1),--Transformation for map display
|
||||
keyCtrl=false,--If controlling with key
|
||||
|
||||
--For auto zooming when enter/leave scene
|
||||
zoomMethod=nil,
|
||||
@@ -291,8 +288,9 @@ function Pnt.mode()
|
||||
for i=1,#L do
|
||||
local t=M.scoreDisp(L[i])
|
||||
local s=#t
|
||||
setFont(int((26-s*.4)/5)*5)
|
||||
gc.print(t,955,275+25*i+(s<15 and 0 or s<25 and 2 or 4))
|
||||
local f=int((30-s*.4)/5)*5
|
||||
setFont(f)
|
||||
gc.print(t,955,275+25*i+17-7*(f/5+1)*.5)
|
||||
setFont(10)
|
||||
_=L[i].date
|
||||
if _ then gc.print(_,1155,284+25*i)end
|
||||
@@ -309,7 +307,7 @@ function Pnt.mode()
|
||||
end
|
||||
|
||||
WIDGET.init("mode",{
|
||||
WIDGET.newKey({name="mod", x=140,y=655,w=210,h=80,font=35,code=WIDGET.lnk_goScene("mod")}),
|
||||
WIDGET.newKey({name="mod", x=140,y=655,w=220,h=80,font=35,code=WIDGET.lnk_goScene("mod")}),
|
||||
WIDGET.newButton({name="start", x=1040,y=655,w=180,h=80,font=40,code=WIDGET.lnk_pressKey("return"),hide=function()return not mapCam.sel end}),
|
||||
WIDGET.newButton({name="back", x=1200,y=655,w=120,h=80,font=40,code=WIDGET.lnk_BACK}),
|
||||
})
|
||||
@@ -1,11 +1,11 @@
|
||||
local gc=love.graphics
|
||||
local Timer=love.timer.getTime
|
||||
|
||||
local mStr=mStr
|
||||
|
||||
local abs,int,sin=math.abs,math.floor,math.sin
|
||||
local format=string.format
|
||||
|
||||
local mStr=mStr
|
||||
|
||||
function sceneInit.stat()
|
||||
local S=STAT
|
||||
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}
|
||||
@@ -91,8 +91,8 @@ function Pnt.stat()
|
||||
local r=Timer()*2
|
||||
local R=int(r)%7+1
|
||||
gc.setColor(1,1,1,1-abs(r%1*2-1))
|
||||
gc.draw(TEXTURE.miniBlock[R],660,50,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],660,300,0,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],680,50,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],680,300,0,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
end
|
||||
|
||||
WIDGET.init("stat",{
|
||||
|
||||
Reference in New Issue
Block a user