Skip to content

Commit

Permalink
补充语法注释,可以补全语言文本了
Browse files Browse the repository at this point in the history
框架跟进
  • Loading branch information
MrZ626 committed May 11, 2024
1 parent e79dac9 commit 8f7ec12
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Zenitha
Submodule Zenitha updated 4 files
+412 −242 init.lua
+21 −14 scene.lua
+4 −4 scene/test.lua
+2 −2 widget.lua
5 changes: 3 additions & 2 deletions assets/fmod20221/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion assets/game/brikPlayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion assets/language/lang_en.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return {
---@class Techmino.I18N
local L={
-- Info
sureText={
back="Press again to go back",
Expand All @@ -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={
Expand Down Expand Up @@ -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
5 changes: 4 additions & 1 deletion assets/language/lang_zh.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return {
---@class Techmino.I18N
local L={
-- Info
sureText={
back="再按一次返回",
Expand All @@ -11,6 +12,7 @@ return {
interior_crash="沙箱意外退出:性能评分越界",
booting_changed="引导程序已更改",
musicroom_lowVolume="请调高音乐音量(开关在右下角)",
autoGC="[Auto GC] 设备内存过低",

-- In-Game
clearName={
Expand Down Expand Up @@ -296,3 +298,4 @@ return {
tutorial_rotating_1="6. 旋转练习",
tutorial_rotating_2="请将上面的方块旋转成下面的朝向",
}
return L
12 changes: 6 additions & 6 deletions assets/progress.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions assets/scene/app_15p.lua
Original file line number Diff line number Diff line change
Expand Up @@ -199,63 +199,63 @@ 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={
COLOR.dR,COLOR.dR,COLOR.dR,COLOR.dR,
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)
Expand Down
26 changes: 13 additions & 13 deletions assets/scene/app_triple.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion assets/scene/hello.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion assets/scene/setting_out.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')},
Expand Down
35 changes: 20 additions & 15 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,39 @@ 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)
elseif SCN.cur~='musicroom' then
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')
Expand Down

0 comments on commit 8f7ec12

Please sign in to comment.