降低所有背景的亮度,优化部分背景性能

This commit is contained in:
MrZ626
2021-05-26 22:14:57 +08:00
parent 34886ca643
commit b07f97097f
33 changed files with 123 additions and 123 deletions

View File

@@ -1,9 +1,6 @@
local gc_clear=love.graphics.clear
local BGs={
none={
draw=function()
love.graphics.clear(.15,.15,.15)
end
}
none={draw=function()gc_clear(.15,.15,.15)end}
}
local BGlist={"none"}
local BG={

View File

@@ -16,6 +16,7 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
shader:send("t",t)
gc.setShader(shader)
gc.rectangle('fill',0,0,SCR.w,SCR.h)

View File

@@ -28,9 +28,8 @@ function back.resize()
end
end
function back.draw()
gc.clear(.2,.2,.2)
local r,g,b=COLOR.rainbow_light(TIME())
gc.setColor(r,g,b,.2)
gc.clear(.1,.1,.1)
gc.setColor(1,1,1,.1)
gc.draw(video,X,Y,nil,K)
end
function back.discard()

View File

@@ -15,6 +15,7 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
shader:send("t",t)
gc.setShader(shader)
gc.rectangle('fill',0,0,SCR.w,SCR.h)

View File

@@ -15,6 +15,7 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
shader:send("t",t)
gc.setShader(shader)
gc.rectangle('fill',0,0,SCR.w,SCR.h)

View File

@@ -1,5 +1,10 @@
--Blackhole
local gc=love.graphics
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
local gc_translate,gc_scale=gc.translate,gc.scale
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_draw,gc_circle=gc.draw,gc.circle
local sin,cos=math.sin,math.cos
local rnd=math.random
local ins,rem=table.insert,table.remove
@@ -37,29 +42,29 @@ function back.update()
end
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc.translate(SCR.w/2,SCR.h/2)
gc_clear(.1,.1,.1)
gc_push('transform')
gc_origin()
gc_translate(SCR.w/2,SCR.h/2)
--Squares
gc.setColor(.5,.5,.5)
gc_setColor(1,1,1,.2)
for i=1,#squares do
local S=squares[i]
gc.draw(S.texture,S.d*cos(S.ang),S.d*sin(S.ang),S.rotate,S.size*.026,nil,15,15)
gc_draw(S.texture,S.d*cos(S.ang),S.d*sin(S.ang),S.rotate,S.size*.026,nil,15,15)
end
--Blackhole
gc.scale(SCR.rad/1600)
gc.setColor(0,0,0)
gc.circle('fill',0,0,157)
gc.setLineWidth(6)
gc_scale(SCR.rad/1600)
gc_setColor(.07,.07,.07)
gc_circle('fill',0,0,157)
gc_setLineWidth(6)
for i=0,15 do
gc.setColor(0,0,0,1-i*.0666)
gc.circle('line',0,0,160+6*i)
gc_setColor(.07,.07,.07,1-i*.0666)
gc_circle('line',0,0,160+6*i)
end
gc.scale(1600/SCR.rad)
gc.pop()
gc_scale(1600/SCR.rad)
gc_pop()
end
function back.discard()
squares=nil

View File

@@ -1,5 +1,8 @@
--Large falling tetrominoes
local gc=love.graphics
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
local gc_setColor,gc_draw=gc.setColor,gc.draw
local rnd=math.random
local ins,rem=table.insert,table.remove
local back={}
@@ -32,22 +35,22 @@ function back.update()
end
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc.setColor(1,1,1,.4)
gc_clear(.1,.1,.1)
gc_push('transform')
gc_origin()
gc_setColor(1,1,1,.2)
for i=1,#mino do
local M=mino[i]
local b=M.block
for y=1,#b do
for x=1,#b[1]do
if b[y][x]then
gc.draw(M.texture,M.x+(x-1)*30*M.k,M.y-y*30*M.k,nil,M.k)
gc_draw(M.texture,M.x+(x-1)*30*M.k,M.y-y*30*M.k,nil,M.k)
end
end
end
end
gc.pop()
gc_pop()
end
function back.discard()
mino=nil

View File

@@ -46,7 +46,7 @@ function back.draw()
for i=1,#mino do
local C=mino[i]
local c=C.color
gc.setColor(c[1],c[2],c[3],.5)
gc.setColor(c[1],c[2],c[3],.2)
gc.draw(C.block,C.x,C.y,C.ang,C.k,C.k,C.block:getWidth()/2,C.block:getHeight()/2)
end
gc.pop()

View File

@@ -1,5 +1,8 @@
--Space but tetrominoes
local gc=love.graphics
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
local gc_translate,gc_setColor,gc_draw=gc.translate,gc.setColor,gc.draw
local sin,cos=math.sin,math.cos
local rnd=math.random
local ins,rem=table.insert,table.remove
@@ -38,17 +41,17 @@ function back.update()
end
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc.translate(SCR.w/2,SCR.h/2)
gc_clear(.1,.1,.1)
gc_push('transform')
gc_origin()
gc_translate(SCR.w/2,SCR.h/2)
for i=1,#mino do
local M=mino[i]
local c=M.color
gc.setColor(c[1],c[2],c[3],.4)
gc.draw(M.block,M.d*cos(M.ang),M.d*sin(M.ang),M.rotate,(18*M.d/SCR.rad)^1.6,nil,M.block:getWidth()/2,M.block:getHeight()/2)
gc_setColor(c[1],c[2],c[3],.2)
gc_draw(M.block,M.d*cos(M.ang),M.d*sin(M.ang),M.rotate,(18*M.d/SCR.rad)^1.6,nil,M.block:getWidth()/2,M.block:getHeight()/2)
end
gc.pop()
gc_pop()
end
function back.discard()
mino=nil

View File

@@ -1,6 +1,9 @@
--Flying cubes
local gc=love.graphics
local rectangle=gc.rectangle
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_rectangle=gc.rectangle
local rnd=math.random
local ins,rem=table.insert,table.remove
local back={}
@@ -61,19 +64,19 @@ function back.update(dt)
end
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc.setLineWidth(6)
gc_clear(.1,.1,.1)
gc_push('transform')
gc_origin()
gc_setLineWidth(6)
for i=1,#squares do
local S=squares[i]
local c=S.color
gc.setColor(c[1],c[2],c[3],.6)
rectangle('line',S.x,S.y,S.size,S.size)
gc.setColor(c)
rectangle('fill',S.x,S.y,S.size,S.size)
gc_setColor(c[1],c[2],c[3],.2)
gc_rectangle('line',S.x,S.y,S.size,S.size)
gc_setColor(c[1],c[2],c[3],.3)
gc_rectangle('fill',S.x,S.y,S.size,S.size)
end
gc.pop()
gc_pop()
end
function back.discard()
squares=nil

View File

@@ -48,23 +48,25 @@ function back.draw()
gc.replaceTransform(SCR.xOy)
gc_translate(640,360+20*sin(t*.02))
gc_clear(.1,.1,.1)
gc_setLineWidth(320)
gc_setColor(.3,.2,.3)
gc_setColor(.9,.6,.9,.1)
gc_arc('line','open',0,420,500,-.8*3.1416,-.2*3.1416)
gc_setLineWidth(4)
gc_setColor(.7,.5,.65)
gc_setColor(1,.7,.9,.2)
gc_arc('line','open',0,420,660,-.799*3.1416,-.201*3.1416)
gc_arc('line','open',0,420,340,-.808*3.1416,-.192*3.1416)
gc_line(-281,224,-530,30.5)
gc_line(281,224,530,30.5)
gc_setLineWidth(6)
gc_setColor(.55,.5,.6)
gc_setColor(.8,.9,1,.3)
for i=1,8 do gc_polygon('line',fan[i])end
gc_setLineWidth(2)
gc_setColor(.6,.3,.5)
gc_setColor(1,.5,.7,.3)
gc_origin()
for i=1,#petal do
local P=petal[i]

View File

@@ -1,6 +1,9 @@
--Firework
local gc=love.graphics
local circle,line=gc.circle,gc.line
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_line,gc_circle=gc.line,gc.circle
local rnd=math.random
local ins,rem=table.insert,table.remove
local back={}
@@ -22,7 +25,7 @@ function back.update(dt)
y1=SCR.h*(.15+rnd()*.4),
t=0,
v=.5+rnd(),
color=COLOR.random_bright(),
color=COLOR.random_dark(),
big=rnd()<.1,
})
t=rnd(26,62)
@@ -75,22 +78,22 @@ function back.update(dt)
end
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc_clear(.1,.1,.1)
gc_push('transform')
gc_origin()
for i=1,#firework do
local F=firework[i]
gc.setColor(F.color)
circle('fill',F.x,F.y,F.big and 8 or 4)
gc_setColor(F.color)
gc_circle('fill',F.x,F.y,F.big and 8 or 4)
end
gc.setLineWidth(3)
gc_setLineWidth(3)
for i=1,#particle do
local P=particle[i]
local c=P.color
gc.setColor(c[1],c[2],c[3],P.t)
line(P.x,P.y,P.x-P.vx*4,P.y-P.vy*4)
gc_setColor(c[1],c[2],c[3],P.t*.4)
gc_line(P.x,P.y,P.x-P.vx*4,P.y-P.vy*4)
end
gc.pop()
gc_pop()
end
function back.discard()
firework=nil

