自定义背景拖入无法识别的格式时会提示

This commit is contained in:
MrZ626
2021-11-28 05:20:18 +08:00
parent f8b9f30fd6
commit 73145b4e5e
10 changed files with 31 additions and 14 deletions

View File

@@ -119,13 +119,17 @@ function applyBG()
BG.lock()
elseif SETTING.bg=='custom'then
if love.filesystem.getInfo('conf/customBG')then
BG.unlock()
BG.set('custom')
gc.setDefaultFilter('linear','linear')
local image=gc.newImage(love.filesystem.newFile('conf/customBG'))
gc.setDefaultFilter('nearest','nearest')
BG.send(SETTING.bgAlpha,image)
BG.lock()
local res,image=pcall(gc.newImage,love.filesystem.newFile('conf/customBG'))
if res then
BG.unlock()
BG.set('custom')
gc.setDefaultFilter('linear','linear')
BG.send(SETTING.bgAlpha,image)
gc.setDefaultFilter('nearest','nearest')
BG.lock()
else
MES.new('error',text.customBGloadFailed)
end
else
SETTING.bg='off'
applyBG()