升级SCR模块,整理大量坐标系变换代码
This commit is contained in:
@@ -45,12 +45,10 @@ THEME= require"Zframework.theme"
|
||||
local ms,kb=love.mouse,love.keyboard
|
||||
|
||||
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_push,gc_pop,gc_clear=gc.push,gc.pop,gc.clear
|
||||
local gc_replaceTransform,gc_present=gc.replaceTransform,gc.present
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_draw,gc_line=gc.draw,gc.line
|
||||
local gc_print=gc.print
|
||||
local gc_draw,gc_line,gc_print=gc.draw,gc.line,gc.print
|
||||
|
||||
local setFont,mStr=setFont,mStr
|
||||
|
||||
@@ -79,7 +77,7 @@ local function updatePowerInfo()
|
||||
local state,pow=love.system.getPowerInfo()
|
||||
gc.setCanvas(infoCanvas)
|
||||
gc_push('transform')
|
||||
gc_origin()
|
||||
gc.origin()
|
||||
gc_clear(0,0,0,.25)
|
||||
if state~='unknown'then
|
||||
gc_setLineWidth(4)
|
||||
@@ -450,7 +448,7 @@ function love.errorhandler(msg)
|
||||
end
|
||||
gc_clear(.3,.5,.9)
|
||||
gc_push('transform')
|
||||
gc_replaceTransform(xOy)
|
||||
gc_replaceTransform(SCR.xOy)
|
||||
setFont(100)gc_print(":(",100,0,0,1.2)
|
||||
setFont(40)gc.printf(errorMsg,100,160,SCR.w0-100)
|
||||
setFont(20)
|
||||
@@ -572,15 +570,13 @@ function love.run()
|
||||
if FCT>=100 then
|
||||
FCT=FCT-100
|
||||
|
||||
--Draw background
|
||||
BG.draw()
|
||||
|
||||
gc.replaceTransform(xOy)
|
||||
--Draw scene contents
|
||||
gc_replaceTransform(SCR.origin)
|
||||
BG.draw()
|
||||
gc_replaceTransform(SCR.xOy)
|
||||
if SCN.draw then SCN.draw()end
|
||||
|
||||
--Draw widgets
|
||||
WIDGET.draw()
|
||||
SYSFX.draw()
|
||||
TEXT.draw()
|
||||
|
||||
--Draw cursor
|
||||
if mouseShow then
|
||||
@@ -592,52 +588,48 @@ function love.run()
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(ms.isDown(1)and cursor_holdImg or cursorImg,mx,my,nil,nil,nil,8,8)
|
||||
end
|
||||
SYSFX.draw()
|
||||
TEXT.draw()
|
||||
gc_origin()
|
||||
|
||||
--Draw power info.
|
||||
if SETTING.powerInfo then
|
||||
gc_setColor(1,1,1)
|
||||
gc_draw(infoCanvas,SCR.safeX,0,0,SCR.k)
|
||||
end
|
||||
|
||||
--Draw Logs
|
||||
LOG.draw()
|
||||
|
||||
gc_replaceTransform(SCR.origin)
|
||||
--Draw scene swapping animation
|
||||
if SCN.swapping then
|
||||
gc_setColor(1,1,1)
|
||||
_=SCN.stat
|
||||
_.draw(_.time)
|
||||
end
|
||||
|
||||
--Draw Logs
|
||||
LOG.draw()
|
||||
|
||||
gc_replaceTransform(SCR.xOy_dl)
|
||||
--Draw FPS
|
||||
setFont(15)
|
||||
_=SCR.h
|
||||
gc_setColor(1,1,1)
|
||||
gc_print(FPS(),SCR.safeX+5,_-20)
|
||||
gc_print(FPS(),SCR.safeX+5,-20)
|
||||
|
||||
--Debug info.
|
||||
if devMode then
|
||||
--Left-down infos
|
||||
gc_setColor(devColor[devMode])
|
||||
gc_print("MEM "..gcinfo(),SCR.safeX+5,_-40)
|
||||
gc_print("Lines "..FREEROW.getCount(),SCR.safeX+5,_-60)
|
||||
gc_print("Cursor "..int(mx+.5).." "..int(my+.5),SCR.safeX+5,_-80)
|
||||
gc_print("Voices "..VOC.getQueueCount(),SCR.safeX+5,_-100)
|
||||
gc_print("Tasks "..TASK.getCount(),SCR.safeX+5,_-120)
|
||||
gc_print("MEM "..gcinfo(),SCR.safeX+5,-40)
|
||||
gc_print("Lines "..FREEROW.getCount(),SCR.safeX+5,-60)
|
||||
gc_print("Cursor "..int(mx+.5).." "..int(my+.5),SCR.safeX+5,-80)
|
||||
gc_print("Voices "..VOC.getQueueCount(),SCR.safeX+5,-100)
|
||||
gc_print("Tasks "..TASK.getCount(),SCR.safeX+5,-120)
|
||||
|
||||
--Update & draw frame time
|
||||
ins(frameTimeList,1,dt)rem(frameTimeList,126)
|
||||
gc_setColor(1,1,1,.3)
|
||||
for i=1,#frameTimeList do
|
||||
gc.rectangle('fill',150+2*i,_-20,2,-frameTimeList[i]*4000)
|
||||
gc.rectangle('fill',150+2*i,-20,2,-frameTimeList[i]*4000)
|
||||
end
|
||||
|
||||
gc_replaceTransform(SCR.xOy_dr)
|
||||
--Websocket status
|
||||
gc_push('transform')
|
||||
gc_translate(SCR.w,SCR.h)
|
||||
gc_scale(SCR.k)
|
||||
for i=1,5 do
|
||||
local status=WS.status(WSnames[i])
|
||||
gc_setColor(WScolor[i])
|
||||
@@ -657,20 +649,12 @@ function love.run()
|
||||
gc_setColor(0,1,0,t2)gc.rectangle('fill',-40,20*i-100,-20,-20)
|
||||
gc_setColor(1,0,0,t3)gc.rectangle('fill',-20,20*i-100,-20,-20)
|
||||
end
|
||||
gc_pop()
|
||||
|
||||
--Slow devmode
|
||||
if devMode==3 then WAIT(.1)
|
||||
elseif devMode==4 then WAIT(.5)
|
||||
end
|
||||
end
|
||||
gc_translate(SCR.cx,SCR.h)
|
||||
gc_scale(SCR.k)
|
||||
gc_replaceTransform(SCR.xOy_dm)
|
||||
--Draw Version string
|
||||
gc_setColor(.8,.8,.8,.4)
|
||||
setFont(20)
|
||||
mStr(VERSION.string,0,-30)
|
||||
gc_origin()
|
||||
gc_present()
|
||||
|
||||
--SPEED UPUPUP!
|
||||
@@ -689,6 +673,11 @@ function love.run()
|
||||
end
|
||||
end
|
||||
|
||||
--Slow devmode
|
||||
if devMode==3 then WAIT(.1)
|
||||
elseif devMode==4 then WAIT(.5)
|
||||
end
|
||||
|
||||
--Keep 60fps
|
||||
_=TIME()-lastFrame
|
||||
if _<.016 then WAIT(.016-_)end
|
||||
|
||||
@@ -10,7 +10,19 @@ local SCR={
|
||||
rad=0, --Radius
|
||||
k=1, --Scale size
|
||||
dpi=1, --DPI from gc.getDPIScale()
|
||||
xOy=love.math.newTransform(),--Screen transformation object
|
||||
|
||||
--Screen transformation objects
|
||||
origin=love.math.newTransform(),
|
||||
xOy_m=love.math.newTransform(),
|
||||
xOy=love.math.newTransform(),
|
||||
xOy_ul=love.math.newTransform(),
|
||||
xOy_um=love.math.newTransform(),
|
||||
xOy_ur=love.math.newTransform(),
|
||||
xOy_ml=love.math.newTransform(),
|
||||
xOy_mr=love.math.newTransform(),
|
||||
xOy_dl=love.math.newTransform(),
|
||||
xOy_dm=love.math.newTransform(),
|
||||
xOy_dr=love.math.newTransform(),
|
||||
}
|
||||
function SCR.setSize(w,h)
|
||||
SCR.w0,SCR.h0=w,h
|
||||
@@ -32,7 +44,18 @@ function SCR.resize(w,h)
|
||||
SCR.cx,SCR.cy=SCR.w/2,SCR.h/2
|
||||
SCR.ex,SCR.ey=SCR.w-SCR.x,SCR.h-SCR.y
|
||||
SCR.safeX,SCR.safeY,SCR.safeW,SCR.safeH=love.window.getSafeArea()
|
||||
SCR.xOy:setTransformation(w/2,h/2,nil,SCR.k,nil,SCR.w0/2,SCR.h0/2)
|
||||
|
||||
SCR.origin:setTransformation(0,0)
|
||||
SCR.xOy:setTransformation(SCR.x,SCR.y,0,SCR.k)
|
||||
SCR.xOy_m:setTransformation(w/2,h/2,0,SCR.k)
|
||||
SCR.xOy_ul:setTransformation(0,0,0,SCR.k)
|
||||
SCR.xOy_um:setTransformation(w/2,0,0,SCR.k)
|
||||
SCR.xOy_ur:setTransformation(w,0,0,SCR.k)
|
||||
SCR.xOy_ml:setTransformation(0,h/2,0,SCR.k)
|
||||
SCR.xOy_mr:setTransformation(w,h/2,0,SCR.k)
|
||||
SCR.xOy_dl:setTransformation(0,h,0,SCR.k)
|
||||
SCR.xOy_dm:setTransformation(w/2,h,0,SCR.k)
|
||||
SCR.xOy_dr:setTransformation(w,h,0,SCR.k)
|
||||
end
|
||||
function SCR.info()
|
||||
return{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
|
||||
local gc_clear,gc_origin=gc.clear,gc.origin
|
||||
local gc_translate,gc_replaceTransform=gc.translate,gc.replaceTransform
|
||||
local gc_setCanvas,gc_setBlendMode=gc.setCanvas,gc.setBlendMode
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
@@ -828,7 +828,7 @@ function inputBox:getInfo()
|
||||
end
|
||||
function inputBox:press()
|
||||
if MOBILE then
|
||||
local _,y1=SCR.xOy:transformPoint(0,self.y+self.h)
|
||||
local _,y1=xOy:transformPoint(0,self.y+self.h)
|
||||
kb.setTextInput(true,0,y1,1,1)
|
||||
end
|
||||
end
|
||||
@@ -1096,7 +1096,7 @@ function WIDGET.focus(W)
|
||||
if WIDGET.sel and WIDGET.sel.type=='inputBox'then kb.setTextInput(false)end
|
||||
WIDGET.sel=W
|
||||
if W and W.type=='inputBox'then
|
||||
local _,y1=SCR.xOy:transformPoint(0,W.y+W.h)
|
||||
local _,y1=xOy:transformPoint(0,W.y+W.h)
|
||||
kb.setTextInput(true,0,y1,1,1)
|
||||
end
|
||||
end
|
||||
@@ -1261,31 +1261,29 @@ function WIDGET.resize(w,h)
|
||||
widgetCanvas=gc.newCanvas(w,h)
|
||||
end
|
||||
function WIDGET.draw()
|
||||
gc_push('transform')
|
||||
gc_setCanvas(widgetCanvas)
|
||||
gc_clear(0,0,0,0)
|
||||
gc_replaceTransform(xOy)
|
||||
gc_translate(0,-WIDGET.scrollPos)
|
||||
for _,W in next,WIDGET.active do
|
||||
if not W.hide then W:draw()end
|
||||
gc_setCanvas(widgetCanvas)
|
||||
gc_clear(0,0,0,0)
|
||||
gc_translate(0,-WIDGET.scrollPos)
|
||||
for _,W in next,WIDGET.active do
|
||||
if not W.hide then W:draw()end
|
||||
end
|
||||
gc_origin()
|
||||
gc_setColor(1,1,1)
|
||||
if WIDGET.scrollHeight>0 then
|
||||
if WIDGET.scrollPos>0 then
|
||||
gc_draw(upArrowIcon,scr_w*.5,10,0,SCR.k,nil,upArrowIcon:getWidth()*.5,0)
|
||||
end
|
||||
gc_origin()
|
||||
gc_setColor(1,1,1)
|
||||
if WIDGET.scrollHeight>0 then
|
||||
if WIDGET.scrollPos>0 then
|
||||
gc_draw(upArrowIcon,scr_w*.5,10,0,SCR.k,nil,upArrowIcon:getWidth()*.5,0)
|
||||
end
|
||||
if WIDGET.scrollPos<WIDGET.scrollHeight then
|
||||
gc_draw(downArrowIcon,scr_w*.5,scr_h-10,0,SCR.k,nil,downArrowIcon:getWidth()*.5,downArrowIcon:getHeight())
|
||||
end
|
||||
gc_setBlendMode('multiply','premultiplied')
|
||||
gc_draw(widgetCover,nil,nil,nil,scr_w,scr_h/360)
|
||||
if WIDGET.scrollPos<WIDGET.scrollHeight then
|
||||
gc_draw(downArrowIcon,scr_w*.5,scr_h-10,0,SCR.k,nil,downArrowIcon:getWidth()*.5,downArrowIcon:getHeight())
|
||||
end
|
||||
gc_setCanvas()
|
||||
gc_setBlendMode('lighten','premultiplied')
|
||||
gc_draw(widgetCanvas)
|
||||
gc_setBlendMode('alpha')
|
||||
gc_pop()
|
||||
gc_setBlendMode('multiply','premultiplied')
|
||||
gc_draw(widgetCover,nil,nil,nil,scr_w,scr_h/360)
|
||||
end
|
||||
gc_setCanvas()
|
||||
gc_setBlendMode('lighten','premultiplied')
|
||||
gc_draw(widgetCanvas)
|
||||
gc_setBlendMode('alpha')
|
||||
gc_replaceTransform(SCR.xOy)
|
||||
end
|
||||
|
||||
return WIDGET
|
||||
@@ -1,7 +1,6 @@
|
||||
--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_clear,gc_replaceTransform=gc.clear,gc.replaceTransform
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_draw,gc_circle=gc.draw,gc.circle
|
||||
|
||||
@@ -43,9 +42,7 @@ function back.update()
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
gc_push('transform')
|
||||
gc_origin()
|
||||
gc_translate(SCR.cx,SCR.cy)
|
||||
gc_replaceTransform(SCR.xOy_m)
|
||||
|
||||
--Squares
|
||||
gc_setColor(1,1,1,.2)
|
||||
@@ -55,7 +52,6 @@ function back.draw()
|
||||
end
|
||||
|
||||
--Blackhole
|
||||
gc_scale(SCR.rad/1600)
|
||||
gc_setColor(.07,.07,.07)
|
||||
gc_circle('fill',0,0,157)
|
||||
gc_setLineWidth(6)
|
||||
@@ -63,8 +59,6 @@ function back.draw()
|
||||
gc_setColor(.07,.07,.07,1-i*.0666)
|
||||
gc_circle('line',0,0,160+6*i)
|
||||
end
|
||||
gc_scale(1600/SCR.rad)
|
||||
gc_pop()
|
||||
end
|
||||
function back.discard()
|
||||
squares=nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--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_clear=gc.clear
|
||||
local gc_setColor,gc_draw=gc.setColor,gc.draw
|
||||
|
||||
local rnd=math.random
|
||||
@@ -36,8 +36,6 @@ function back.update()
|
||||
end
|
||||
function back.draw()
|
||||
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]
|
||||
@@ -50,7 +48,6 @@ function back.draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
gc_pop()
|
||||
end
|
||||
function back.discard()
|
||||
mino=nil
|
||||
|
||||
@@ -41,15 +41,12 @@ function back.update()
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
for i=1,#mino do
|
||||
local C=mino[i]
|
||||
local c=C.color
|
||||
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()
|
||||
end
|
||||
function back.discard()
|
||||
mino=nil
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--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 gc_clear,gc_translate=gc.clear,gc.translate
|
||||
local gc_setColor,gc_draw=gc.setColor,gc.draw
|
||||
|
||||
local sin,cos=math.sin,math.cos
|
||||
local rnd=math.random
|
||||
@@ -36,14 +36,12 @@ function back.update()
|
||||
rem(mino,i)
|
||||
else
|
||||
M.rotate=M.rotate+M.vr
|
||||
M.v=M.v*(1+M.d/SCR.rad*.05)
|
||||
M.v=M.v*(1+M.d/rad*.05)
|
||||
end
|
||||
end
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
gc_push('transform')
|
||||
gc_origin()
|
||||
gc_translate(SCR.cx,SCR.cy)
|
||||
for i=1,#mino do
|
||||
local M=mino[i]
|
||||
@@ -51,7 +49,7 @@ function back.draw()
|
||||
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_translate(-SCR.cx,-SCR.cy)
|
||||
end
|
||||
function back.discard()
|
||||
mino=nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--Flying cubes
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
|
||||
local gc_clear=gc.clear
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_rectangle=gc.rectangle
|
||||
|
||||
@@ -65,8 +65,6 @@ function back.update(dt)
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
gc_push('transform')
|
||||
gc_origin()
|
||||
gc_setLineWidth(6)
|
||||
for i=1,#squares do
|
||||
local S=squares[i]
|
||||
@@ -76,7 +74,6 @@ function back.draw()
|
||||
gc_setColor(c[1],c[2],c[3],.3)
|
||||
gc_rectangle('fill',S.x,S.y,S.size,S.size)
|
||||
end
|
||||
gc_pop()
|
||||
end
|
||||
function back.discard()
|
||||
squares=nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--UUZ's fan
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
|
||||
local gc_clear,gc_origin,gc_replaceTransform=gc.clear,gc.origin,gc.replaceTransform
|
||||
local gc_translate=gc.translate
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_line,gc_polygon=gc.line,gc.polygon
|
||||
@@ -44,11 +44,11 @@ function back.update()
|
||||
end
|
||||
end
|
||||
function back.draw()
|
||||
gc_push('transform')
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
gc_translate(640,360+20*sin(t*.02))
|
||||
gc_clear(.1,.1,.1)
|
||||
|
||||
gc_replaceTransform(SCR.xOy_m)
|
||||
gc_translate(0,20*sin(t*.02))
|
||||
|
||||
gc_setLineWidth(320)
|
||||
gc_setColor(.9,.6,.9,.1)
|
||||
gc_arc('line','open',0,420,500,-.8*3.1416,-.2*3.1416)
|
||||
@@ -72,7 +72,6 @@ function back.draw()
|
||||
local P=petal[i]
|
||||
gc_ellipse('fill',P.x,P.y,P.rx,P.ry)
|
||||
end
|
||||
gc_pop()
|
||||
end
|
||||
function back.discard()
|
||||
petal=nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--Firework
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin
|
||||
local gc_clear=gc.clear
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_line,gc_circle=gc.line,gc.circle
|
||||
|
||||
@@ -79,8 +79,6 @@ function back.update(dt)
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
gc_push('transform')
|
||||
gc_origin()
|
||||
for i=1,#firework do
|
||||
local F=firework[i]
|
||||
gc_setColor(F.color)
|
||||
@@ -93,7 +91,6 @@ function back.draw()
|
||||
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()
|
||||
end
|
||||
function back.discard()
|
||||
firework=nil
|
||||
|
||||
@@ -38,14 +38,11 @@ function back.update(dt)
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.setColor(1,1,1,.2)
|
||||
local img=IMG.lanterns
|
||||
for i=1,#lanterns do
|
||||
local L=lanterns[i]
|
||||
mDraw(img[int(L.phase*6)+1],L.x,L.y,nil,L.size)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
return back
|
||||
@@ -1,7 +1,6 @@
|
||||
--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_clear,gc_scale=gc.clear,gc.scale
|
||||
local gc_setColor=gc.setColor
|
||||
local gc_rectangle=gc.rectangle
|
||||
|
||||
@@ -19,16 +18,14 @@ function back.update(dt)
|
||||
end
|
||||
function back.draw()
|
||||
gc_clear(.1,.1,.1)
|
||||
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)*.04+.04)
|
||||
gc_rectangle('fill',80*x,80*y,-80,-80)
|
||||
end
|
||||
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)*.04+.04)
|
||||
gc_rectangle('fill',80*x,80*y,-80,-80)
|
||||
end
|
||||
gc_pop()
|
||||
end
|
||||
end
|
||||
return back
|
||||
@@ -39,14 +39,11 @@ function back.update()
|
||||
end
|
||||
function back.draw()
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.push('transform')
|
||||
gc.setColor(.7,.7,.7)
|
||||
gc.origin()
|
||||
for i=1,#snow do
|
||||
local P=snow[i]
|
||||
ellipse('fill',P.x,P.y,P.rx,P.ry)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
function back.discard()
|
||||
snow=nil
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
local gc_push,gc_pop=gc.push,gc.pop
|
||||
local gc_origin,gc_translate=gc.origin,gc.translate
|
||||
local gc_origin,gc_replaceTransform=gc.origin,gc.replaceTransform
|
||||
local gc_setLineWidth,gc_setColor=gc.setLineWidth,gc.setColor
|
||||
local gc_setShader=gc.setShader
|
||||
local gc_draw,gc_rectangle,gc_line,gc_printf=gc.draw,gc.rectangle,gc.line,gc.printf
|
||||
@@ -563,7 +563,7 @@ do--function drawSelfProfile()
|
||||
function drawSelfProfile()
|
||||
local selfAvatar=USERS.getAvatar(USER.uid)
|
||||
gc_push('transform')
|
||||
gc_translate(1280,0)
|
||||
gc_replaceTransform(SCR.xOy_ur)
|
||||
|
||||
--Draw avatar
|
||||
gc_setLineWidth(2)
|
||||
@@ -590,12 +590,13 @@ do--function drawSelfProfile()
|
||||
gc_pop()
|
||||
end
|
||||
end
|
||||
do--function drawOnlinePlayerCount()
|
||||
function drawOnlinePlayerCount()
|
||||
setFont(20)
|
||||
gc_setColor(1,1,1)
|
||||
gc_printf(("%s: %s/%s/%s"):format(text.onlinePlayerCount,NET.UserCount,NET.PlayCount,NET.StreamCount),0,80,1272,'right')
|
||||
end
|
||||
function drawOnlinePlayerCount()
|
||||
setFont(20)
|
||||
gc_setColor(1,1,1)
|
||||
gc_push('transform')
|
||||
gc_replaceTransform(SCR.xOy_ur)
|
||||
gc_printf(("%s: %s/%s/%s"):format(text.onlinePlayerCount,NET.UserCount,NET.PlayCount,NET.StreamCount),-600,80,594,'right')
|
||||
gc_pop()
|
||||
end
|
||||
do--function drawWarning()
|
||||
local shader_warning=SHADER.warning
|
||||
|
||||
@@ -21,23 +21,21 @@ return{
|
||||
end,
|
||||
mesDisp=function(P)
|
||||
if not GAME.result then
|
||||
gc.push('transform')
|
||||
if GAME.replaying then
|
||||
gc.setColor(.3,.3,.3,.7)
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.setColor(.3,.3,.3,.7)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.pop()
|
||||
else
|
||||
gc.clear(.2,.2,.2)
|
||||
--Frame
|
||||
gc.setColor(.5,.5,.5)
|
||||
gc.push('transform')
|
||||
gc.translate(150,0)
|
||||
gc.setColor(.5,.5,.5)
|
||||
--Frame
|
||||
gc.rectangle('line',-1,-11,302,612)--Boarder
|
||||
gc.rectangle('line',301,-3,15,604)--AtkBuffer boarder
|
||||
gc.rectangle('line',-16,-3,15,604)--B2b bar boarder
|
||||
gc.pop()
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
--Figures
|
||||
|
||||
@@ -26,10 +26,9 @@ function scene.draw()
|
||||
|
||||
--Gray screen cover
|
||||
gc.setColor(.15,.15,.15,timer*1.26)
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.pop()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
|
||||
--Pie counter
|
||||
gc.setColor(1,1,1,4*(1-timer))
|
||||
|
||||
@@ -53,13 +53,13 @@ function scene.draw()
|
||||
local t=t1-i*15
|
||||
if t>0 then
|
||||
gc.push('transform')
|
||||
gc.setColor(1,1,1,min(t*.025,1))
|
||||
titleTransform[animeType[i]](t,i)
|
||||
local dt=(t1+62-5*i)%300
|
||||
if dt<20 then
|
||||
gc.translate(0,math.abs(10-dt)-10)
|
||||
end
|
||||
gc.polygon('line',L[i])
|
||||
gc.setColor(1,1,1,min(t*.025,1))
|
||||
titleTransform[animeType[i]](t,i)
|
||||
local dt=(t1+62-5*i)%300
|
||||
if dt<20 then
|
||||
gc.translate(0,math.abs(10-dt)-10)
|
||||
end
|
||||
gc.polygon('line',L[i])
|
||||
gc.pop()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -373,11 +373,10 @@ function scene.draw()
|
||||
|
||||
--Black screen
|
||||
if blackTime>0 or openTime>3 then
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.setColor(0,0,0,blackTime+(openTime-3)*4)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.pop()
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
end
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
@@ -174,10 +174,9 @@ function scene.draw()
|
||||
local _=T
|
||||
if GAME.result then _=_*.7 end
|
||||
gc.setColor(.15,.15,.15,_)
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.pop()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
|
||||
--Pause Info
|
||||
setFont(25)
|
||||
|
||||
@@ -77,8 +77,7 @@ function scene.update(dt)
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.push('transform')
|
||||
gc.origin()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
for i=1,#names do
|
||||
local N=names[i]
|
||||
if type(N.color)=='table'then
|
||||
@@ -88,7 +87,7 @@ function scene.draw()
|
||||
end
|
||||
gc.draw(N.text,N.x,N.y)
|
||||
end
|
||||
gc.pop()
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
|
||||
gc.setColor(1,1,1)
|
||||
local T=40*math.min(time,45)
|
||||
|
||||
Reference in New Issue
Block a user