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