屏幕尺寸相关代码整理,修复部分背景显示不正确
This commit is contained in:
@@ -345,16 +345,18 @@ back.matrix={
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
gc.scale(scr.k)
|
||||
gc.clear(.15,.15,.15)
|
||||
local Y=ceil(scr.H/80)
|
||||
for x=1,ceil(scr.W/80)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.push("transform")
|
||||
local k=scr.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)
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.scale(1/scr.k)
|
||||
gc.pop()
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
@@ -54,23 +54,23 @@ local swap={
|
||||
fade={30,15,function(t)
|
||||
local t=t>15 and 2-t/15 or t/15
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
end},
|
||||
fade_togame={120,20,function(t)
|
||||
local t=t>20 and(120-t)/100 or t/20
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
end},
|
||||
slowFade={180,90,function(t)
|
||||
local t=t>90 and 2-t/90 or t/90
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
end},
|
||||
swipe={30,15,function(t)
|
||||
t=t/30
|
||||
gc.setColor(.1,.1,.1,1-abs(t-.5))
|
||||
t=t*t*(3-2*t)*2-1
|
||||
gc.rectangle("fill",t*scr.W,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",t*scr.w,0,scr.w,scr.h)
|
||||
end},
|
||||
}--Scene swapping animations
|
||||
function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back
|
||||
|
||||
8
main.lua
8
main.lua
@@ -33,7 +33,13 @@ mapCam={
|
||||
zoomMethod=nil,
|
||||
zoomK=nil,
|
||||
}
|
||||
scr={x=0,y=0,w=0,h=0,W=0,H=0,rad=0,k=1}--wid,hei,radius,scale K
|
||||
scr={
|
||||
x=0,y=0,--Up-left Coord on screen
|
||||
w=0,h=0,--Fullscreen w/h in gc
|
||||
W=0,H=0,--Fullscreen w/h in shader
|
||||
rad=0,--Radius
|
||||
k=1,--Scale size
|
||||
}--1280:720-Rect Screen Info
|
||||
|
||||
customSel={1,22,1,1,7,3,1,1,8,4,1,1,1}
|
||||
preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
|
||||
|
||||
@@ -4,7 +4,7 @@ local Timer=love.timer.getTime
|
||||
local int,ceil,abs,rnd,max,min=math.floor,math.ceil,math.abs,math.random,math.max,math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
local format=string.format
|
||||
local scr=scr--Screen camera
|
||||
local scr=scr
|
||||
local setFont=setFont
|
||||
--------------------------<GameData>--------------------------
|
||||
local gameEnv0={
|
||||
|
||||
@@ -1751,7 +1751,7 @@ do--play
|
||||
gc.origin()
|
||||
if restartCount>0 then
|
||||
gc.setColor(0,0,0,restartCount*.05)
|
||||
gc.rectangle("fill",0,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
end
|
||||
if game.warnLVL>0 then
|
||||
gc.setColor(0,0,0,0)
|
||||
@@ -1886,7 +1886,7 @@ do--pause
|
||||
gc.setColor(.15,.15,.15,_)
|
||||
gc.push("transform")
|
||||
gc.origin()
|
||||
gc.rectangle("fill",0,0,scr.W,scr.H)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.pop()
|
||||
|
||||
--Pause Info
|
||||
|
||||
Reference in New Issue
Block a user