Skip to content

Commit 8cbb500

Browse files
committed
exterior添加帧率稳定性设置
失去焦点时主动减少资源占用 框架跟进
1 parent 198fd21 commit 8cbb500

File tree

10 files changed

+37
-29
lines changed

10 files changed

+37
-29
lines changed

Zenitha

assets/language/lang_en.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ local L={
9292
graph_brik_title="M-Graph", -- TRASLATING NOTE: from "Knowledge Graph" (AI domain)
9393
settings_title="Settings",
9494

95-
setting_hint_asd="Auto Shift Delay",-- Add translation with \n[second line]
96-
setting_hint_asp="Auto Shift Period",-- Add translation with \n[second line]
97-
setting_hint_adp="Auto Drop Period",-- Add translation with \n[second line]
98-
setting_hint_ash="Auto Shift Halt",-- Add translation with \n[second line]
9995
setting_softdropSkipAsd="Skip Drop Delay",
10096
setting_shakeness="Shakiness",
10197
setting_hitWavePower="Hitwave Power",
@@ -122,14 +118,21 @@ local L={
122118
setting_showTouch="Show touches",
123119

124120
setting_maxTPS="Max TPS",
125-
setting_updateRate="Update rate",
126-
setting_renderRate="Render rate",
121+
setting_updateRate="Update Rate",
122+
setting_renderRate="Render Rate",
123+
setting_stability="Tick Stability",
127124
setting_msaa="MSAA",
128125
setting_fmod_maxChannel="Max Channel",
129126
setting_fmod_DSPBufferCount="DSPBufferCount",
130127
setting_fmod_DSPBufferLength="DSPBufferLength",
131128
setting_apply="Apply",
132129

130+
setting_hint_asd="Auto Shift Delay",-- Add translation with \n[second line]
131+
setting_hint_asp="Auto Shift Period",-- Add translation with \n[second line]
132+
setting_hint_adp="Auto Drop Period",-- Add translation with \n[second line]
133+
setting_hint_ash="Auto Shift Halt",-- Add translation with \n[second line]
134+
setting_hint_stability="Stabler tick interval but higher CPU usage\nUse minimal value that can keep TPS stable",
135+
133136
lang_note="The original languages are Chinese & English.\nAll translations are contributed by volunteers and it may not be 100% accurate\nThere are some terms not translated directly, please check Zictionary for more information",
134137

135138
keyset_title="Keybinds",

assets/language/lang_eo.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ local L={
9292
graph_brik_title="M-Grafiko", -- TRASLATING NOTE: from "Knowledge Graph" (AI domain)
9393
settings_title="Agordoj",
9494

95-
-- setting_hint_asd="Auto Shift Delay",-- Add translation with \n[second line]
96-
-- setting_hint_asp="Auto Shift Period",-- Add translation with \n[second line]
97-
-- setting_hint_adp="Auto Drop Period",-- Add translation with \n[second line]
98-
-- setting_hint_ash="Auto Shift Halt",-- Add translation with \n[second line]
9995
setting_softdropSkipAsd="Skip Drop Prokrasto",
10096
setting_shakeness="Tremo",
10197
setting_hitWavePower="Hitwave Potenco",

assets/language/lang_it.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ local L={
9292
graph_brik_title="M-Graph", -- TRASLATING NOTE: from "Knowledge Graph" (AI domain)
9393
settings_title="Impostazioni",
9494

95-
-- setting_hint_asd="Auto Shift Delay",-- Add translation with \n[second line]
96-
-- setting_hint_asp="Auto Shift Period",-- Add translation with \n[second line]
97-
-- setting_hint_adp="Auto Drop Period",-- Add translation with \n[second line]
98-
-- setting_hint_ash="Auto Shift Halt",-- Add translation with \n[second line]
9995
setting_softdropSkipAsd="Skip Drop Delay",
10096
setting_shakeness="Shakiness",
10197
setting_hitWavePower="Hitwave Power",

assets/language/lang_zh.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ local L={
9292
graph_brik_title="M-图谱", -- TRASLATING NOTE: 取自“知识图谱”(人工智能领域)
9393
settings_title="设置",
9494

95-
setting_hint_asd="Auto Shift Delay\n重复移动延迟",
96-
setting_hint_asp="Auto Shift Period\n重复移动周期",
97-
setting_hint_adp="Auto Drop Period\n重复下落周期",
98-
setting_hint_ash="Auto Shift Halt\n重复移动阻止",
9995
setting_softdropSkipAsd="跳过软降延迟",
10096
setting_shakeness="场地晃动",
10197
setting_hitWavePower="冲击波强度",
@@ -124,12 +120,19 @@ local L={
124120
setting_maxTPS="最大刻数",
125121
setting_updateRate="更新比率",
126122
setting_renderRate="绘制比率",
123+
setting_stability="刻数稳定性",
127124
setting_msaa="抗锯齿",
128125
setting_fmod_maxChannel="最大音频数",
129126
setting_fmod_DSPBufferCount="DSP缓冲区数量",
130127
setting_fmod_DSPBufferLength="DSP缓冲区长度",
131128
setting_apply="应用",
132129

130+
setting_hint_asd="Auto Shift Delay\n重复移动延迟",
131+
setting_hint_asp="Auto Shift Period\n重复移动周期",
132+
setting_hint_adp="Auto Drop Period\n重复下落周期",
133+
setting_hint_ash="Auto Shift Halt\n重复移动阻止",
134+
setting_hint_stability="占用更多系统资源来稳定帧率\n推荐调节至帧率足够稳定时尽可能小的值",
135+
133136
lang_note="原始语言只有中文和英文\n翻译由志愿者贡献,不保证100%准确\n部分术语可能没有翻译,请查阅词典获取更多信息",
134137

135138
keyset_title="键位绑定",

assets/scene/error.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local texts={
1515
local scene={}
1616

1717
function scene.load()
18-
ZENITHA.setMaxFPS(60)
18+
ZENITHA.setMainLoopSpeed(60)
1919
ZENITHA.setUpdateRate(62)
2020
ZENITHA.setRenderRate(26)
2121
FMOD.destroy()

assets/scene/musicroom.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,17 @@ function scene.touchDown() scene.focus(true) end
202202
function scene.focus(f) -- Reduce carbon footprint for music lovers
203203
if f then
204204
if noResponseTimer<=0 then
205-
ZENITHA.setMaxFPS(SETTINGS.system.maxTPS)
205+
ZENITHA.setMainLoopSpeed(SETTINGS.system.maxTPS)
206+
ZENITHA.setSleepDurationError(SETTINGS.system.stability)
206207
ZENITHA.setUpdateRate(SETTINGS.system.updateRate)
207208
ZENITHA.setRenderRate(SETTINGS.system.renderRate)
208209
end
209210
noResponseTimer=6.26
210211
else
211212
ZENITHA.setCursorVis()
212213
noResponseTimer=-1
213-
ZENITHA.setMaxFPS(26)
214+
ZENITHA.setMainLoopSpeed(26)
215+
ZENITHA.setSleepDurationError(-1)
214216
ZENITHA.setUpdateRate(26)
215217
ZENITHA.setRenderRate(26)
216218
end

assets/scene/setting_out.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ scene.widgetList={
108108
end},
109109

110110
-- Video
111-
{name='3', type='slider_fill',pos={0,0},x=340, y=220,w=500,h=30,text=LANG'setting_hitWavePower',widthLimit=260,axis={0,1}, disp=TABLE.func_getVal(SETTINGS.system,'hitWavePower'), code=TABLE.func_setVal(SETTINGS.system,'hitWavePower')},
112-
{name='3', type='slider', pos={0,0},x=340, y=300,w=500, text=LANG'setting_maxTPS', widthLimit=260,axis={120,400,10},smooth=true,disp=TABLE.func_getVal(SETTINGS.system,'maxTPS'), valueShow=sliderShow_maxTPS, code=TABLE.func_setVal(SETTINGS.system,'maxTPS')},
113-
{name='3', type='slider', pos={0,0},x=340, y=380,w=500, text=LANG'setting_updateRate', widthLimit=260,axis={20,100,10}, disp=TABLE.func_getVal(SETTINGS.system,'updateRate'),valueShow=sliderShow_update, code=TABLE.func_setVal(SETTINGS.system,'updateRate')},
114-
{name='3', type='slider', pos={0,0},x=340, y=460,w=500, text=LANG'setting_renderRate', widthLimit=260,axis={20,100,10}, disp=TABLE.func_getVal(SETTINGS.system,'renderRate'),valueShow=sliderShow_render, code=TABLE.func_setVal(SETTINGS.system,'renderRate')},
115-
{name='3', type='slider', pos={0,0},x=340, y=540,w=250, text=LANG'setting_msaa', widthLimit=260,axis={0,4,1}, disp=function() return SETTINGS.system.msaa==0 and 0 or math.log(SETTINGS.system.msaa,2) end, valueShow=function(S) return (S.disp()==0 and 0 or 2^S.disp()).."x" end, code=function(v) SETTINGS.system.msaa=v==0 and 0 or 2^v; saveSettings(); if TASK.lock('warnMessage',6.26) then MSG('warn',Text.setting_needRestart,6.26) end end},
111+
{name='3', type='slider_fill',pos={0,0},x=340, y=220,w=500,h=30,text=LANG'setting_hitWavePower',widthLimit=260,axis={0,1}, disp=TABLE.func_getVal(SETTINGS.system,'hitWavePower'), code=TABLE.func_setVal(SETTINGS.system,'hitWavePower')},
112+
{name='3', type='slider', pos={0,0},x=340, y=300,w=500, text=LANG'setting_maxTPS', widthLimit=260,axis={120,400,10},smooth=true,disp=TABLE.func_getVal(SETTINGS.system,'maxTPS'), valueShow=sliderShow_maxTPS,code=TABLE.func_setVal(SETTINGS.system,'maxTPS')},
113+
{name='3', type='slider', pos={0,0},x=340, y=380,w=500, text=LANG'setting_updateRate', widthLimit=260,axis={20,100,10}, disp=TABLE.func_getVal(SETTINGS.system,'updateRate'),valueShow=sliderShow_update,code=TABLE.func_setVal(SETTINGS.system,'updateRate')},
114+
{name='3', type='slider', pos={0,0},x=340, y=460,w=500, text=LANG'setting_renderRate', widthLimit=260,axis={20,100,10}, disp=TABLE.func_getVal(SETTINGS.system,'renderRate'),valueShow=sliderShow_render,code=TABLE.func_setVal(SETTINGS.system,'renderRate')},
115+
{name='3', type='slider', pos={0,0},x=340, y=540,w=500, text=LANG'setting_stability', widthLimit=260,axis={-1,1,0.1}, disp=TABLE.func_getVal(SETTINGS.system,'stability'), valueShow=sliderShow_time, code=TABLE.func_setVal(SETTINGS.system,'stability')},
116+
{name='3', type='slider', pos={0,0},x=340, y=620,w=250, text=LANG'setting_msaa', widthLimit=260,axis={0,4,1}, disp=function() return SETTINGS.system.msaa==0 and 0 or math.log(SETTINGS.system.msaa,2) end, valueShow=function(S) return (S.disp()==0 and 0 or 2^S.disp()).."x" end, code=function(v) SETTINGS.system.msaa=v==0 and 0 or 2^v; saveSettings(); if TASK.lock('warnMessage',6.26) then MSG('warn',Text.setting_needRestart,6.26) end end},
116117
{name='3', type='switch', pos={1,0},x=-500,y=220,h=45, text=LANG'setting_sysCursor', widthLimit=260,labelPos='right', disp=TABLE.func_getVal(SETTINGS.system,'sysCursor'), code=TABLE.func_revVal(SETTINGS.system,'sysCursor')},
117118
{name='3', type='switch', pos={1,0},x=-500,y=290,h=45, text=LANG'setting_power', widthLimit=260,labelPos='right', disp=TABLE.func_getVal(SETTINGS.system,'powerInfo'), code=TABLE.func_revVal(SETTINGS.system,'powerInfo')},
118119
{name='3', type='switch', pos={1,0},x=-500,y=360,h=45, text=LANG'setting_clean', widthLimit=260,labelPos='right', disp=TABLE.func_getVal(SETTINGS.system,'cleanCanvas'), code=TABLE.func_revVal(SETTINGS.system,'cleanCanvas')},
@@ -136,5 +137,6 @@ scene.widgetList={
136137
{name='1',type='hint',pos={0,0},x=210,y=300,floatText=LANG'setting_hint_asp'},
137138
{name='1',type='hint',pos={0,0},x=210,y=380,floatText=LANG'setting_hint_adp'},
138139
{name='1',type='hint',pos={0,0},x=210,y=460,floatText=LANG'setting_hint_ash'},
140+
{name='3',type='hint',pos={0,0},x=100,y=540,floatText=LANG'setting_hint_stability'},
139141
}
140142
return scene

assets/settings.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ local settings={
1919
maxTPS=300,
2020
updateRate=100,
2121
renderRate=30,
22+
stability=0,
2223
msaa=4,
2324

2425
-- Gameplay
@@ -77,9 +78,10 @@ local settingTriggers={ -- Changing values in SETTINGS.system will trigger these
7778

7879
-- Video
7980
fullscreen= function(v) love.window.setFullscreen(v); love.resize(love.graphics.getWidth(),love.graphics.getHeight()) end,
80-
maxTPS= function(v) ZENITHA.setMaxFPS(v) end,
81+
maxTPS= function(v) ZENITHA.setMainLoopSpeed(v) end,
8182
updateRate= function(v) ZENITHA.setUpdateRate(v) end,
8283
renderRate= function(v) ZENITHA.setRenderRate(v) end,
84+
stability= function(v) ZENITHA.setSleepDurationError(v) end,
8385
sysCursor= function(v) love.mouse.setVisible(v) end,
8486
clean= function(v) ZENITHA.setCleanCanvas(v) end,
8587

main.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ UTIL.time("Require game modules",true)
8282
ZENITHA.setAppName('Techmino')
8383
ZENITHA.setVersionText(VERSION.appVer)
8484
ZENITHA.setFirstScene('hello')
85-
ZENITHA.setMaxFPS(260)
8685
ZENITHA.setDebugInfo{
8786
{"Cache",gcinfo},
8887
{"Tasks",TASK.getCount},
@@ -191,6 +190,11 @@ function ZENITHA.globalEvent.focus(f)
191190
FMOD.setMainVolume(0)
192191
end
193192
end
193+
if f then
194+
ZENITHA.setSleepDurationError(SETTINGS.system.stability)
195+
else
196+
ZENITHA.setSleepDurationError(-1)
197+
end
194198
end
195199
local autoGCcount=0
196200
function ZENITHA.globalEvent.lowMemory()

0 commit comments

Comments
 (0)