View File

@@ -1,6 +0,0 @@
local gc=love.graphics
local back={}
function back.draw()
gc.clear(.3,.3,.3)
end
return back

View File

@@ -40,7 +40,7 @@ function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc.origin()
gc.setColor(1,1,1)
gc.setColor(1,1,1,.2)
local img=IMG.lanterns
for i=1,#lanterns do
local L=lanterns[i]

View File

@@ -1,6 +0,0 @@
local gc=love.graphics
local back={}
function back.draw()
gc.clear(.95,.95,.95)
end
return back

View File

@@ -1,5 +1,10 @@
--Black-White grid
local gc=love.graphics
local gc_push,gc_pop,gc_clear=gc.push,gc.pop,gc.clear
local gc_scale=gc.scale
local gc_setColor=gc.setColor
local gc_rectangle=gc.rectangle
local sin=math.sin
local ceil=math.ceil
local back={}
@@ -13,17 +18,17 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
gc.push('transform')
gc_clear(.1,.1,.1)
gc_push('transform')
local k=SCR.k
gc.scale(k)
gc_scale(k)
local Y=ceil(SCR.h/80/k)
for x=1,ceil(SCR.w/80/k)do
for y=1,Y do
gc.setColor(1,1,1,sin(x+matrixT[x][y]*t)*.1+.1)
gc.rectangle('fill',80*x,80*y,-80,-80)
gc_setColor(1,1,1,sin(x+matrixT[x][y]*t)*.04+.04)
gc_rectangle('fill',80*x,80*y,-80,-80)
end
end
gc.pop()
gc_pop()
end
return back

