继续收拾各种ui相关

空心控件统一加上灰色背景方便观察
按钮样式调整
This commit is contained in:
MrZ626
2021-12-01 02:40:11 +08:00
parent c534bbd12a
commit 26e66b313f
10 changed files with 75 additions and 46 deletions

View File

@@ -73,9 +73,9 @@ local COLOR={
lGray= {hsv(0.02, 0.06, 0.86)},
white= {hsv(0.01, 0.02, 0.99)},
xGray= {hsv(0.00, 0.00, 0.42,.8)},
xGray= {hsv(0.00, 0.00, 0.35,.8)},
lxGray= {hsv(0.00, 0.00, 0.62,.8)},
dxGray= {hsv(0.00, 0.00, 0.26,.8)},
dxGray= {hsv(0.00, 0.00, 0.16,.8)},
}
for k,v in next,{
R='red', F='fire', O='orange', Y='yellow', L='lime', J='jade', G='green', A='aqua', C='cyan', N='navy', S='sea', B='blue', V='violet', P='purple', M='magenta', W='wine',

View File

@@ -148,9 +148,9 @@ function button:isAbove(x,y)
local ATV=self.ATV
return
x>self.x-ATV and
y>self.y-ATV and
y>self.y and
x<self.x+self.w+2*ATV and
y<self.y+self.h+2*ATV
y<self.y+self.h
end
function button:getCenter()
return self.x+self.w*.5,self.y+self.h*.5
@@ -171,17 +171,19 @@ function button:draw()
--Button
gc_setColor(.15+r*.7,.15+g*.7,.15+b*.7,.9)
gc_rectangle('fill',x-ATV,y-ATV,w+2*ATV,h+2*ATV,3)
gc_rectangle('fill',x-ATV,y,w+2*ATV,h,4)
gc_setLineWidth(2)
gc_setColor(.3+r*.7,.3+g*.7,.3+b*.7)
gc_rectangle('line',x-ATV,y,w+2*ATV,h,5)
if ATV>0 then
gc_setLineWidth(2)
gc_setColor(.97,.97,.97,ATV*.125)
gc_rectangle('line',x-ATV+2,y-ATV+2,w+2*ATV-4,h+2*ATV-4,3)
gc_rectangle('line',x-ATV,y,w+2*ATV,h,3)
end
--Drawable
local obj=self.obj
local ox,oy=obj:getWidth()*.5,obj:getHeight()*.5
local y0=y+h*.5-ATV*.5
local y0=y+h*.5
gc_setColor(1,1,1,.2+ATV*.05)
if self.align=='M'then
local x0=x+w*.5
@@ -219,9 +221,9 @@ function button:press(_,_,k)
SYSFX.newRectRipple(
6,
self.x-ATV,
self.y-ATV-WIDGET.scrollPos,
self.y-WIDGET.scrollPos,
self.w+2*ATV,
self.h+2*ATV
self.h
)
if self.sound then
SFX.play('button')
@@ -301,6 +303,10 @@ function key:draw()
local align=self.align
local r,g,b=c[1],c[2],c[3]
--Background
gc_setColor(0,0,0,.3)
gc_rectangle('fill',x,y,w,h,4)
--Frame
if not self.noFrame then
gc_setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7)
@@ -415,6 +421,10 @@ function switch:draw()
local x,y=self.x,self.y
local ATV=self.ATV
--Background
gc_setColor(0,0,0,.3)
gc_rectangle('fill',x,y-25,50,50,4)
--Frame
gc_setLineWidth(2)
gc_setColor(1,1,1,.6+ATV*.1)
@@ -700,6 +710,10 @@ function selector:draw()
local w=self.w
local ATV=self.ATV
--Background
gc_setColor(0,0,0,.3)
gc_rectangle('fill',x,y,w,60,4)
--Frame
gc_setColor(1,1,1,.6+ATV*.1)
gc_setLineWidth(2)
@@ -863,9 +877,15 @@ function inputBox:draw()
local x,y,w,h=self.x,self.y,self.w,self.h
local ATV=self.ATV
gc_setColor(1,1,1,ATV*.08)
gc_rectangle('fill',x,y,w,h,3)
--Background
gc_setColor(0,0,0,.4)
gc_rectangle('fill',x,y,w,h,4)
--Highlight
gc_setColor(1,1,1,ATV*.08*(math.sin(TIME()*4.2)*.2+.8))
gc_rectangle('fill',x,y,w,h,4)
--Frame
gc_setColor(1,1,1)
gc_setLineWidth(3)
gc_rectangle('line',x,y,w,h,3)
@@ -1023,8 +1043,8 @@ function textBox:draw()
local lineH=self.lineH
--Background
gc_setColor(0,0,0,.4)
gc_rectangle('fill',x,y,w,h,3)
gc_setColor(0,0,0,.3)
gc_rectangle('fill',x,y,w,h,4)
--Frame
gc_setLineWidth(2)
@@ -1197,6 +1217,10 @@ function listBox:draw()
gc_push('transform')
gc_translate(x,y)
--Background
gc_setColor(0,0,0,.4)
gc_rectangle('fill',0,0,w,h,4)
--Frame
gc_setColor(WIDGET.sel==self and COLOR.lN or COLOR.Z)
gc_setLineWidth(2)

