整理代码(修复cc加载失败有时候会报错)
This commit is contained in:
Submodule Zframework updated: 340639f33f...feea6df017
@@ -1,9 +1,9 @@
|
||||
local gc,sys=love.graphics,love.system
|
||||
local sys=love.system
|
||||
local kb=love.keyboard
|
||||
|
||||
local sin=math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
local gc_setColor,gc_print=gc.setColor,gc.print
|
||||
local gc_setColor,gc_print=GC.setColor,GC.print
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -112,12 +112,12 @@ function scene.keyDown(key)
|
||||
end
|
||||
end
|
||||
|
||||
local blockCharWidth={} for i=1,#BLOCK_CHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth() end
|
||||
local blockCharWidth={} for i=1,#BLOCK_CHARS do blockCharWidth[i]=GC.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth() end
|
||||
function scene.draw()
|
||||
-- Draw frame
|
||||
gc_setColor(COLOR.Z)
|
||||
gc.setLineWidth(2)
|
||||
gc.rectangle('line',100,110,1080,260,5)
|
||||
GC.setLineWidth(2)
|
||||
GC.rectangle('line',100,110,1080,260,5)
|
||||
|
||||
-- Draw sequence
|
||||
local BLOCK_COLORS=BLOCK_COLORS
|
||||
@@ -166,7 +166,7 @@ function scene.draw()
|
||||
|
||||
-- Draw cursor
|
||||
gc_setColor(.5,1,.5,.6+.4*sin(TIME()*6.26))
|
||||
gc.line(cx-5,cy-20,cx-5,cy+20)
|
||||
GC.line(cx-5,cy-20,cx-5,cy+20)
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
local gc=love.graphics
|
||||
local sin,log=math.sin,math.log10
|
||||
|
||||
local GAME,SCR=GAME,SCR
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
local sin,log=math.sin,math.log10
|
||||
local GC=GC
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -181,7 +179,7 @@ local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}
|
||||
for i=1,6 do hexList[i]=hexList[i]*150 end
|
||||
local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25}
|
||||
local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
|
||||
local tasText=gc.newText(getFont(100),"TAS")
|
||||
local tasText=GC.newText(getFont(100),"TAS")
|
||||
function scene.draw()
|
||||
if timer1<1 or GAME.result then
|
||||
SCN.scenes.game.draw()
|
||||
@@ -190,157 +188,157 @@ function scene.draw()
|
||||
-- Dark BG
|
||||
local _=timer1
|
||||
if GAME.result then _=_*.76 end
|
||||
gc.setColor(.12,.12,.12,_)
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
GC.setColor(.12,.12,.12,_)
|
||||
GC.replaceTransform(SCR.origin)
|
||||
GC.rectangle('fill',0,0,SCR.w,SCR.h)
|
||||
GC.replaceTransform(SCR.xOy)
|
||||
|
||||
gc.setColor(.97,.97,.97,timer1)
|
||||
GC.setColor(.97,.97,.97,timer1)
|
||||
|
||||
-- Result Text
|
||||
mDraw(GAME.result and TEXTOBJ[GAME.result] or TEXTOBJ.pause,640,70-10*(5-timer1*5)^1.5)
|
||||
|
||||
-- Mode Info (outside)
|
||||
gc.draw(TEXTOBJ.modeName,745-TEXTOBJ.modeName:getWidth(),143)
|
||||
GC.draw(TEXTOBJ.modeName,745-TEXTOBJ.modeName:getWidth(),143)
|
||||
|
||||
-- Level rank
|
||||
if RANK_CHARS[GAME.rank] then
|
||||
gc.push('transform')
|
||||
gc.translate(1050,5)
|
||||
setFont(80)
|
||||
gc.setColor(0,0,0,timer1*.7)
|
||||
gc.print(RANK_CHARS[GAME.rank],-5,-4,nil,1.5)
|
||||
GC.push('transform')
|
||||
GC.translate(1050,5)
|
||||
FONT.set(80)
|
||||
GC.setColor(0,0,0,timer1*.7)
|
||||
GC.print(RANK_CHARS[GAME.rank],-5,-4,nil,1.5)
|
||||
local L=RANK_COLORS[GAME.rank]
|
||||
gc.setColor(L[1],L[2],L[3],timer1)
|
||||
gc.print(RANK_CHARS[GAME.rank],0,0,nil,1.5)
|
||||
gc.pop()
|
||||
GC.setColor(L[1],L[2],L[3],timer1)
|
||||
GC.print(RANK_CHARS[GAME.rank],0,0,nil,1.5)
|
||||
GC.pop()
|
||||
end
|
||||
|
||||
if GAME.tasUsed then
|
||||
gc.setColor(.97,.97,.97,timer1*.08)
|
||||
GC.setColor(.97,.97,.97,timer1*.08)
|
||||
mDraw(tasText,870,395,.3,2.6)
|
||||
end
|
||||
|
||||
-- Big info frame
|
||||
if PLAYERS[1].frameRun>=180 then
|
||||
gc.push('transform')
|
||||
gc.translate(560,205)
|
||||
gc.setLineWidth(2)
|
||||
GC.push('transform')
|
||||
GC.translate(560,205)
|
||||
GC.setLineWidth(2)
|
||||
|
||||
-- Pause Info (outside)
|
||||
setFont(25)
|
||||
FONT.set(25)
|
||||
if GAME.pauseCount>0 then
|
||||
gc.setColor(.97,.97,.97,timer1*.06)
|
||||
gc.rectangle('fill',-5,390,620,36,8)
|
||||
gc.setColor(.97,.97,.97,timer1)
|
||||
gc.rectangle('line',-5,390,620,36,8)
|
||||
mStr(("%s:[%d] %.2fs"):format(text.pauseCount,GAME.pauseCount,GAME.pauseTime),305,389)
|
||||
GC.setColor(.97,.97,.97,timer1*.06)
|
||||
GC.rectangle('fill',-5,390,620,36,8)
|
||||
GC.setColor(.97,.97,.97,timer1)
|
||||
GC.rectangle('line',-5,390,620,36,8)
|
||||
GC.mStr(("%s:[%d] %.2fs"):format(text.pauseCount,GAME.pauseCount,GAME.pauseTime),305,389)
|
||||
end
|
||||
|
||||
-- Pages
|
||||
if page==0 then
|
||||
-- Frame
|
||||
gc.setColor(.97,.97,.97,timer2*.06)
|
||||
gc.rectangle('fill',-5,-5,620,380,8)
|
||||
gc.setColor(.97,.97,.97,timer2)
|
||||
gc.rectangle('line',-5,-5,620,380,8)
|
||||
GC.setColor(.97,.97,.97,timer2*.06)
|
||||
GC.rectangle('fill',-5,-5,620,380,8)
|
||||
GC.setColor(.97,.97,.97,timer2)
|
||||
GC.rectangle('line',-5,-5,620,380,8)
|
||||
|
||||
-- Game statistics
|
||||
gc.push('transform')
|
||||
gc.scale(.85)
|
||||
gc.setLineWidth(2)
|
||||
GC.push('transform')
|
||||
GC.scale(.85)
|
||||
GC.setLineWidth(2)
|
||||
|
||||
-- Stats
|
||||
_=form
|
||||
setFont(30)
|
||||
gc.setColor(.97,.97,.97,timer2)
|
||||
FONT.set(30)
|
||||
GC.setColor(.97,.97,.97,timer2)
|
||||
for i=1,10 do
|
||||
gc.print(text.pauseStat[i],5,43*(i-1)+2)
|
||||
gc.printf(_[i],210,43*(i-1)+2,500,'right')
|
||||
GC.print(text.pauseStat[i],5,43*(i-1)+2)
|
||||
GC.printf(_[i],210,43*(i-1)+2,500,'right')
|
||||
end
|
||||
|
||||
-- Finesse rank & trophy
|
||||
if rank then
|
||||
setFont(40)
|
||||
gc.setColor(.7,.7,.7,timer2)
|
||||
gc.print(rank,405,383)
|
||||
FONT.set(40)
|
||||
GC.setColor(.7,.7,.7,timer2)
|
||||
GC.print(rank,405,383)
|
||||
if trophy then
|
||||
setFont(30)
|
||||
gc.setColor(trophyColor[1],trophyColor[2],trophyColor[3],timer2*2-1)
|
||||
gc.printf(trophy,95-120*(1-timer2^.5),390,300,'right')
|
||||
FONT.set(30)
|
||||
GC.setColor(trophyColor[1],trophyColor[2],trophyColor[3],timer2*2-1)
|
||||
GC.printf(trophy,95-120*(1-timer2^.5),390,300,'right')
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
GC.pop()
|
||||
elseif page==1 then
|
||||
-- Radar Chart
|
||||
gc.setLineWidth(1)
|
||||
gc.push('transform')
|
||||
gc.translate(310,185)
|
||||
GC.setLineWidth(1)
|
||||
GC.push('transform')
|
||||
GC.translate(310,185)
|
||||
|
||||
-- Polygon
|
||||
gc.push('transform')
|
||||
gc.scale((3-2*timer2)*timer2)
|
||||
gc.setColor(.97,.97,.97,timer2*(.5+.3*sin(TIME()*6.26)))
|
||||
GC.push('transform')
|
||||
GC.scale((3-2*timer2)*timer2)
|
||||
GC.setColor(.97,.97,.97,timer2*(.5+.3*sin(TIME()*6.26)))
|
||||
GC.regRoundPolygon('line',0,0,120,6,8)
|
||||
gc.setColor(chartColor[1],chartColor[2],chartColor[3],timer2*.626)
|
||||
GC.setColor(chartColor[1],chartColor[2],chartColor[3],timer2*.626)
|
||||
for i=1,9,2 do
|
||||
gc.polygon('fill',0,0,val[i],val[i+1],val[i+2],val[i+3])
|
||||
GC.polygon('fill',0,0,val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.polygon('fill',0,0,val[11],val[12],val[1],val[2])
|
||||
gc.setColor(.97,.97,.97,timer2)
|
||||
GC.polygon('fill',0,0,val[11],val[12],val[1],val[2])
|
||||
GC.setColor(.97,.97,.97,timer2)
|
||||
for i=1,9,2 do
|
||||
gc.line(val[i],val[i+1],val[i+2],val[i+3])
|
||||
GC.line(val[i],val[i+1],val[i+2],val[i+3])
|
||||
end
|
||||
gc.line(val[11],val[12],val[1],val[2])
|
||||
gc.pop()
|
||||
GC.line(val[11],val[12],val[1],val[2])
|
||||
GC.pop()
|
||||
|
||||
-- Texts
|
||||
local C
|
||||
_=TIME()%6.2832
|
||||
if _>3.142 then
|
||||
gc.setColor(.97,.97,.97,-timer2*sin(_))
|
||||
setFont(35)
|
||||
GC.setColor(.97,.97,.97,-timer2*sin(_))
|
||||
FONT.set(35)
|
||||
C,_=text.radar,textPos
|
||||
else
|
||||
gc.setColor(.97,.97,.97,timer2*sin(_))
|
||||
setFont(20)
|
||||
GC.setColor(.97,.97,.97,timer2*sin(_))
|
||||
FONT.set(20)
|
||||
C,_=radar,dataPos
|
||||
end
|
||||
for i=1,6 do
|
||||
mStr(C[i],_[2*i-1],_[2*i])
|
||||
GC.mStr(C[i],_[2*i-1],_[2*i])
|
||||
end
|
||||
gc.pop()
|
||||
GC.pop()
|
||||
end
|
||||
gc.pop()
|
||||
GC.pop()
|
||||
end
|
||||
|
||||
-- Mods
|
||||
gc.push('transform')
|
||||
gc.translate(131,600)
|
||||
gc.scale(.65)
|
||||
GC.push('transform')
|
||||
GC.translate(131,600)
|
||||
GC.scale(.65)
|
||||
if #GAME.mod>0 then
|
||||
gc.setLineWidth(2)
|
||||
GC.setLineWidth(2)
|
||||
if scoreValid() then
|
||||
gc.setColor(.7,.7,.7,timer1)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(.7,.7,.7,timer1*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
GC.setColor(.7,.7,.7,timer1)
|
||||
GC.rectangle('line',-5,-5,500,150,8)
|
||||
GC.setColor(.7,.7,.7,timer1*.05)
|
||||
GC.rectangle('fill',-5,-5,500,150,8)
|
||||
else
|
||||
gc.setColor(.8,0,0,timer1)
|
||||
gc.rectangle('line',-5,-5,500,150,8)
|
||||
gc.setColor(1,0,0,timer1*.05)
|
||||
gc.rectangle('fill',-5,-5,500,150,8)
|
||||
GC.setColor(.8,0,0,timer1)
|
||||
GC.rectangle('line',-5,-5,500,150,8)
|
||||
GC.setColor(1,0,0,timer1*.05)
|
||||
GC.rectangle('fill',-5,-5,500,150,8)
|
||||
end
|
||||
setFont(35)
|
||||
FONT.set(35)
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel>0 then
|
||||
_=M.color
|
||||
gc.setColor(_[1],_[2],_[3],timer1)
|
||||
mStr(M.id,35+M.no%8*60,math.floor(M.no/8)*45)
|
||||
GC.setColor(_[1],_[2],_[3],timer1)
|
||||
GC.mStr(M.id,35+M.no%8*60,math.floor(M.no/8)*45)
|
||||
end
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
GC.pop()
|
||||
end
|
||||
|
||||
scene.widgetList={
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
local gc=love.graphics
|
||||
local kb,tc=love.keyboard,love.touch
|
||||
local rnd=math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
@@ -50,7 +49,7 @@ function scene.update(dt)
|
||||
counter=counter-1
|
||||
if counter==0 then
|
||||
local N=patron[rnd(#patron)]
|
||||
local T=gc.newText(getFont(N.font),N.name)
|
||||
local T=GC.newText(getFont(N.font),N.name)
|
||||
local r=rnd()<.5
|
||||
ins(names,{
|
||||
text=T,
|
||||
@@ -71,26 +70,26 @@ function scene.update(dt)
|
||||
end
|
||||
|
||||
function scene.draw()
|
||||
gc.replaceTransform(SCR.origin)
|
||||
gc.setColor(1,1,1,.3)
|
||||
GC.replaceTransform(SCR.origin)
|
||||
GC.setColor(1,1,1,.3)
|
||||
for i=1,#names do
|
||||
local N=names[i]
|
||||
gc.draw(N.text,N.x,N.y)
|
||||
GC.draw(N.text,N.x,N.y)
|
||||
end
|
||||
|
||||
gc.replaceTransform(SCR.xOy)
|
||||
GC.replaceTransform(SCR.xOy)
|
||||
local T=40*math.min(time,185)
|
||||
gc.setColor(.97,.97,.97,185-math.min(time,185))
|
||||
GC.setColor(.97,.97,.97,185-math.min(time,185))
|
||||
local L=text.staff
|
||||
setFont(40)
|
||||
for i=1,#L do
|
||||
GC.mStr(L[i],640,950+65*i-T)
|
||||
end
|
||||
gc.setColor(1,1,1)
|
||||
GC.setColor(1,1,1)
|
||||
mDraw(TEXTURE.title_color,640,900-T,nil,.6)
|
||||
mDraw(TEXTURE.title,640,7770-T,nil,.6)
|
||||
if time>190 then
|
||||
gc.print("CLICK ME →",50,550,-.5)
|
||||
GC.print("CLICK ME →",50,550,-.5)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user