优化绘制虚拟按键的代码
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local gc_setColor,gc_circle=gc.setColor,gc.circle
|
||||
local gc_setColor=gc.setColor
|
||||
local tc=love.touch
|
||||
|
||||
local max,sin=math.max,math.sin
|
||||
@@ -265,10 +265,10 @@ local function drawAtkPointer(x,y)
|
||||
t=sin(t*20)
|
||||
|
||||
gc_setColor(.2,.7+t*.2,1,.6+t*.4)
|
||||
gc_circle("fill",x,y,25,6)
|
||||
gc.circle("fill",x,y,25,6)
|
||||
|
||||
gc_setColor(0,.6,1,.8-a)
|
||||
gc_circle("line",x,y,30*(1+a),6)
|
||||
gc.circle("line",x,y,30*(1+a),6)
|
||||
end
|
||||
function scene.draw()
|
||||
local t=TIME()
|
||||
@@ -284,44 +284,7 @@ function scene.draw()
|
||||
end
|
||||
|
||||
--Virtual keys
|
||||
if SETTING.VKSwitch then
|
||||
local a=SETTING.VKAlpha
|
||||
local _
|
||||
if SETTING.VKIcon then
|
||||
local icons=TEXTURE.VKIcon
|
||||
for i=1,#VK do
|
||||
if VK[i].ava then
|
||||
local B=VK[i]
|
||||
gc_setColor(1,1,1,a)
|
||||
gc.setLineWidth(B.r*.07)
|
||||
gc_circle("line",B.x,B.y,B.r,10)--Button outline
|
||||
_=VK[i].pressTime
|
||||
gc_setColor(B.color[1],B.color[2],B.color[3],a)
|
||||
gc.draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--Icon
|
||||
if _>0 then
|
||||
gc_setColor(1,1,1,a*_*.08)
|
||||
gc_circle("fill",B.x,B.y,B.r*.94,10)--Glow when press
|
||||
gc_circle("line",B.x,B.y,B.r*(1.4-_*.04),10)--Ripple
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for i=1,#VK do
|
||||
if VK[i].ava then
|
||||
local B=VK[i]
|
||||
gc_setColor(1,1,1,a)
|
||||
gc.setLineWidth(B.r*.07)
|
||||
gc_circle("line",B.x,B.y,B.r,10)
|
||||
_=VK[i].pressTime
|
||||
if _>0 then
|
||||
gc_setColor(1,1,1,a*_*.08)
|
||||
gc_circle("fill",B.x,B.y,B.r*.94,10)
|
||||
gc_circle("line",B.x,B.y,B.r*(1.4-_*.04),10)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
drawVirtualKeys()
|
||||
|
||||
--Attacking & Being attacked
|
||||
if GAME.modeEnv.royaleMode then
|
||||
|
||||
Reference in New Issue
Block a user