View File

@@ -135,6 +135,8 @@ function scene.keyDown(key)
end
function scene.draw()
gc.setColor(COLOR.dX)
gc.rectangle('fill',100,80,650,150,5)
gc.setColor(COLOR.Z)
gc.setLineWidth(2)
gc.rectangle('line',100,80,650,150,5)

View File

@@ -216,6 +216,9 @@ function scene.update(dt)
end
end
local function _sunStencil()
gc.rectangle('fill',-60,-440,120,120)
end
function scene.draw()
--Health bar
if life1>0 then
@@ -235,12 +238,11 @@ function scene.draw()
gc.rotate(rot)
--Draw sun
gc.setStencilTest('notequal',1)
gc.stencil(_sunStencil)
gc.setColor(.7,.5,.3)
gc.circle('fill',0,-380-sunH,60)
--Draw sun-board
gc.setColor(.08,.08,.084)
gc.rectangle('fill',-60,-440,120,120)
gc.setStencilTest()
--Draw direction
if play then

View File

@@ -51,7 +51,6 @@ local iconList={
}
gc.setDefaultFilter('linear','linear')
local sure=0
local invis
local state
local startTime,time
@@ -253,21 +252,14 @@ end
function scene.keyDown(key,isRep)
if isRep then return end
if key=='r'then
if state~=1 or sure>.2 then
if state~=1 or tryReset()then
newGame()
else
sure=1
MES.new('info',"Press again")
end
elseif key=='z'or key=='x'then
love.mousepressed(ms.getPosition())
elseif key=='escape'then
if state~=1 then
if tryBack()then
SCN.back()
end
else
sure=1
if state~=1 or tryBack()then
SCN.back()
end
elseif state==0 then
if key=='q'then
@@ -292,8 +284,6 @@ function scene.update(dt)
score1=score1+MATH.sign(score-score1)+int((score-score1)*.1+.5)
end
if sure>0 then sure=sure-dt end
for i=#lines,1,-1 do
local L=lines[i]
L.time=L.time+dt
@@ -309,6 +299,10 @@ function scene.draw()
gc.translate(field.x,field.y)
gc.scale(field.w/field.c,field.h/field.r)
--Background
gc.setColor(COLOR.dX)
gc.rectangle('fill',0,0,field.w,field.h)
--Matrix
local mono=state==0 or invis and not field.full
if mono then
@@ -348,12 +342,9 @@ function scene.draw()
gc.line(lines[i].line)
end
gc.pop()
--Frame
if state==2 then
--Draw no-setting area
gc.setColor(1,0,0,.3)
gc.rectangle('fill',0,100,155,80)
gc.setColor(.9,.9,0)--win
elseif state==1 then
gc.setColor(.9,.9,.9)--game
@@ -363,6 +354,12 @@ function scene.draw()
gc.setLineWidth(6)
gc.rectangle('line',field.x-5,field.y-5,field.w+10,field.h+10)
--Draw no-setting area
if state==2 then
gc.setColor(1,0,0,.3)
gc.rectangle('fill',0,100,155,80)
end
--Maxcombo
setFont(20)gc.setColor(COLOR.dF)
gc.print(maxCombo,1142,1)

