整理代码,框架更独立
This commit is contained in:
@@ -46,9 +46,6 @@ LIGHT= require'Zframework.light'
|
||||
|
||||
--Love-based modules (complex)
|
||||
GC= require'Zframework.gcExtend'
|
||||
mStr=GC.mStr
|
||||
mText=GC.simpX
|
||||
mDraw=GC.draw
|
||||
FONT= require'Zframework.font'
|
||||
TEXT= require'Zframework.text'
|
||||
SYSFX= require'Zframework.sysFX'
|
||||
|
||||
@@ -18,7 +18,7 @@ local sub,ins,rem=string.sub,table.insert,table.remove
|
||||
local mDraw,mDraw_X,mDraw_Y=GC.draw,GC.simpX,GC.simpY
|
||||
local xOy=SCR.xOy
|
||||
local FONT=FONT
|
||||
local mStr=mStr
|
||||
local mStr=GC.mStr
|
||||
|
||||
local downArrowIcon=GC.DO{40,25,{'fPoly',0,0,20,25,40,0}}
|
||||
local upArrowIcon=GC.DO{40,25,{'fPoly',0,25,20,0,40,25}}
|
||||
|
||||
10
main.lua
10
main.lua
@@ -44,13 +44,17 @@ end
|
||||
|
||||
--Load modules
|
||||
Z=require'Zframework'
|
||||
|
||||
FONT.init('parts/fonts/proportional.ttf')
|
||||
setFont=FONT.set
|
||||
getFont=FONT.get
|
||||
SCR.setSize(1280,720)--Initialize Screen size
|
||||
BGM.setChange(function(name)MES.new('music',text.nowPlaying..name,5)end)
|
||||
|
||||
--Create shortcuts
|
||||
setFont=FONT.set
|
||||
getFont=FONT.get
|
||||
mStr=GC.mStr
|
||||
mText=GC.simpX
|
||||
mDraw=GC.draw
|
||||
|
||||
--Delete all naked files (from too old version)
|
||||
FILE.clear('')
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||
local rnd,min=math.random,math.min
|
||||
local sin,cos=math.sin,math.cos
|
||||
local ins,rem=table.insert,table.remove
|
||||
local setFont=setFont
|
||||
local setFont=FONT.set
|
||||
|
||||
local posLists={
|
||||
--1~5
|
||||
|
||||
@@ -9,7 +9,7 @@ local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||
|
||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,sin,modf=math.max,math.min,math.sin,math.modf
|
||||
local setFont,mDraw,mStr=setFont,mDraw,mStr
|
||||
local setFont,mDraw,mStr=FONT.set,GC.draw,GC.mStr
|
||||
local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG
|
||||
local TEXT,COLOR,GAME,TIME=TEXT,COLOR,GAME,TIME
|
||||
local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter
|
||||
|
||||
@@ -3,7 +3,7 @@ local kb=love.keyboard
|
||||
|
||||
local sin=math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
local setFont=setFont
|
||||
local setFont=FONT.set
|
||||
local gc_setColor,gc_print=gc.setColor,gc.print
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -7,7 +7,7 @@ local sin=math.sin
|
||||
|
||||
local SCR,VK=SCR,VK
|
||||
local GAME,PLAYERS=GAME,PLAYERS
|
||||
local setFont,mStr=setFont,mStr
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
local noTouch,noKey=false,false
|
||||
local touchMoveLastFrame=false
|
||||
|
||||
@@ -8,7 +8,7 @@ local isDown=love.keyboard.isDown
|
||||
|
||||
local int,max,min=math.floor,math.max,math.min
|
||||
|
||||
local mStr=mStr
|
||||
local mStr=GC.mStr
|
||||
|
||||
local scene={}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ local mt=love.math
|
||||
local max,min=math.max,math.min
|
||||
local int,abs=math.floor,math.abs
|
||||
|
||||
local setFont=setFont
|
||||
local setFont=FONT.set
|
||||
|
||||
local mapCam={
|
||||
sel=false,--Selected mode ID
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local gc_setColor,gc_print=gc.setColor,gc.print
|
||||
local sin=math.sin
|
||||
local setFont=setFont
|
||||
local setFont=FONT.set
|
||||
|
||||
local author={
|
||||
blank="MrZ (old works)",
|
||||
|
||||
@@ -3,7 +3,7 @@ local gc,kb,tc=love.graphics,love.keyboard,love.touch
|
||||
local gc_setColor=gc.setColor
|
||||
local gc_print,gc_printf=gc.print,gc.printf
|
||||
local gc_draw=gc.draw
|
||||
local setFont,mStr=setFont,mStr
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
local ins=table.insert
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ local gc=love.graphics
|
||||
local sin,log=math.sin,math.log10
|
||||
|
||||
local GAME,SCR=GAME,SCR
|
||||
local setFont,mStr=setFont,mStr
|
||||
local setFont,mStr=FONT.set,GC.mStr
|
||||
|
||||
local fnsRankColor={
|
||||
Z=COLOR.lY,
|
||||
@@ -214,16 +214,15 @@ function scene.draw()
|
||||
gc.draw(drawableText.modeName,745-drawableText.modeName:getWidth(),143)
|
||||
|
||||
--Level rank
|
||||
if GAME.rank>0 then
|
||||
if RANKCHARS[GAME.rank]then
|
||||
gc.push('transform')
|
||||
gc.translate(1050,5)
|
||||
local str=RANKCHARS[GAME.rank]
|
||||
setFont(80)
|
||||
gc.setColor(0,0,0,timer1*.7)
|
||||
gc.print(str,-5,-4,nil,1.5)
|
||||
gc.print(RANKCHARS[GAME.rank],-5,-4,nil,1.5)
|
||||
local L=rankColor[GAME.rank]
|
||||
gc.setColor(L[1],L[2],L[3],timer1)
|
||||
gc.print(str,0,0,nil,1.5)
|
||||
gc.print(RANKCHARS[GAME.rank],0,0,nil,1.5)
|
||||
gc.pop()
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ local gc_rectangle=gc.rectangle
|
||||
local gc_print,gc_printf=gc.print,gc.printf
|
||||
|
||||
local kb=love.keyboard
|
||||
local setFont=setFont
|
||||
local setFont=FONT.set
|
||||
|
||||
local listBox=WIDGET.newListBox{name="list",x=50,y=50,w=1200,h=520,lineH=40,drawF=function(rep,id,ifSel)
|
||||
if ifSel then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
local mStr=mStr
|
||||
local ins=table.insert
|
||||
local mStr=GC.mStr
|
||||
|
||||
local scene={}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ local gc_draw,gc_line=gc.draw,gc.line
|
||||
local gc_print=gc.print
|
||||
|
||||
local int,sin=math.floor,math.sin
|
||||
local mStr=mStr
|
||||
local mStr=GC.mStr
|
||||
|
||||
local scene={}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user