Skip to content

Commit 14f26f3

Browse files
committed
框架跟进
1 parent 24a480e commit 14f26f3

File tree

15 files changed

+183
-125
lines changed

15 files changed

+183
-125
lines changed

assets/gameFuncs.lua

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function sureCheck(event)
1212
if love.timer.getTime()-lastTime[event]<1 then
1313
return true
1414
else
15-
MSG.new('info',Text.sureText[event])
15+
MSG('info',Text.sureText[event])
1616
end
1717
lastTime[event]=love.timer.getTime()
1818
end
@@ -26,17 +26,17 @@ do-- function loadFile(name,args)
2626
return mes
2727
else
2828
if mes:find'open error' then
29-
MSG.new('error',text.loadError_open:repD(name,""))
29+
MSG('error',text.loadError_open:repD(name,""))
3030
elseif mes:find'unknown mode' then
31-
MSG.new('error',text.loadError_errorMode:repD(name,args))
31+
MSG('error',text.loadError_errorMode:repD(name,args))
3232
elseif mes:find'no file' then
3333
if not args:sArg'-canSkip' then
34-
MSG.new('error',text.loadError_noFile:repD(name,""))
34+
MSG('error',text.loadError_noFile:repD(name,""))
3535
end
3636
elseif mes then
37-
MSG.new('error',text.loadError_other:repD(name,mes))
37+
MSG('error',text.loadError_other:repD(name,mes))
3838
else
39-
MSG.new('error',text.loadError_unknown:repD(name,""))
39+
MSG('error',text.loadError_unknown:repD(name,""))
4040
end
4141
end
4242
end
@@ -49,7 +49,7 @@ do-- function saveFile(data,name,args)
4949
if res then
5050
return mes
5151
else
52-
MSG.new('error',
52+
MSG('error',
5353
mes:find'duplicate' and
5454
text.saveError_duplicate:repD(name) or
5555
mes:find'encode error' and
@@ -69,13 +69,13 @@ function saveSettings()
6969
end
7070
function applyFPS(inGame)
7171
if inGame then
72-
ZENITHA.setMaxFPS(SETTINGS.maxFPS)
73-
ZENITHA.setUpdateFreq(SETTINGS.updRate)
74-
ZENITHA.setDrawFreq(SETTINGS.drawRate)
72+
ZENITHA.setMainLoopSpeed(SETTINGS.maxFPS)
73+
ZENITHA.setUpdateRate(SETTINGS.updRate)
74+
ZENITHA.setRenderRate(SETTINGS.drawRate)
7575
else
76-
ZENITHA.setMaxFPS(math.min(SETTINGS.maxFPS,90))
77-
ZENITHA.setUpdateFreq(100)
78-
ZENITHA.setDrawFreq(100)
76+
ZENITHA.setMainLoopSpeed(math.min(SETTINGS.maxFPS,90))
77+
ZENITHA.setUpdateRate(100)
78+
ZENITHA.setRenderRate(100)
7979
end
8080
end
8181
function applyClickFX(flag)

assets/gameTables.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ do
8585
end,
8686
},
8787

88-
message=function(mes,time) MSG.new('info',mes,time or 3) end,
88+
message=function(mes,time) MSG('info',mes,time or 3) end,
8989
-- sfx=function(name,vol,pos,pitch) SFX.play(name,vol,pos,pitch) end,
9090
}
9191
for _,v in next,{
@@ -265,9 +265,9 @@ do-- Userdata tables
265265

266266
-- Video
267267
fullscreen= function(v) love.window.setFullscreen(v) love.resize(love.graphics.getWidth(),love.graphics.getHeight()) end,
268-
maxFPS= function(v) ZENITHA.setMaxFPS(v) end,
269-
updRate= function(v) ZENITHA.setUpdateFreq(v) end,
270-
drawRate= function(v) ZENITHA.setDrawFreq(v) end,
268+
maxFPS= function(v) ZENITHA.setMainLoopSpeed(v) end,
269+
updRate= function(v) ZENITHA.setUpdateRate(v) end,
270+
drawRate= function(v) ZENITHA.setRenderRate(v) end,
271271
sysCursor= function(v) love.mouse.setVisible(v) end,
272272
clickFX= function(v) applyClickFX(v) end,
273273
clean= function(v) ZENITHA.setCleanCanvas(v) end,

assets/scene/error.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ function scene.draw()
3434
end
3535

3636
scene.widgetList={
37-
WIDGET.new{type='button',x=940,y=640,w=170,h=80,sound_press='key',fontSize=65,text=CHAR.icon.console,code=WIDGET.c_goScn'_console'},
38-
WIDGET.new{type='button',x=1140,y=640,w=170,h=80,sound_press='key',fontSize=40,text=CHAR.icon.cross_big,code=love.event.quit},
37+
WIDGET.new{type='button',x=940,y=640,w=170,h=80,sound_press='key',fontSize=65,text=CHAR.icon.console,onClick=WIDGET.c_goScn'_console'},
38+
WIDGET.new{type='button',x=1140,y=640,w=170,h=80,sound_press='key',fontSize=40,text=CHAR.icon.cross_big,onClick=love.event.quit},
3939
}
4040

4141
return scene

assets/scene/game.lua

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ local trackNames=trackNames
2626
local getHitLV=getHitLV
2727
local function _showVolMes(v)
2828
needSaveSetting=true
29-
MSG.new('info',('$1%'):repD(('%d'):format(v*100)),0)
29+
MSG('info',('$1%'):repD(('%d'):format(v*100)),0)
3030
end
3131

3232
local autoPlayTextObj
@@ -66,7 +66,7 @@ local game={
6666

6767
touches={},
6868
hitParticles=(function()
69-
local p=gc.newParticleSystem(GC.load{1,1,{'clear',1,1,1,.6}},1000)
69+
local p=gc.newParticleSystem(GC.load{w=1,h=1,{'clear',1,1,1,.6}},1000)
7070
p:setColors(1,1,1,1,1,1,1,.26,1,1,1,0)
7171
p:setSizes(10,4,2,1)
7272
p:setParticleLifetime(.5,1)
@@ -96,9 +96,9 @@ local function _tryGoResult()
9696
if game.needSaveSetting then saveSettings() end
9797
if game.fullAcc>0 and game.curAcc/game.fullAcc>=.6 then
9898
_updateStat()
99-
MSG.new('check',Text.validScore:repD(os.date('%Y-%m-%d %H:%M')),6.26)
99+
MSG('check',Text.validScore:repD(os.date('%Y-%m-%d %H:%M')),6.26)
100100
else
101-
MSG.new('info',Text.invalidScore)
101+
MSG('info',Text.invalidScore)
102102
end
103103
applyClickFX(SET.clickFX)
104104
SCN.swapTo('result',nil,{
@@ -148,8 +148,8 @@ local function callScriptEvent(event,...)
148148
if love.timer.getTime()-lastErrorTime[event]>=0.626 then
149149
lastErrorTime[event]=love.timer.getTime()
150150
err=err:gsub('%b[]:','')
151-
MSG.new('error',("<$1>$2:$3"):repD(event,err:match('^%d+'),err:sub(err:find(':')+1)))
152-
-- MSG.new('error',err)
151+
MSG('error',("<$1>$2:$3"):repD(event,err:match('^%d+'),err:sub(err:find(':')+1)))
152+
-- MSG('error',err)
153153
end
154154
end
155155
end
@@ -212,7 +212,7 @@ function scene.load()
212212
if love.filesystem.getInfo(dirPath..game.map.songFile) then
213213
BGM.load(game.map.qbpFilePath,dirPath..game.map.songFile)
214214
elseif game.map.songFile~="[songFile]" then
215-
MSG.new('error',"<file>"..Text.noFile)
215+
MSG('error',"<file>"..Text.noFile)
216216
end
217217
BGM.play(game.map.qbpFilePath,'-preLoad')
218218

@@ -233,14 +233,14 @@ function scene.load()
233233
local _
234234
_,err=pcall(func)
235235
if err then
236-
MSG.new('error',"<firstrun>"..err)
236+
MSG('error',"<firstrun>"..err)
237237
end
238238
else
239239
err=err:gsub('%b[]:','')
240-
MSG.new('error',("<syntax>$1:$2"):repD(err:match('^%d+'),err:sub(err:find(':')+1)))
240+
MSG('error',("<syntax>$1:$2"):repD(err:match('^%d+'),err:sub(err:find(':')+1)))
241241
end
242242
else
243-
MSG.new('error',"<file>"..Text.noFile)
243+
MSG('error',"<file>"..Text.noFile)
244244
end
245245
end
246246
callScriptEvent('init')
@@ -252,7 +252,7 @@ function scene.load()
252252
local success
253253
success,image=pcall(gc.newImage,dirPath..game.map.songImage)
254254
if not success then
255-
MSG.new('error',"<file>"..Text.noFile)
255+
MSG('error',"<file>"..Text.noFile)
256256
image=nil
257257
end
258258
end
@@ -379,7 +379,7 @@ function scene.keyDown(key,isRep)
379379
BGM.stop()
380380
scene.load()
381381
else
382-
MSG.new('error',errmsg)
382+
MSG('error',errmsg)
383383
end
384384
elseif k=='sfxVolDn' then SET.sfxVol=max(SET.sfxVol-.1,0);_showVolMes(SET.sfxVol)
385385
elseif k=='sfxVolUp' then SET.sfxVol=min(SET.sfxVol+.1,1);_showVolMes(SET.sfxVol)
@@ -388,18 +388,18 @@ function scene.keyDown(key,isRep)
388388
elseif k=='dropSpdDn' then
389389
if game.score0==0 or game.curAcc==-1e99 then
390390
SET.dropSpeed=max(SET.dropSpeed-1,-8)
391-
MSG.new('info',Text.dropSpeedChanged:repD(SET.dropSpeed),0)
391+
MSG('info',Text.dropSpeedChanged:repD(SET.dropSpeed),0)
392392
game.needSaveSetting=true
393393
else
394-
MSG.new('warn',Text.cannotAdjustDropSpeed,0)
394+
MSG('warn',Text.cannotAdjustDropSpeed,0)
395395
end
396396
elseif k=='dropSpdUp' then
397397
if game.score0==0 or game.curAcc==-1e99 then
398398
SET.dropSpeed=min(SET.dropSpeed+1,8)
399-
MSG.new('info',Text.dropSpeedChanged:repD(SET.dropSpeed),0)
399+
MSG('info',Text.dropSpeedChanged:repD(SET.dropSpeed),0)
400400
game.needSaveSetting=true
401401
else
402-
MSG.new('warn',Text.cannotAdjustDropSpeed,0)
402+
MSG('warn',Text.cannotAdjustDropSpeed,0)
403403
end
404404
elseif k=='escape' then
405405
if _tryGoResult() then
@@ -709,9 +709,9 @@ function scene.draw()
709709
setFont(50,'mono')
710710
if game.bestChain==5 then
711711
SCC[3]=(1-game.time/game.songLength)^.26
712-
GC.shadedPrint(game.combo,0,0,'center',1,8,chainColors[game.bestChain],SCC)
712+
GC.strokePrint('full',1,chainColors[game.bestChain],SCC,game.combo,0,0,nil,'center')
713713
else
714-
GC.shadedPrint(game.combo,0,0,'center',1,8,chainColors[game.bestChain],COLOR.L)
714+
GC.strokePrint('full',1,chainColors[game.bestChain],COLOR.L,game.combo,0,0,nil,'center')
715715
end
716716
end
717717

@@ -748,8 +748,8 @@ function scene.draw()
748748
gc_setColor(1,1,1,a)
749749
gc_draw(game.texts.mapName,0,-260,nil,min(1200/game.texts.mapName:getWidth(),1),1,game.texts.mapName:getWidth()*.5)
750750
gc_setColor(.7,.7,.7,a)
751-
GC.mDrawX(game.texts.musicAuth,0,-160)
752-
GC.mDrawX(game.texts.mapAuth,0,-120)
751+
GC.draw(game.texts.musicAuth,-game.texts.musicAuth:getWidth()/2,-160)
752+
GC.draw(game.texts.mapAuth,-game.texts.mapAuth:getWidth()/2,-120)
753753
end
754754

755755
gc_setColor(1,1,1)
@@ -777,7 +777,7 @@ function scene.draw()
777777
end
778778

779779
scene.widgetList={
780-
WIDGET.new{type='button',pos={0,0},x=40,y=60,w=50, sound_press='back',text=CHAR.icon.back,code=WIDGET.c_backScn()},
781-
WIDGET.new{type='button',pos={0,0},x=100,y=60,w=50,sound_press='key',text=CHAR.icon.retry,code=WIDGET.c_pressKey'restart'},
780+
WIDGET.new{type='button',pos={0,0},x=40,y=60,w=50, sound_press='back',text=CHAR.icon.back,onClick=WIDGET.c_backScn()},
781+
WIDGET.new{type='button',pos={0,0},x=100,y=60,w=50,sound_press='key',text=CHAR.icon.retry,onClick=WIDGET.c_pressKey'restart'},
782782
}
783783
return scene

assets/scene/lang.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ local function _setLang(lid)
5858
end
5959

6060
scene.widgetList={
61-
WIDGET.new{type='button_fill',x=270,y=210,w=330,h=100,fontSize=40, text=langList.en, color='R', sound_press='check',code=function() _setLang('en') end},
61+
WIDGET.new{type='button_fill',x=270,y=210,w=330,h=100,fontSize=40, text=langList.en, color='R', sound_press='check',onClick=function() _setLang('en') end},
6262
WIDGET.new{type='button' ,x=270,y=330,w=330,h=100,fontSize=40, text='', color='F', sound_press='check'},
6363
WIDGET.new{type='button' ,x=270,y=450,w=330,h=100,fontSize=35, text='', color='O', sound_press='check'},
6464
WIDGET.new{type='button' ,x=270,y=570,w=330,h=100,fontSize=35, text='', color='Y', sound_press='check'},
@@ -68,11 +68,11 @@ scene.widgetList={
6868
WIDGET.new{type='button' ,x=640,y=450,w=330,h=100,fontSize=40, text='', color='G', sound_press='check'},
6969
WIDGET.new{type='button' ,x=640,y=570,w=330,h=100,fontSize=40, text='', color='J', sound_press='check'},
7070

71-
WIDGET.new{type='button_fill',x=1000,y=210,w=330,h=100,fontSize=40,text=langList.zh, color='I', sound_press='check',code=function() _setLang('zh') end},
71+
WIDGET.new{type='button_fill',x=1000,y=210,w=330,h=100,fontSize=40,text=langList.zh, color='I', sound_press='check',onClick=function() _setLang('zh') end},
7272
WIDGET.new{type='button' ,x=1000,y=330,w=330,h=100,fontSize=40,text='', color='B', sound_press='check'},
7373
WIDGET.new{type='button' ,x=1000,y=450,w=330,h=100,fontSize=40,text='', color='P', sound_press='check'},
7474

75-
WIDGET.new{type='button_fill',x=1000,y=570,w=330,h=100,sound_press='back',fontSize=60,text=CHAR.icon.back,code=WIDGET.c_backScn()},
75+
WIDGET.new{type='button_fill',x=1000,y=570,w=330,h=100,sound_press='back',fontSize=60,text=CHAR.icon.back,onClick=WIDGET.c_backScn()},
7676
}
7777

7878
return scene

assets/scene/load.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ local logoColor1,logoColor2
88
local loadingThread=coroutine.wrap(function()
99
BG.setDefault(MOBILE and 'space' or 'galaxy')
1010
BG.set()
11-
BGM.play()
11+
BGM.play('title')
1212
coroutine.yield('loadVoice')VOC.load('assets/vocal/')
1313
coroutine.yield('loadFont') for i=1,17 do FONT.get(15+5*i) end
1414

assets/scene/main.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local fool=os.date("%m%d")=="0401"
66

77
function scene.load()
88
BG.set()
9-
BGM.play()
9+
BGM.play('title')
1010
end
1111

1212
function scene.keyDown(key)
@@ -27,21 +27,21 @@ function scene.draw()
2727
GC.line(260,160,1010,260)
2828
GC.setColor(1,1,1)
2929
FONT.set(150,'_basic')
30-
GC.shadedPrint("Techmino",640,130,'center',6,8)
30+
GC.strokePrint('full',4,COLOR.D,COLOR.L,"Techmino",640,130,nil,'center')
3131
GC.translate(860,260)
3232
GC.rotate(-.0626)
3333
FONT.set(70,'_basic')
34-
GC.shadedPrint("Galaxy",0,0,'center',4,8)
34+
GC.strokePrint('full',3,COLOR.D,COLOR.L,"Galaxy",0,0,nil,'center')
3535
end
3636
end
3737

3838
scene.widgetList={
39-
WIDGET.new{type='button_fill',x=200,y=80,w=100, color='lI',fontSize=70,text=CHAR.icon.language, code=WIDGET.c_goScn'lang'},
40-
WIDGET.new{type='button_fill',x=240,y=450,w=280,h=120, color="lR",fontSize=45,text=LANG'main_play', code=WIDGET.c_goScn'mapSelect'},
41-
WIDGET.new{type='button_fill',x=640,y=450,w=280,h=120, color="lB",fontSize=45,text=LANG'main_setting', code=WIDGET.c_goScn'setting'},
42-
WIDGET.new{type='button_fill',x=240,y=600,w=95, color="lY",fontSize=70,text=CHAR.icon.info_circ, code=WIDGET.c_goScn'stat'},
43-
WIDGET.new{type='button_fill',x=1040,y=450,w=280,h=120,color="D",fontSize=45,text=LANG'main_editor', code=function() MSG.new('info',"Coming soon",1.26) tryCounter=(tryCounter+1)%12 if tryCounter==0 then SCN.go('_console') end end},
44-
WIDGET.new{type='button_fill',x=1040,y=600,w=95, color="G",fontSize=70,text=CHAR.icon.zictionary, code=function() love.system.openURL("https://github.com/26F-Studio/Quatrack/wiki/beatmap") end},
39+
WIDGET.new{type='button_fill',x=200,y=80,w=100, color='lI',fontSize=70,text=CHAR.icon.language, onClick=WIDGET.c_goScn'lang'},
40+
WIDGET.new{type='button_fill',x=240,y=450,w=280,h=120, color="lR",fontSize=45,text=LANG'main_play', onClick=WIDGET.c_goScn'mapSelect'},
41+
WIDGET.new{type='button_fill',x=640,y=450,w=280,h=120, color="lB",fontSize=45,text=LANG'main_setting', onClick=WIDGET.c_goScn'setting'},
42+
WIDGET.new{type='button_fill',x=240,y=600,w=95, color="lY",fontSize=70,text=CHAR.icon.info_circ, onClick=WIDGET.c_goScn'stat'},
43+
WIDGET.new{type='button_fill',x=1040,y=450,w=280,h=120,color="D",fontSize=45,text=LANG'main_editor', onClick=function() MSG('info',"Coming soon",1.26) tryCounter=(tryCounter+1)%12 if tryCounter==0 then SCN.go('_console') end end},
44+
WIDGET.new{type='button_fill',x=1040,y=600,w=95, color="G",fontSize=70,text=CHAR.icon.zictionary, onClick=function() love.system.openURL("https://github.com/26F-Studio/Quatrack/wiki/beatmap") end},
4545
}
4646

4747
return scene

assets/scene/mapSelect.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ local function _freshSongList()
102102
end
103103
local sortSelector=WIDGET.new{type='selector',pos={.5,1},x=240,y=-100,w=240,text=LANG'mapSelect_sortMode',
104104
labelPos='bottom',
105-
labelDistance=30,
105+
labelDist=30,
106106
list={'difficulty','name'},
107107
fontSize=20,
108108
selFontSize=35,
@@ -119,7 +119,7 @@ local sortSelector=WIDGET.new{type='selector',pos={.5,1},x=240,y=-100,w=240,text
119119
function scene.load()
120120
if not mapLoaded then _freshSongList() end
121121
BG.set()
122-
BGM.play()
122+
BGM.play('title')
123123
end
124124
function scene.keyDown(key,isRep)
125125
if key=='return' then
@@ -128,7 +128,7 @@ function scene.keyDown(key,isRep)
128128
SFX.play('enter')
129129
SCN.go('game',nil,map)
130130
else
131-
MSG.new('error',errmsg)
131+
MSG('error',errmsg)
132132
end
133133
elseif key=='tab' then
134134
if isRep then return true end
@@ -166,17 +166,17 @@ end
166166
scene.widgetList={
167167
listBox,
168168
WIDGET.new{type='button_fill',pos={0,1},x=160,y=-80,w=200,h=80,text=CHAR.icon.download,color='lV',fontSize=60,
169-
code=function()
169+
onClick=function()
170170
if not MOBILE then
171171
love.system.openURL(love.filesystem.getSaveDirectory()..'/songs')
172172
else
173-
MSG.new('info',love.filesystem.getSaveDirectory())
173+
MSG('info',love.filesystem.getSaveDirectory())
174174
end
175175
end
176176
},
177-
WIDGET.new{type='button_fill',pos={0,1},x=320,y=-80,w=80,text=CHAR.icon.retry,color='lB',fontSize=50,code=_freshSongList,visibleFunc=function() return love.timer.getTime()-lastFreshTime>2.6 end},
178-
WIDGET.new{type='button_fill',pos={.5,1},y=-80,w=140,h=80,text=CHAR.icon.play,color='lG',fontSize=60,code=WIDGET.c_pressKey'return'},
177+
WIDGET.new{type='button_fill',pos={0,1},x=320,y=-80,w=80,text=CHAR.icon.retry,color='lB',fontSize=50,onClick=_freshSongList,visibleFunc=function() return love.timer.getTime()-lastFreshTime>2.6 end},
178+
WIDGET.new{type='button_fill',pos={.5,1},y=-80,w=140,h=80,text=CHAR.icon.play,color='lG',fontSize=60,onClick=WIDGET.c_pressKey'return'},
179179
sortSelector,
180-
WIDGET.new{type='button_fill',pos={1,1},x=-120,y=-80,w=160,h=80,sound_press='back',fontSize=60,text=CHAR.icon.back,code=WIDGET.c_backScn()},
180+
WIDGET.new{type='button_fill',pos={1,1},x=-120,y=-80,w=160,h=80,sound_press='back',fontSize=60,text=CHAR.icon.back,onClick=WIDGET.c_backScn()},
181181
}
182182
return scene

assets/scene/quit.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function scene.load()
1414
ZENITHA.globalEvent.setPowerInfo=NULL
1515
ZENITHA.globalEvent.clickFX=NULL
1616
VERSION.string=""
17-
MSG.new('error',"Please quit with HOME button on iOS",1e99)
17+
MSG('error',"Please quit with HOME button on iOS",1e99)
1818
end
1919
end
2020

0 commit comments

Comments
 (0)