性能优化

This commit is contained in:
MrZ626
2020-12-25 15:09:02 +08:00
parent 27257a40d2
commit 3bf44819e4
4 changed files with 150 additions and 143 deletions

View File

@@ -1,4 +1,7 @@
local gc=love.graphics local gc=love.graphics
local gc_getColor,gc_setColor,gc_push,gc_pop,gc_translate,gc_scale,gc_rotate,gc_shear
=gc.getColor,gc.setColor,gc.push,gc.pop,gc.translate,gc.scale,gc.rotate,gc.shear
local int,rnd,rem=math.floor,math.random,table.remove local int,rnd,rem=math.floor,math.random,table.remove
local setFont,mStr=setFont,mStr local setFont,mStr=setFont,mStr
@@ -9,63 +12,63 @@ function textFX.appear(t)
mStr(t.text,t.x,t.y-t.font*.7) mStr(t.text,t.x,t.y-t.font*.7)
end end
function textFX.sudden(t) function textFX.sudden(t)
gc.setColor(1,1,1,1-t.c) gc_setColor(1,1,1,1-t.c)
mStr(t.text,t.x,t.y-t.font*.7) mStr(t.text,t.x,t.y-t.font*.7)
end end
function textFX.fly(t) function textFX.fly(t)
mStr(t.text,t.x+(t.c-.5)^3*300,t.y-t.font*.7) mStr(t.text,t.x+(t.c-.5)^3*300,t.y-t.font*.7)
end end
function textFX.stretch(t) function textFX.stretch(t)
gc.push("transform") gc_push("transform")
gc.translate(t.x,t.y) gc_translate(t.x,t.y)
if t.c<.3 then gc.scale((.3-t.c)*1.6+1,1)end if t.c<.3 then gc_scale((.3-t.c)*1.6+1,1)end
mStr(t.text,0,-t.font*.7) mStr(t.text,0,-t.font*.7)
gc.pop() gc_pop()
end end
function textFX.drive(t) function textFX.drive(t)
gc.push("transform") gc_push("transform")
gc.translate(t.x,t.y) gc_translate(t.x,t.y)
if t.c<.3 then gc.shear((.3-t.c)*2,0)end if t.c<.3 then gc_shear((.3-t.c)*2,0)end
mStr(t.text,0,-t.font*.7) mStr(t.text,0,-t.font*.7)
gc.pop() gc_pop()
end end
function textFX.spin(t) function textFX.spin(t)
gc.push("transform") gc_push("transform")
gc.translate(t.x,t.y) gc_translate(t.x,t.y)
if t.c<.3 then if t.c<.3 then
gc.rotate((.3-t.c)^2*4) gc_rotate((.3-t.c)^2*4)
elseif t.c>.8 then elseif t.c>.8 then
gc.rotate((t.c-.8)^2*-4) gc_rotate((t.c-.8)^2*-4)
end end
mStr(t.text,0,-t.font*.7) mStr(t.text,0,-t.font*.7)
gc.pop() gc_pop()
end end
function textFX.flicker(t) function textFX.flicker(t)
local _,_,_,T=gc.getColor() local _,_,_,T=gc_getColor()
gc.setColor(1,1,1,T*(rnd()+.5)) gc_setColor(1,1,1,T*(rnd()+.5))
mStr(t.text,t.x,t.y-t.font*.7) mStr(t.text,t.x,t.y-t.font*.7)
end end
function textFX.zoomout(t) function textFX.zoomout(t)
gc.push("transform") gc_push("transform")
local k=t.c^.5*.1+1 local k=t.c^.5*.1+1
gc.translate(t.x,t.y) gc_translate(t.x,t.y)
gc.scale(k,k) gc_scale(k,k)
mStr(t.text,0,-t.font*.7) mStr(t.text,0,-t.font*.7)
gc.pop() gc_pop()
end end
function textFX.beat(t) function textFX.beat(t)
gc.push("transform") gc_push("transform")
gc.translate(t.x,t.y) gc_translate(t.x,t.y)
if t.c<.3 then if t.c<.3 then
local k=1.3-t.c^2/.3 local k=1.3-t.c^2/.3
gc.scale(k,k) gc_scale(k,k)
end end
mStr(t.text,0,-t.font*.7) mStr(t.text,0,-t.font*.7)
gc.pop() gc_pop()
end end
function textFX.score(t) function textFX.score(t)
local _,_,_,T=gc.getColor() local _,_,_,T=gc_getColor()
gc.setColor(1,1,1,T*.5) gc_setColor(1,1,1,T*.5)
mStr(t.text,t.x,t.y-t.font*.7-t.c^.2*50) mStr(t.text,t.x,t.y-t.font*.7-t.c^.2*50)
end end
@@ -117,7 +120,7 @@ function TEXT.draw(list)
for i=1,#list do for i=1,#list do
local t=list[i] local t=list[i]
local p=t.c local p=t.c
gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5) gc_setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5)
setFont(t.font) setFont(t.font)
t:draw() t:draw()
end end

