From 8f7ec1211b69b39791af43975f4948b11517aee7 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sun, 12 May 2024 05:36:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AF=AD=E6=B3=95=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=A1=A5=E5=85=A8=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E6=96=87=E6=9C=AC=E4=BA=86=20=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E8=B7=9F=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zenitha | 2 +- assets/fmod20221/init.lua | 5 +++-- assets/game/brikPlayer.lua | 2 +- assets/language/lang_en.lua | 5 ++++- assets/language/lang_zh.lua | 5 ++++- assets/progress.lua | 12 ++++++------ assets/scene/app_15p.lua | 20 ++++++++++---------- assets/scene/app_triple.lua | 26 +++++++++++++------------- assets/scene/hello.lua | 2 +- assets/scene/setting_out.lua | 2 +- main.lua | 35 ++++++++++++++++++++--------------- 11 files changed, 64 insertions(+), 52 deletions(-) diff --git a/Zenitha b/Zenitha index 4ffe4578..880376a2 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit 4ffe457847e5aa2c2e592e783ba1e77c011afd36 +Subproject commit 880376a27ac38fe9bb6232d43950d67d0c609064 diff --git a/assets/fmod20221/init.lua b/assets/fmod20221/init.lua index 12ba423d..7872c5c5 100644 --- a/assets/fmod20221/init.lua +++ b/assets/fmod20221/init.lua @@ -24,8 +24,8 @@ require("errors") -------------------------------------------------------------- -local studio ---@type FMOD.Studio.System -local core ---@type FMOD.Core.System +local studio ---@type FMOD.Studio.System? +local core ---@type FMOD.Core.System? ---@param args {maxChannel:number, DSPBufferLength:number, DSPBufferCount:number, studioFlag:FMOD.Const, coreFlag:FMOD.Const} function M.init(args) @@ -51,6 +51,7 @@ end ---Release studio object (call this when game running into critical error) function M.destroy() + if not studio then return end studio:release() studio=nil end diff --git a/assets/game/brikPlayer.lua b/assets/game/brikPlayer.lua index c1bdd43e..ce863eca 100644 --- a/assets/game/brikPlayer.lua +++ b/assets/game/brikPlayer.lua @@ -1948,7 +1948,7 @@ local baseEnv={ rotSys='TRS', tuck=false, spin_immobile=false, - spin_corners=false,---@type false|number + spin_corners=false, ---@type false|number atkSys='none', allowCancel=true, allowBlock=true, diff --git a/assets/language/lang_en.lua b/assets/language/lang_en.lua index 524e838e..8c21cd94 100644 --- a/assets/language/lang_en.lua +++ b/assets/language/lang_en.lua @@ -1,4 +1,5 @@ -return { +---@class Techmino.I18N +local L={ -- Info sureText={ back="Press again to go back", @@ -11,6 +12,7 @@ return { interior_crash="Sandbox exited due to performance rate overflow", booting_changed="Booting application changed", musicroom_lowVolume="Please increase BGM volume (bottom right)", + autoGC="[Auto GC] Low Memory", -- In-Game clearName={ @@ -296,3 +298,4 @@ return { tutorial_rotating_1="6. Rotating Practice", tutorial_rotating_2="Please rotating the top piece to align the bottom one", } +return L diff --git a/assets/language/lang_zh.lua b/assets/language/lang_zh.lua index 3e07e0d3..f68acd58 100644 --- a/assets/language/lang_zh.lua +++ b/assets/language/lang_zh.lua @@ -1,4 +1,5 @@ -return { +---@class Techmino.I18N +local L={ -- Info sureText={ back="再按一次返回", @@ -11,6 +12,7 @@ return { interior_crash="沙箱意外退出:性能评分越界", booting_changed="引导程序已更改", musicroom_lowVolume="请调高音乐音量(开关在右下角)", + autoGC="[Auto GC] 设备内存过低", -- In-Game clearName={ @@ -296,3 +298,4 @@ return { tutorial_rotating_1="6. 旋转练习", tutorial_rotating_2="请将上面的方块旋转成下面的朝向", } +return L diff --git a/assets/progress.lua b/assets/progress.lua index 61d9171d..0d2e123c 100644 --- a/assets/progress.lua +++ b/assets/progress.lua @@ -161,7 +161,7 @@ function PROGRESS.setEnv(env) PROGRESS.setInteriorBG() PROGRESS.playInteriorBGM() ZENITHA.setClickFX(true) - ZENITHA.setDrawCursor(function(_,x,y) + function ZENITHA.globalEvent.drawCursor(_,x,y) if not SETTINGS.system.sysCursor then gc.setColor(1,1,1) gc.setLineWidth(2) @@ -173,12 +173,12 @@ function PROGRESS.setEnv(env) gc.line(0,-15,0,15) gc.line(-15,0,15,0) end - end) + end elseif env=='exterior' then PROGRESS.setExteriorBG() PROGRESS.playExteriorBGM() ZENITHA.setClickFX(function(x,y) SYSFX.new('glow',2,x,y,20) end) - ZENITHA.setDrawCursor(function(_,x,y) + function ZENITHA.globalEvent.drawCursor(_,x,y) if not SETTINGS.system.sysCursor then gc.setColor(1,1,1) gc.setLineWidth(2) @@ -192,8 +192,8 @@ function PROGRESS.setEnv(env) gc.line(0,-20,0,20) gc.line(-20,0,20,0) end - end) - ZENITHA.setDrawSysInfo(sysInfoFunc) + end + ZENITHA.globalEvent.drawSysInfo=sysInfoFunc else error("?") end @@ -229,7 +229,7 @@ function PROGRESS.transcendTo(n) coverAlpha=0, noDefaultDraw=true, init=function() - ZENITHA.setDrawCursor(NULL) + ZENITHA.globalEvent.drawCursor=NULL end, update=function(dt,t) if t<1.626 then diff --git a/assets/scene/app_15p.lua b/assets/scene/app_15p.lua index 8a309206..59b66a86 100644 --- a/assets/scene/app_15p.lua +++ b/assets/scene/app_15p.lua @@ -199,31 +199,31 @@ local frontColor={ COLOR.lG,COLOR.lB,COLOR.lB,COLOR.lB, COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV, COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV, - },-- Colored(rank) + }, -- Colored(rank) rainbow={ COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR, COLOR.lO,COLOR.lY,COLOR.lY,COLOR.lY, COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB, COLOR.lO,COLOR.lG,COLOR.lB,COLOR.lB, - },-- Rainbow(rank) + }, -- Rainbow(rank) color2={ COLOR.lR,COLOR.lR,COLOR.lR,COLOR.lR, COLOR.lB,COLOR.lB,COLOR.lB,COLOR.lB, COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV, COLOR.lG,COLOR.lY,COLOR.lV,COLOR.lV, - },-- Colored(row) + }, -- Colored(row) gray={ COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, - },-- Gray + }, -- Gray black={ COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, COLOR.L,COLOR.L,COLOR.L,COLOR.L, - },-- Black + }, -- Black } local backColor={ color1={ @@ -231,31 +231,31 @@ local backColor={ COLOR.dG,COLOR.dB,COLOR.dB,COLOR.dB, COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP, COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP, - },-- Colored(rank) + }, -- Colored(rank) rainbow={ COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR, COLOR.dO,COLOR.dY,COLOR.dY,COLOR.dY, COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB, COLOR.dO,COLOR.dG,COLOR.dB,COLOR.dB, - },-- Rainbow(rank) + }, -- Rainbow(rank) color2={ COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR, COLOR.dB,COLOR.dB,COLOR.dB,COLOR.dB, COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP, COLOR.dG,COLOR.dY,COLOR.dP,COLOR.dP, - },-- Colored(row) + }, -- Colored(row) gray={ COLOR.dL,COLOR.dL,COLOR.dL,COLOR.dL, COLOR.dL,COLOR.dL,COLOR.dL,COLOR.dL, COLOR.dL,COLOR.dL,COLOR.dL,COLOR.dL, COLOR.dL,COLOR.dL,COLOR.dL,COLOR.dL, - },-- Gray + }, -- Gray black={ COLOR.D,COLOR.D,COLOR.D,COLOR.D, COLOR.D,COLOR.D,COLOR.D,COLOR.D, COLOR.D,COLOR.D,COLOR.D,COLOR.D, COLOR.D,COLOR.D,COLOR.D,COLOR.D, - },-- Black + }, -- Black } function scene.draw() gc.replaceTransform(SCR.xOy_l) diff --git a/assets/scene/app_triple.lua b/assets/scene/app_triple.lua index cd244518..9b3acdf8 100644 --- a/assets/scene/app_triple.lua +++ b/assets/scene/app_triple.lua @@ -7,20 +7,20 @@ local ins,rem=table.insert,table.remove local setFont,mStr=FONT.set,GC.mStr local tileColor={ - [-2]=COLOR.R, -- Bomb + [-2]=COLOR.R, -- Bomb [-1]=COLOR.DL, -- Stone - {.39, 1.0, .39},-- Tile 1 - {.39, .39, 1.0},-- Tile 2 - {1.0, .70, .31},-- Tile 3 - {.94, .31, .31},-- Tile 4 - {.00, .71, .12},-- Tile 5 - {.90, .20, .90},-- Tile 6 - {.94, .47, .39},-- Tile 7 - {.90, .00, .00},-- Tile 8 - {.86, .86, .31},-- Tile 9 - {.78, .31, .00},-- Tile 10 - {.78, .55, .04},-- Tile 11 - {.12, .12, .51},-- Tile 12 + {.39, 1.0, .39}, -- Tile 1 + {.39, .39, 1.0}, -- Tile 2 + {1.0, .70, .31}, -- Tile 3 + {.94, .31, .31}, -- Tile 4 + {.00, .71, .12}, -- Tile 5 + {.90, .20, .90}, -- Tile 6 + {.94, .47, .39}, -- Tile 7 + {.90, .00, .00}, -- Tile 8 + {.86, .86, .31}, -- Tile 9 + {.78, .31, .00}, -- Tile 10 + {.78, .55, .04}, -- Tile 11 + {.12, .12, .51}, -- Tile 12 } local textColor={ [-2]=COLOR.dR, diff --git a/assets/scene/hello.lua b/assets/scene/hello.lua index ed39ff63..7283a42f 100644 --- a/assets/scene/hello.lua +++ b/assets/scene/hello.lua @@ -7,7 +7,7 @@ local scene={} function scene.enter() t=0 ZENITHA.setClickFX(false) - ZENITHA.setDrawCursor(NULL) + ZENITHA.globalEvent.drawCursor=NULL if PROGRESS.get('main')>=3 then PROGRESS.applyCoolWaitTemplate() end end diff --git a/assets/scene/setting_out.lua b/assets/scene/setting_out.lua index ea2e2823..0fbebe31 100644 --- a/assets/scene/setting_out.lua +++ b/assets/scene/setting_out.lua @@ -62,7 +62,7 @@ scene.widgetList={ -- Controls {name='1',type='slider', pos={0,0},x=340, y=220,w=650, fontSize=35,text=LANG'setting_asd', widthLimit=260,axis={0,260,1},smooth=true,disp=TABLE.func_getVal(SETTINGS.game_brik,'asd'), valueShow=sliderShow_time, code=function(v) SETTINGS.game_brik.asd=v; SETTINGS.game_brik.asp=math.min(SETTINGS.game_brik.asp,SETTINGS.game_brik.asd); SETTINGS.game_brik.ash=math.min(SETTINGS.game_brik.ash,SETTINGS.game_brik.asd) end}, {name='1',type='slider', pos={0,0},x=340, y=300,w=300, fontSize=35,text=LANG'setting_asp', widthLimit=260,axis={0,120,1},smooth=true,disp=TABLE.func_getVal(SETTINGS.game_brik,'asp'), valueShow=sliderShow_time, code=function(v) SETTINGS.game_brik.asp=v; SETTINGS.game_brik.asd=math.max(SETTINGS.game_brik.asd,SETTINGS.game_brik.asp) end}, - {name='1',type='switch', pos={0,0},x=750, y=300,h=40, labelPos='right',fontSize=35,text=LANG'setting_softdropSkipAsd',disp=TABLE.func_getVal(SETTINGS.game_brik,'softdropSkipAsd'),code=TABLE.func_revVal(SETTINGS.game_brik,'softdropSkipAsd')},-- visibleTick=function() return page=='1' and SETTINGS.game_brik.asp>0 end + {name='1',type='switch', pos={0,0},x=750, y=300,h=40, labelPos='right',fontSize=35,text=LANG'setting_softdropSkipAsd',disp=TABLE.func_getVal(SETTINGS.game_brik,'softdropSkipAsd'),code=TABLE.func_revVal(SETTINGS.game_brik,'softdropSkipAsd')}, -- visibleTick=function() return page=='1' and SETTINGS.game_brik.asp>0 end {name='1',type='slider', pos={0,0},x=340, y=380,w=650, fontSize=35,text=LANG'setting_ash', widthLimit=260,axis={0,260,1},smooth=true,disp=TABLE.func_getVal(SETTINGS.game_brik,'ash'), valueShow=sliderShow_time, code=function(v) SETTINGS.game_brik.ash=v; SETTINGS.game_brik.asd=math.max(SETTINGS.game_brik.asd,SETTINGS.game_brik.ash) end}, {name='1',type='button', pos={0,0},x=500, y=480,w=360, h=80,cornerR=10, fontSize=40,text=LANG'setting_keymapping', code=WIDGET.c_goScn('keyset_out','fadeHeader')}, {name='1',type='switch', pos={0,0},x=360, y=620,h=40, labelPos='right',fontSize=40,text=LANG'setting_enableTouching', disp=TABLE.func_getVal(SETTINGS.system,'touchControl'),code=TABLE.func_revVal(SETTINGS.system,'touchControl')}, diff --git a/main.lua b/main.lua index 16c47a15..f3f82bc9 100644 --- a/main.lua +++ b/main.lua @@ -75,26 +75,23 @@ ZENITHA.setAppName('Techmino') ZENITHA.setVersionText(VERSION.appVer) ZENITHA.setFirstScene('hello') ZENITHA.setMaxFPS(260) -ZENITHA.setOnGlobalKey('f11',function() - SETTINGS.system.fullscreen=not SETTINGS.system.fullscreen - saveSettings() -end) -ZENITHA.setOnFnKeys({ - function() MSG.new('info',("System:%s[%s]\nLuaVer:%s\nJitVer:%s\nJitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num)) end, - function() MSG.new('check',PROFILE.switch() and "Profile start!" or "Profile report copied!") end, - function() if love['_openConsole'] then love['_openConsole']() end end, - function() for k,v in next,_G do print(k,v) end end, - function() print(WIDGET.sel and WIDGET.sel:getInfo() or "No widget selected") end, - function() end, - function() end, -}) ZENITHA.setDebugInfo{ {"Cache", gcinfo}, {"Tasks", TASK.getCount}, {"Mouse", function() local x,y=SCR.xOy:inverseTransformPoint(love.mouse.getPosition()) return math.floor(x+.5)..' '..math.floor(y+.5) end}, -- {"FMOD", function() local a,b,c=FMOD.studio:getMemoryUsage() return a..","..b..","..c end}, -- Only available in logging builds Fmod } -ZENITHA.setOnFocus(function(f) + +local _keyDown_orig=ZENITHA.globalEvent.keyDown +function ZENITHA.globalEvent.keyDown(key,isRep) + if _keyDown_orig(key,isRep) then return true end + if key=='f11' then + SETTINGS.system.fullscreen=not SETTINGS.system.fullscreen + saveSettings() + return true + end +end +function ZENITHA.globalEvent.focus(f) if SETTINGS.system.autoMute then if f then FMOD.setMainVolume(SETTINGS.system.mainVol) @@ -102,7 +99,15 @@ ZENITHA.setOnFocus(function(f) FMOD.setMainVolume(0) end end -end) +end +local autoGCcount=0 +function ZENITHA.globalEvent.lowMemory() + collectgarbage() + if autoGCcount<6 then + autoGCcount=autoGCcount+1 + MSG.new('check',Text.autoGC..('.'):rep(4-autoGCcount)) + end +end FONT.setDefaultFallback('symbols') FONT.setDefaultFont('norm')