No theme and default BG and patch BG bug when hitting F11 (#1070)

* Add setting slot for no theme & default BG

* Whitelist 4 seasons theme + blocking console's theme command if theme disabled

* Small update theme.lua

* Expose the WIDGET.setOnChange() to use in setting_video.lua

* Shorten "Use custom B.G." to "Custom B.G."

* Shorten theme code, and edit the UI

* Add lock BG

* Add VI translation

* Fullscreen patch

* Modify UI

* Small change

* Undo a mistake
This commit is contained in:
C6H12O6 + NaCl + H2O
2023-12-31 20:35:48 +07:00
committed by GitHub
parent 42942d1ac4
commit 19ea76dc4c
8 changed files with 150 additions and 87 deletions

View File

@@ -115,7 +115,7 @@ do-- function applySettings()
light={.2,.8},
color={-.2,1.2},
}
function applySettings()
function applySettings(arg)
-- Apply language
text=LANG.get(SETTING.locale)
WIDGET.setLang(text.WidgetText)
@@ -157,30 +157,34 @@ do-- function applySettings()
SHADER.fieldSatur:send('k',m[2])
-- Apply BG
if SETTING.bg=='on' then
BG.unlock()
BG.set()
elseif SETTING.bg=='off' then
BG.unlock()
BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha)
BG.lock()
elseif SETTING.bg=='custom' then
if love.filesystem.getInfo('conf/customBG') then
local res,image=pcall(GC.newImage,love.filesystem.newFile('conf/customBG'))
if res then
BG.unlock()
GC.setDefaultFilter('linear','linear')
BG.set('custom',SETTING.bgAlpha,image)
GC.setDefaultFilter('nearest','nearest')
BG.lock()
else
MES.new('error',text.customBGloadFailed)
end
else-- Switch off when custom BG not found
SETTING.bg='off'
if not (arg and arg=='fullscreen') then
if SETTING.bg=='on' then
BG.unlock()
BG.setDefault(SETTING.defaultBG)
BG.set()
if SETTING.lockBG then BG.lock() end
elseif SETTING.bg=='off' then
BG.unlock()
BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha)
BG.lock()
elseif SETTING.bg=='custom' then
if love.filesystem.getInfo('conf/customBG') then
local res,image=pcall(GC.newImage,love.filesystem.newFile('conf/customBG'))
if res then
BG.unlock()
GC.setDefaultFilter('linear','linear')
BG.set('custom',SETTING.bgAlpha,image)
GC.setDefaultFilter('nearest','nearest')
BG.lock()
else
MES.new('error',text.customBGloadFailed)
end
else-- Switch off when custom BG not found
SETTING.bg='off'
BG.unlock()
BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha)
BG.lock()
end
end
end
end