View File

@@ -1,12 +1,11 @@
local gc=love.graphics local gc=love.graphics
local gc_rectangle,gc_setColor=gc.rectangle,gc.setColor local gc_draw,gc_print,gc_rectangle,gc_setColor=gc.draw,gc.print,gc.rectangle,gc.setColor
local TIME=love.timer.getTime local TIME=love.timer.getTime
local int,ceil,rnd=math.floor,math.ceil,math.random local int,ceil,rnd=math.floor,math.ceil,math.random
local max,min,sin=math.max,math.min,math.sin local max,min,sin=math.max,math.min,math.sin
local format=string.format local format=string.format
local SCR=SCR local SCR=SCR
local setFont=setFont local setFont,mStr=setFont,mStr
local Draw=gc.draw--Use to speed up gc.draw(blockTexture)
local frameColorList={ local frameColorList={
[0]=COLOR.white, [0]=COLOR.white,
@@ -15,7 +14,7 @@ local frameColorList={
COLOR.lPurple, COLOR.lPurple,
COLOR.lOrange, COLOR.lOrange,
} }
--local function drawCell(y,x,id)gc.draw(SKIN.curText[id],30*x-30,-30*y)end --local function drawCell(y,x,id)gc_draw(SKIN.curText[id],30*x-30,-30*y)end
local function drawGrid(P,alpha) local function drawGrid(P,alpha)
local FBN,FUP=P.fieldBeneath,P.fieldUp local FBN,FUP=P.fieldBeneath,P.fieldUp
gc.setLineWidth(1) gc.setLineWidth(1)
@@ -23,10 +22,12 @@ local function drawGrid(P,alpha)
for x=1,9 do for x=1,9 do
gc.line(30*x,-10,30*x,600) gc.line(30*x,-10,30*x,600)
end end
gc.push("transform")
gc.translate(0,FBN+FUP-30*int((FBN+FUP)/30))
for y=0,19 do for y=0,19 do
y=30*(y-int((FBN+FUP)/30))+FBN+FUP gc.line(0,30*y,300,30*y)
gc.line(0,y,300,y)
end end
gc.pop()
end end
local function drawField(P) local function drawField(P)
local V,F=P.visTime,P.field local V,F=P.visTime,P.field
@@ -34,14 +35,15 @@ local function drawField(P)
local rep=GAME.replaying local rep=GAME.replaying
local texture=SKIN.curText local texture=SKIN.curText
if P.falling==-1 then--Blocks only if P.falling==-1 then--Blocks only
local t=TIME()*4
for j=start,min(start+21,#F)do for j=start,min(start+21,#F)do
for i=1,10 do for i=1,10 do
if F[j][i]>0 then if F[j][i]>0 then
if V[j][i]>0 then if V[j][i]>0 then
gc_setColor(1,1,1,min(V[j][i]*.05,1)) gc_setColor(1,1,1,min(V[j][i]*.05,1))
Draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i]) gc_draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
elseif rep then elseif rep then
gc_setColor(1,1,1,.3+.08*sin(.5*(j-i)+TIME()*4)) gc_setColor(1,1,1,.3+.08*sin(.5*(j-i)+t))
gc_rectangle("fill",30*i-30,-30*j,30,30) gc_rectangle("fill",30*i-30,-30*j,30,30)
end end
end end
@@ -64,7 +66,7 @@ local function drawField(P)
if F[j][i]>0 then if F[j][i]>0 then
if V[j][i]>0 then if V[j][i]>0 then
gc_setColor(1,1,1,min(V[j][i]*.05,1)) gc_setColor(1,1,1,min(V[j][i]*.05,1))
Draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i]) gc_draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
elseif rep then elseif rep then
gc_setColor(1,1,1,.2) gc_setColor(1,1,1,.2)
gc_rectangle("fill",30*i-30,-30*j,30,30) gc_rectangle("fill",30*i-30,-30*j,30,30)
@@ -101,7 +103,7 @@ local function drawFXs(P)
for i=1,#P.moveFX do for i=1,#P.moveFX do
local S=P.moveFX[i] local S=P.moveFX[i]
gc_setColor(1,1,1,.6-S[4]*.6) gc_setColor(1,1,1,.6-S[4]*.6)
Draw(texture[S[1]],30*S[2]-30,-30*S[3])-- drawCell(S[3],S[2],S[1]) gc_draw(texture[S[1]],30*S[2]-30,-30*S[3])-- drawCell(S[3],S[2],S[1])
end end
--ClearFX --ClearFX
@@ -119,21 +121,22 @@ local function drawGhost(P,clr)
local texture=SKIN.curText local texture=SKIN.curText
for i=1,P.r do for j=1,P.c do for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then if P.cur.bk[i][j]then
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1))-- drawCell(i+P.ghoY-1,j+P.curX-1,clr) gc_draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1))-- drawCell(i+P.ghoY-1,j+P.curX-1,clr)
end end
end end end end
end end
local function drawBlockOutline(P,texture,trans) local function drawBlockOutline(P,texture,trans)
SHADER.alpha:send("a",trans) SHADER.alpha:send("a",trans)
gc.setShader(SHADER.alpha) gc.setShader(SHADER.alpha)
local B=P.cur.bk
for i=1,P.r do for j=1,P.c do for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then if B[i][j]then
local x=30*(j+P.curX)-60-3 local x=30*(j+P.curX)-60-3
local y=30-30*(i+P.curY)-3 local y=30-30*(i+P.curY)-3
Draw(texture,x,y) gc_draw(texture,x,y)
Draw(texture,x+6,y+6) gc_draw(texture,x+6,y+6)
Draw(texture,x+6,y) gc_draw(texture,x+6,y)
Draw(texture,x,y+6) gc_draw(texture,x,y+6)
end end
end end end end
gc.setShader() gc.setShader()
@@ -141,9 +144,10 @@ end
local function drawBlock(P,clr) local function drawBlock(P,clr)
gc_setColor(1,1,1) gc_setColor(1,1,1)
local texture=SKIN.curText local texture=SKIN.curText
local B=P.cur.bk
for i=1,P.r do for j=1,P.c do for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then if B[i][j]then
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.curY-1))-- drawCell(i+P.curY-1,j+P.curX-1,clr) gc_draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.curY-1))-- drawCell(i+P.curY-1,j+P.curX-1,clr)
end end
end end end end
end end
@@ -153,7 +157,7 @@ local function drawNextPreview(P,B)
local y=21+ceil(P.fieldBeneath/30) local y=21+ceil(P.fieldBeneath/30)
for i=1,#B do for j=1,#B[1]do for i=1,#B do for j=1,#B[1]do
if B[i][j]then if B[i][j]then
Draw(puzzleMark[-1],30*(x+j-2),30*(1-y-i)) gc_draw(puzzleMark[-1],30*(x+j-2),30*(1-y-i))
end end
end end end end
end end
@@ -174,17 +178,17 @@ function draw.drawNext_norm(P)
local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color
for i=1,#bk do for j=1,#bk[1] do for i=1,#bk do for j=1,#bk[1] do
if bk[i][j]then if bk[i][j]then
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr) gc_draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
end end
end end end end
N=N+1 N=N+1
end end
if ENV.bagLine then if ENV.bagLine then
local L=ENV.bagLen local len=ENV.bagLen
local C=-P.pieceCount%L--Phase local phase=-P.pieceCount%len
gc_setColor(.8,.5,.5) gc_setColor(.8,.5,.5)
for i=C,N-1,L do for i=phase,N-1,len do
local y=72*i-77 local y=72*i-77
gc.line(2+P.fieldOff.x,y,120,y) gc.line(2+P.fieldOff.x,y,120,y)
end end
@@ -205,17 +209,17 @@ function draw.drawNext_hidden(P)
local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color
for i=1,#bk do for j=1,#bk[1] do for i=1,#bk do for j=1,#bk[1] do
if bk[i][j]then if bk[i][j]then
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr) gc_draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
end end
end end end end
N=N+1 N=N+1
end end
if ENV.bagLine then if ENV.bagLine then
local L=ENV.bagLen local len=ENV.bagLen
local C=-P.pieceCount%L--Phase local phase=-P.pieceCount%len
gc_setColor(.8,.5,.5) gc_setColor(.8,.5,.5)
for i=C,N-1,L do for i=phase,N-1,len do
local y=72*i-77 local y=72*i-77
gc.line(2+P.fieldOff.x,y,120,y) gc.line(2+P.fieldOff.x,y,120,y)
end end
@@ -237,7 +241,7 @@ function draw.drawHold_norm(P)
local bk,clr=B.bk,B.color local bk,clr=B.bk,B.color
for i=1,#bk do for j=1,#bk[1]do for i=1,#bk do for j=1,#bk[1]do
if bk[i][j]then if bk[i][j]then
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*1-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr) gc_draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*1-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
end end
end end end end
end end
@@ -265,7 +269,7 @@ function draw.drawHold_multi(P)
local bk,clr=P.holdQueue[n].bk,P.holdQueue[n].color local bk,clr=P.holdQueue[n].bk,P.holdQueue[n].color
for i=1,#bk do for j=1,#bk[1]do for i=1,#bk do for j=1,#bk[1]do
if bk[i][j]then if bk[i][j]then
Draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*n-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr) gc_draw(texture[clr],30*(j+2.06-#bk[1]*.5)-30,-30*(i+3.76-2.4*n-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
end end
end end end end
end end
@@ -293,16 +297,14 @@ local function drawDial(x,y,speed)
gc_setColor(1,1,1) gc_setColor(1,1,1)
mStr(int(speed),x,y-18) mStr(int(speed),x,y-18)
gc.setLineWidth(2)
gc.circle("line",x,y,30,6)
gc_draw(IMG.dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4)
gc.setLineWidth(4) gc.setLineWidth(4)
gc_setColor(1,1,1,.4) gc_setColor(1,1,1,.4)
gc.circle("line",x,y,30,10) gc.circle("line",x,y,30,6)
gc.setLineWidth(2)
gc_setColor(1,1,1,.6)
gc.circle("line",x,y,30,10)
gc_setColor(1,1,1,.8)
gc.draw(IMG.dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4)
end end
local hideBoardStencil={ local hideBoardStencil={
up=function()gc_rectangle("fill",0,0,300,300)end, up=function()gc_rectangle("fill",0,0,300,300)end,
@@ -351,7 +353,7 @@ function draw.norm(P)
--Draw dangerous area --Draw dangerous area
gc_setColor(1,0,0,.3) gc_setColor(1,0,0,.3)
gc_rectangle("fill",0,-600,300,-610-FUP-FBN) gc_rectangle("fill",0,-600,300,-FUP-FBN-10)
--Draw field --Draw field
drawField(P) drawField(P)
@@ -385,12 +387,12 @@ function draw.norm(P)
local x=30*(P.curX+P.sc[2])-15 local x=30*(P.curX+P.sc[2])-15
if ENV.center and ENV.block then if ENV.center and ENV.block then
gc_setColor(1,1,1,ENV.center) gc_setColor(1,1,1,ENV.center)
gc.draw(IMG.spinCenter,x,-30*(P.curY+P.sc[1])+15,nil,nil,nil,4,4) gc_draw(IMG.spinCenter,x,-30*(P.curY+P.sc[1])+15,nil,nil,nil,4,4)
end end
gc.translate(0,dy) gc.translate(0,dy)
if ENV.center and ENV.ghost then if ENV.center and ENV.ghost then
gc_setColor(1,1,1,trans*ENV.center) gc_setColor(1,1,1,trans*ENV.center)
gc.draw(IMG.spinCenter,x,-30*(P.ghoY+P.sc[1])+15,nil,nil,nil,4,4) gc_draw(IMG.spinCenter,x,-30*(P.ghoY+P.sc[1])+15,nil,nil,nil,4,4)
end end
end end
@@ -514,18 +516,18 @@ function draw.norm(P)
drawDial(510,510,P.dropSpeed) drawDial(510,510,P.dropSpeed)
drawDial(555,565,P.keySpeed) drawDial(555,565,P.keySpeed)
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc.draw(drawableText.bpm,540,480) gc_draw(drawableText.bpm,540,480)
gc.draw(drawableText.kpm,494,573) gc_draw(drawableText.kpm,494,573)
local S=P.stat local S=P.stat
--Score & Time --Score & Time
setFont(25) setFont(25)
gc_setColor(0,0,0,.3) gc_setColor(0,0,0,.3)
gc.print(P.score1,18,509) gc_print(P.score1,18,509)
gc.print(format("%.2f",S.time),18,539) gc_print(format("%.2f",S.time),18,539)
gc_setColor(COLOR.lYellow)gc.print(P.score1,20,510) gc_setColor(COLOR.lYellow)gc_print(P.score1,20,510)
gc_setColor(COLOR.sky)gc.print(format("%.2f",S.time),20,540) gc_setColor(COLOR.sky)gc_print(format("%.2f",S.time),20,540)
--FinesseCombo --FinesseCombo
if P.finesseCombo>2 then if P.finesseCombo>2 then
@@ -533,25 +535,25 @@ function draw.norm(P)
local str=P.finesseCombo.."x" local str=P.finesseCombo.."x"
if S.finesseRate==5*S.piece then if S.finesseRate==5*S.piece then
gc_setColor(.9,.9,.3,_*.2) gc_setColor(.9,.9,.3,_*.2)
gc.print(str,20,570) gc_print(str,20,570)
gc_setColor(.9,.9,.3,1.2-_*.1) gc_setColor(.9,.9,.3,1.2-_*.1)
elseif S.maxFinesseCombo==S.piece then elseif S.maxFinesseCombo==S.piece then
gc_setColor(.7,.7,1,_*.2) gc_setColor(.7,.7,1,_*.2)
gc.print(str,20,570) gc_print(str,20,570)
gc_setColor(.7,.7,1,1.2-_*.1) gc_setColor(.7,.7,1,1.2-_*.1)
else else
gc_setColor(1,1,1,_*.2) gc_setColor(1,1,1,_*.2)
gc.print(str,20,570) gc_print(str,20,570)
gc_setColor(1,1,1,1.2-_*.1) gc_setColor(1,1,1,1.2-_*.1)
end end
if _>0 then if _>0 then
gc.push("transform") gc.push("transform")
gc.translate(20,600) gc.translate(20,600)
gc.scale(1+_*.08) gc.scale(1+_*.08)
gc.print(str,0,-30) gc_print(str,0,-30)
gc.pop() gc.pop()
else else
gc.print(str,20,570) gc_print(str,20,570)
end end
end end
@@ -560,13 +562,13 @@ function draw.norm(P)
gc_setColor(1,1,1) gc_setColor(1,1,1)
if P.life<=3 then if P.life<=3 then
for i=1,P.life do for i=1,P.life do
gc.draw(IMG.lifeIcon,450+25*i,595,nil,.8) gc_draw(IMG.lifeIcon,450+25*i,595,nil,.8)
end end
else else
gc.draw(IMG.lifeIcon,475,595,nil,.8) gc_draw(IMG.lifeIcon,475,595,nil,.8)
setFont(20) setFont(20)
gc.print("x",503,595) gc_print("x",503,595)
gc.print(P.life,517,595) gc_print(P.life,517,595)
end end
end end
@@ -588,7 +590,7 @@ function draw.norm(P)
else else
gc_setColor(1,1,1) gc_setColor(1,1,1)
end end
gc.print(missionEnum[L[P.curMission]],85,110) gc_print(missionEnum[L[P.curMission]],85,110)
--Draw next mission --Draw next mission
setFont(20) setFont(20)
@@ -596,7 +598,7 @@ function draw.norm(P)
local m=L[P.curMission+i] local m=L[P.curMission+i]
if m then if m then
m=missionEnum[m] m=missionEnum[m]
gc.print(m,87-28*i,117) gc_print(m,87-28*i,117)
else else
break break
end end
@@ -633,7 +635,7 @@ function draw.small(P)
local texture=SKIN.curTextMini local texture=SKIN.curTextMini
for j=1,#F do for j=1,#F do
for i=1,10 do if F[j][i]>0 then for i=1,10 do if F[j][i]>0 then
Draw(texture[F[j][i]],6*i-6,120-6*j) gc_draw(texture[F[j][i]],6*i-6,120-6*j)
end end end end
end end
@@ -648,7 +650,7 @@ function draw.small(P)
if GAME.modeEnv.royaleMode then if GAME.modeEnv.royaleMode then
gc_setColor(1,1,1) gc_setColor(1,1,1)
for i=1,P.strength do for i=1,P.strength do
gc.draw(IMG.badgeIcon,12*i-7,4,nil,.5) gc_draw(IMG.badgeIcon,12*i-7,4,nil,.5)
end end
end end
@@ -664,7 +666,7 @@ function draw.small(P)
--Draw Canvas --Draw Canvas
gc_setColor(1,1,1) gc_setColor(1,1,1)
gc.draw(P.canvas,P.x,P.y,nil,P.size*10) gc_draw(P.canvas,P.x,P.y,nil,P.size*10)
if P.killMark then if P.killMark then
gc.setLineWidth(3) gc.setLineWidth(3)
gc_setColor(1,0,0,min(P.endCounter,25)*.04) gc_setColor(1,0,0,min(P.endCounter,25)*.04)
@@ -718,7 +720,7 @@ function draw.demo(P)
_=libColor[skinSet[id]] _=libColor[skinSet[id]]
gc_setColor(_[1],_[2],_[3],.3) gc_setColor(_[1],_[2],_[3],.3)
_=blockImg[id] _=blockImg[id]
gc.draw(_,15,40*N-10,nil,16,nil,0,_:getHeight()*.5) gc_draw(_,15,40*N-10,nil,16,nil,0,_:getHeight()*.5)
N=N+1 N=N+1
end end
@@ -729,7 +731,7 @@ function draw.demo(P)
_=libColor[skinSet[id]] _=libColor[skinSet[id]]
gc_setColor(_[1],_[2],_[3],.3) gc_setColor(_[1],_[2],_[3],.3)
_=blockImg[id] _=blockImg[id]
gc.draw(_,285,40*N-10,nil,16,nil,_:getWidth(),_:getHeight()*.5) gc_draw(_,285,40*N-10,nil,16,nil,_:getWidth(),_:getHeight()*.5)
N=N+1 N=N+1
end end
gc.pop() gc.pop()

View File

@@ -12,13 +12,6 @@ local ct=coroutine
local kickList=require"parts/kickList" local kickList=require"parts/kickList"
local scs=spinCenters local scs=spinCenters
local function without(L,e)
for i=1,#L do
if L[i]==e then return end
end
return true
end
--------------------------<FX>-------------------------- --------------------------<FX>--------------------------
function Player.showText(P,text,dx,dy,font,style,spd,stop) function Player.showText(P,text,dx,dy,font,style,spd,stop)
if P.gameEnv.text then if P.gameEnv.text then
@@ -34,14 +27,17 @@ function Player.createLockFX(P)
for i=1,P.r do for i=1,P.r do
local y=P.curY+i-1 local y=P.curY+i-1
if without(P.clearedRow,y)then local L=P.clearedRow
y=-30*y for i=1,#L do
for j=1,P.c do if L[i]==y then goto continue end
if BK[i][j]then end
ins(P.lockFX,{30*(P.curX+j-2),y,0,t}) y=-30*y
end for j=1,P.c do
if BK[i][j]then
ins(P.lockFX,{30*(P.curX+j-2),y,0,t})
end end
end end
::continue::
end end
end end
function Player.createDropFX(P,x,y,w,h) function Player.createDropFX(P,x,y,w,h)

View File

@@ -1,4 +1,5 @@
local gc=love.graphics local gc=love.graphics
local gc_circle=gc.circle
local tc=love.touch local tc=love.touch
local TIME=TIME local TIME=TIME
@@ -253,47 +254,10 @@ end
local function drawAtkPointer(x,y) local function drawAtkPointer(x,y)
local t=sin(TIME()*20) local t=sin(TIME()*20)
gc.setColor(.2,.7+t*.2,1,.6+t*.4) gc.setColor(.2,.7+t*.2,1,.6+t*.4)
gc.circle("fill",x,y,25,6) gc_circle("fill",x,y,25,6)
local a=TIME()*3%1*.8 local a=TIME()*3%1*.8
gc.setColor(0,.6,1,.8-a) 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
local function drawVirtualkey()
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.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
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 end
function scene.draw() function scene.draw()
local t=TIME() local t=TIME()
@@ -302,13 +266,53 @@ function scene.draw()
gc.setColor(1,1,1,.2+.1*(sin(3*t)+sin(2.6*t))) gc.setColor(1,1,1,.2+.1*(sin(3*t)+sin(2.6*t)))
mStr(text.marking,190,60+26*sin(t)) mStr(text.marking,190,60+26*sin(t))
end end
--Players
for p=1,#PLAYERS do for p=1,#PLAYERS do
PLAYERS[p]:draw() PLAYERS[p]:draw()
end end
--Virtual keys
gc.setColor(1,1,1) gc.setColor(1,1,1)
if SETTING.VKSwitch then drawVirtualkey()end 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.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
--Attacking & Being attacked
if GAME.modeEnv.royaleMode then if GAME.modeEnv.royaleMode then
local P=PLAYERS[1] local P=PLAYERS[1]
gc.setLineWidth(5) gc.setLineWidth(5)
@@ -318,7 +322,9 @@ function scene.draw()
gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+670*P.size) gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+670*P.size)
end end
if P.atkMode~=4 then if P.atkMode~=4 then
if P.atking then drawAtkPointer(P.atking.centerX,P.atking.centerY)end if P.atking then
drawAtkPointer(P.atking.centerX,P.atking.centerY)
end
else else
for i=1,#P.atker do for i=1,#P.atker do
local p=P.atker[i] local p=P.atker[i]