View File

@@ -16,6 +16,7 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
shader:send("t",t)
gc.setShader(shader)
gc.rectangle('fill',0,0,SCR.w,SCR.h)

View File

@@ -16,6 +16,7 @@ function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(.1,.1,.1)
shader:send("t",t)
gc.setShader(shader)
gc.rectangle('fill',0,0,SCR.w,SCR.h)

View File

@@ -12,9 +12,9 @@ function back.update(dt)
end
function back.draw()
gc.clear(
sin(t*1.2)*.15+.2,
sin(t*1.5)*.15+.2,
sin(t*1.9)*.15+.2
sin(t*1.2)*.06+.08,
sin(t*1.5)*.06+.08,
sin(t*1.9)*.06+.08
)
end
return back

View File

@@ -38,7 +38,7 @@ function back.update()
end
end
function back.draw()
gc.clear(.2,.2,.2)
gc.clear(.1,.1,.1)
gc.push('transform')
gc.setColor(.7,.7,.7)
gc.origin()

View File

@@ -34,7 +34,7 @@ function back.draw()
gc.clear(.1,.1,.1)
if not stars[1]then return end
gc.translate(-10,-10)
gc.setColor(.8,.8,.8)
gc.setColor(1,1,1,.6)
for i=1,1260,5 do
rectangle('fill',stars[i+1],stars[i+2],stars[i],stars[i])
end

View File

@@ -30,7 +30,7 @@ function back.update(dt)
end
function back.draw()
gc.clear(.1,.1,.1)
gc.setColor(.4,.4,.4)
gc.setColor(1,1,1,.1)
for i=1,#ring do
local r=ring[i]^2/12
gc.setLineWidth(30-15/(r+.5))

View File

@@ -28,11 +28,11 @@ function back.draw()
if -t%12.6<.1626 then
gc.rotate(t+5*sin(.26*t)+5*sin(.626*t))
end
gc.setColor(.2,.3,.5)
gc.setColor(.4,.6,1,.3)
gc.draw(txt,-883*.5+4*sin(t*.7942),-110*.5+4*sin(t*.7355))
gc.setColor(.4,.6,.8)
gc.setColor(.5,.7,1,.4)
gc.draw(txt,-883*.5+2*sin(t*.77023),-110*.5+2*sin(t*.7026))
gc.setColor(.9,.9,.9)
gc.setColor(1,1,1,.5)
gc.draw(txt,-883*.5+3*sin(t*.7283),-110*.5+3*sin(t*.7626))
gc.pop()
end