View File

@@ -159,8 +159,8 @@ function scene.draw()
gc.setColor(0,0,0,timer/50)
gc.print("POLYFORGE",20,620)
setFont(30)
gc.print("Idea by ImpactBlue Studios",860,630)
gc.print("n-Spire ver. & ported & improved by MrZ",670,670)
gc.printf("Idea by ImpactBlue Studios",0,630,1260,'right')
gc.printf("n-Spire ver. & ported & improved by MrZ",0,670,1260,'right')
end
end

View File

@@ -125,11 +125,9 @@ function scene.draw()
setFont(70)
mStr(state==1 and progress or state==0 and"Ready"or state==2 and"Win",1130,300)
gc.setColor(COLOR.dX)
gc.rectangle('fill',310,30,660,660)
if state==2 then
--Draw no-setting area
gc.setColor(1,0,0,.3)
gc.rectangle('fill',15,295,285,250)
gc.setColor(.9,.9,0)--win
elseif state==1 then
gc.setColor(.9,.9,.9)--game
@@ -139,6 +137,12 @@ function scene.draw()
gc.setLineWidth(10)
gc.rectangle('line',310,30,660,660)
--Draw no-setting area
if state==2 then
gc.setColor(1,0,0,.3)
gc.rectangle('fill',15,295,285,250)
end
local width=640/rank
local mono=state==0 or invis and state==1 and progress>0
gc.setLineWidth(4)

View File

@@ -186,7 +186,7 @@ function scene.draw()
gc.printf(t,306,180,950)
setFont(30)
gc.setColor(1,1,1,.4+.2*sin(TIME()*4))
gc.setColor(1,1,1,.4+.05*sin(TIME()*12.6))
gc.rectangle('fill',20,143+35*(selected-scrollPos),280,35)
setFont(30)

View File

@@ -4,7 +4,7 @@ local langList={
zh_trad="繁體中文",
en="English",
fr="Français",
es="Español",
es="Español\nCastellano",
pt="Português",
zh_grass="机翻",
@@ -33,7 +33,7 @@ scene.widgetList={
WIDGET.newButton{x=225,y=331,w=255,h=120,font=40, fText=langList.en, color='L',code=function()_setLang('en')end},
WIDGET.newButton{x=500,y=331,w=255,h=120,font=40, fText=langList.fr, color='J',code=function()_setLang('fr')end},
WIDGET.newButton{x=775,y=331,w=255,h=120,font=40, fText=langList.es, color='G',code=function()_setLang('es')end},
WIDGET.newButton{x=775,y=331,w=255,h=120,font=35, fText=langList.es, color='G',code=function()_setLang('es')end},
WIDGET.newButton{x=1050,y=331,w=255,h=120,font=40, fText=langList.pt, color='dG',code=function()_setLang('pt')end},
WIDGET.newButton{x=271,y=472,w=346,h=120,font=45, fText=langList.zh_grass,color='N',code=function()_setLang('zh_grass')end},

View File

@@ -284,7 +284,7 @@ function scene.draw()
--Score board
if sel then
local M=MODES[sel]
gc_setColor(COLOR.X)
gc_setColor(COLOR.lX)
gc_rectangle('fill',920,0,360,720,5)--Info board
gc_setColor(COLOR.Z)
setFont(40)mStr(text.modes[sel][1],1100,5)
@@ -295,7 +295,7 @@ function scene.draw()
end
if M.score then
mText(TEXTOBJ.highScore,1100,240)
gc_setColor(COLOR.dX)
gc_setColor(COLOR.X)
gc_rectangle('fill',940,290,320,280,5)--Highscore board
local L=M.records
gc_setColor(1,1,1)