View File

@@ -3,14 +3,14 @@ local gc=love.graphics
local rnd=math.random
local back={}
local wingColor={
{0., .9, .9,.626},
{.3, 1., .3,.626},
{.9, .9, 0.,.626},
{1., .5, 0.,.626},
{1., .3, .3,.626},
{.5, 0., 1.,.626},
{.3, .3, 1.,.626},
{0., .9, .9,.626},
{0., .9, .9,.26},
{.3, 1., .3,.26},
{.9, .9, 0.,.26},
{1., .5, 0.,.26},
{1., .3, .3,.26},
{.5, 0., 1.,.26},
{.3, .3, 1.,.26},
{0., .9, .9,.26},
}
local bar,crystal
local W,H

View File

@@ -28,7 +28,7 @@ return{
gc.rectangle('fill',0,0,SCR.w,SCR.h)
gc.pop()
else
gc.clear(.26,.26,.26)
gc.clear(.2,.2,.2)
--Frame
gc.setColor(.5,.5,.5)
gc.push('transform')

View File

@@ -36,7 +36,7 @@ function scene.sceneInit()
hit[c],hit[c+1]=rnd(2),rnd(2)
dist[c],dist[c+1]=226,126
end
BG.set('light')
BG.set('none')
BGM.play('dream')
love.keyboard.setKeyRepeat(false)
end
@@ -127,6 +127,7 @@ function scene.update()
end
function scene.draw()
gc.clear(.9,.9,.9)
gc.setColor(0,0,0,1-timer/50)
setFont(80)
mStr(side,640,300)

View File

@@ -1,36 +1,22 @@
local gc=love.graphics
local leagueTitle=DOGC{600,110,
{'setFT',100},
{'origin'},{'shear',-.30,0},{'print',"T",27,-20},
{'origin'},{'shear',-.25,0},{'print',"e",73,-20},
{'origin'},{'shear',-.20,0},{'print',"c",127,-20},
{'origin'},{'shear',-.15,0},{'print',"h",171,-20},
{'origin'},{'shear',-.05,0},{'print',"L",268,-20},
{'origin'},{'shear',.00,0},{'print',"e",313,-20},
{'origin'},{'shear',.05,0},{'print',"a",363,-20},
{'origin'},{'shear',.10,0},{'print',"g",414,-20},
{'origin'},{'shear',.15,0},{'print',"u",466,-20},
{'origin'},{'shear',.20,0},{'print',"e",518,-20},
}
local scene={}
function scene.sceneInit()
BG.set('suitup')
BG.set('league')
BGM.play('exploration')
end
function scene.draw()
mDraw(leagueTitle,640,192,0,1.5)
gc.setColor(1,1,1,.3)
mDraw(leagueTitle,640,200,0,1.51,1.53)
gc.setColor(1,1,1)
setFont(100)
mStr("Tech League",640,120)
drawSelfProfile()
drawOnlinePlayerCount()
end
scene.widgetList={
WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene'setting_game'},
WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=NULL},
WIDGET.newKey{name="match",x=640,y=500,w=760,h=140,font=60,code=function()LOG.print("Coming soon 开发中,敬请期待")end},
WIDGET.newButton{name="back",x=1140,y=640,w=170,h=80,font=40,code=backScene},
}

View File

@@ -38,5 +38,5 @@ vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
V.gb+=vec2(smoothstep(0.626,0.,dx));
dx=1.626*max(max(V.r,V.g),V.b);
return vec4(V/dx,1.);
return vec4(V/dx,0.4);
}

View File

@@ -5,6 +5,6 @@ vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
.8-x*.6,
.3+.2*sin(t),
.15+x*.7,
1.
.4
);
}

View File

@@ -5,6 +5,6 @@ vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
.8-y*.6,
.2+y*.4,
.3+.1*sin(t),
1.
.4
);
}

View File

@@ -6,6 +6,6 @@ vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
.8-y*.7+.2*sin(t/6.26),
.2+y*.5+.15*sin(t/4.),
.2+x*.6-.1*sin(t/2.83),
1.
.4
);
}

View File

@@ -6,6 +6,6 @@ vec4 effect(vec4 color,Image tex,vec2 tex_coords,vec2 scr_coords){
.8-y*.8-.1*sin(t/6.26),
.4+.1*sin(t/4.)*(y+2.)/(y+5.),
abs(.7-x*1.4+y*.5*sin(t/16.)),
1.
.4
);
}